跳转到内容
EN

更新 Worker

PUT /cloudflare/client/v4/accounts/{account_id}/workers/workers/{worker_id}

Update a Worker. Omitted fields stay unchanged (same as PATCH).

支持状态: partial

Update a Worker. Omitted fields stay unchanged (same as PATCH).

参数

名称位置类型必填说明
account_idpathstringtrueAny value; your account comes from the API key.
worker_idpathstringtrueWorker ID or name.

请求体 (application/json)

必填: true

名称类型说明
namestringWorker name, unique in your account: 3–40 lowercase letters, digits or hyphens, starting and ending with a letter or digit, with no two hyphens in a row. The names www, api, admin, app, canary, canary-probe, status, docs and console are reserved.
tagsarray<string>Replaces the tags.
observabilityobjectObservability settings.
observability.enabledbooleanCollect logs.
subdomainobjectSubdomain settings.
subdomain.enabledbooleanServe the Worker on its public subdomain.
praxisobjectPraxis settings.
praxis.labelsobjectReplaces the labels.
praxis.accessstringWho may open the application on its default host (ADR-206). Only the organization’s owner (full authority) may change it; a credential limited to bound resources is refused with PERMISSION_DENIED. A change takes effect within 10 seconds.
{
"type": "object",
"required": [],
"properties": {
"name": {
"type": "string",
"description": "Worker name, unique in your account: 3–40 lowercase letters, digits or hyphens, starting and ending with a letter or digit, with no two hyphens in a row. The names www, api, admin, app, canary, canary-probe, status, docs and console are reserved.",
"pattern": "^(?!(?:www|api|admin|app|canary|canary-probe|status|docs|console)$)(?!.*--)[a-z0-9][a-z0-9-]{1,38}[a-z0-9]$",
"example": "my-app"
},
"tags": {
"type": "array",
"items": {
"type": "string"
},
"maxItems": 8,
"description": "Replaces the tags."
},
"observability": {
"type": "object",
"description": "Observability settings.",
"required": [
"enabled"
],
"properties": {
"enabled": {
"type": "boolean",
"description": "Collect logs."
}
}
},
"subdomain": {
"type": "object",
"description": "Subdomain settings.",
"required": [
"enabled"
],
"properties": {
"enabled": {
"type": "boolean",
"description": "Serve the Worker on its public subdomain."
}
}
},
"praxis": {
"type": "object",
"description": "Praxis settings.",
"required": [],
"properties": {
"labels": {
"type": "object",
"additionalProperties": {
"type": "string"
},
"description": "Replaces the labels."
},
"access": {
"type": "string",
"description": "Who may open the application on its default host (ADR-206). Only the organization's owner (full authority) may change it; a credential limited to bound resources is refused with PERMISSION_DENIED. A change takes effect within 10 seconds.",
"enum": [
"public",
"organization"
],
"x-enum-descriptions": {
"public": "Anyone with the address may open the application (default).",
"organization": "Only signed-in members of the owning organization; the platform stops everyone else before your code and passes the member's signed assertion in the x-praxis-access-jwt header. Default host only. Needs the release flag app-organization-access for the organization, else UNSUPPORTED."
},
"example": "public"
}
}
}
}
}

响应

HTTP 200

Success

application/json

名称 类型 说明
success boolean Always true on success.
errors array<any> Always empty on success.
messages array<any> Always empty on success.
result object
result.id string Worker ID, prefixed wkr_.
result.name string Unique per account; lowercase letters, digits and single hyphens.
result.subdomain object Public address of the Worker.
result.tags array<string> Up to 8 tags.
result.observability object Observability settings.
result.logpush boolean Always false: unlike Cloudflare, Logpush is not offered.
result.created_on string When the Worker was created.
result.updated_on string When the Worker last changed.
result.deployed_on string | null When the current deployment became active; null before the first deployment.
result.praxis object Platform fields: lifecycle status, labels, and soft-delete timestamps.
result_info object Present on list responses.
result_info.page integer Page number.
result_info.per_page integer Page size.
result_info.count integer Items on this page.