List Versions
client.workers.beta.workers.versions.list(stringworkerId, VersionListParams { account_id, page, per_page } params, RequestOptionsoptions?): V4PagePaginationArray<Version { id, created_on, number, 15 more } >
GET/accounts/{account_id}/workers/workers/{worker_id}/versions
List all versions for a Worker.
Security
API Token
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
Example:
API Email + API Key
The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.
Example:
The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.
Example:
Accepted Permissions (at least one required)
List Versions
import Cloudflare from 'cloudflare';
const client = new Cloudflare({
apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted
});
// Automatically fetches more pages as needed.
for await (const version of client.workers.beta.workers.versions.list('worker_id', {
account_id: '023e105f4ecef8ad9ca31a8372d0c353',
})) {
console.log(version.id);
}{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": [
{
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"created_on": "2019-12-27T18:11:19.117Z",
"number": 0,
"urls": [
"https://9387e76d-my-worker.my-subdomain.workers.dev"
],
"annotations": {
"workers/message": "Fixed bug.",
"workers/tag": "v1.0.1",
"workers/triggered_by": "upload"
},
"assets": {
"config": {
"html_handling": "auto-trailing-slash",
"not_found_handling": "404-page",
"run_worker_first": [
"string"
]
},
"jwt": "jwt"
},
"bindings": [
{
"name": "MY_ENV_VAR",
"text": "my_data",
"type": "plain_text"
}
],
"compatibility_date": "2021-01-01",
"compatibility_flags": [
"nodejs_compat"
],
"limits": {
"cpu_ms": 50
},
"main_module": "index.js",
"migration_tag": "v1",
"migrations": {},
"modules": [
{
"content_base64": "ZXhwb3J0IGRlZmF1bHQgewogIGFzeW5jIGZldGNoKHJlcXVlc3QsIGVudiwgY3R4KSB7CiAgICByZXR1cm4gbmV3IFJlc3BvbnNlKCdIZWxsbyBXb3JsZCEnKQogIH0KfQ==",
"content_type": "application/javascript+module",
"name": "index.js"
}
],
"placement": {
"mode": "smart"
},
"source": "wrangler",
"startup_time_ms": 10,
"usage_model": "standard"
}
],
"success": true,
"result_info": {
"count": 1,
"page": 1,
"per_page": 20,
"total_count": 2000,
"total_pages": 100
}
}Returns Examples
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": [
{
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"created_on": "2019-12-27T18:11:19.117Z",
"number": 0,
"urls": [
"https://9387e76d-my-worker.my-subdomain.workers.dev"
],
"annotations": {
"workers/message": "Fixed bug.",
"workers/tag": "v1.0.1",
"workers/triggered_by": "upload"
},
"assets": {
"config": {
"html_handling": "auto-trailing-slash",
"not_found_handling": "404-page",
"run_worker_first": [
"string"
]
},
"jwt": "jwt"
},
"bindings": [
{
"name": "MY_ENV_VAR",
"text": "my_data",
"type": "plain_text"
}
],
"compatibility_date": "2021-01-01",
"compatibility_flags": [
"nodejs_compat"
],
"limits": {
"cpu_ms": 50
},
"main_module": "index.js",
"migration_tag": "v1",
"migrations": {},
"modules": [
{
"content_base64": "ZXhwb3J0IGRlZmF1bHQgewogIGFzeW5jIGZldGNoKHJlcXVlc3QsIGVudiwgY3R4KSB7CiAgICByZXR1cm4gbmV3IFJlc3BvbnNlKCdIZWxsbyBXb3JsZCEnKQogIH0KfQ==",
"content_type": "application/javascript+module",
"name": "index.js"
}
],
"placement": {
"mode": "smart"
},
"source": "wrangler",
"startup_time_ms": 10,
"usage_model": "standard"
}
],
"success": true,
"result_info": {
"count": 1,
"page": 1,
"per_page": 20,
"total_count": 2000,
"total_pages": 100
}
}