WorkerWorker Domain

Attach to Domain

PUT
Attaches a Worker to a zone and hostname.

Path parameters

account_identifierstringRequired

Request

This endpoint expects an object.
environment
stringRequired
Worker environment associated with the zone and hostname.
hostname
stringRequired
Hostname of the Worker Domain.
service
stringRequired
Worker service associated with the zone and hostname.
zone_id
stringRequired
Identifier of the zone.

Response

This endpoint returns an object
errors
list of objects
messages
list of objects
success
boolean
Whether the API call was successful
result
objectOptional
PUT
1curl -X PUT https://api.cloudflare.com/client/v4/accounts/9a7806061c88ada191ed06f989cc3dac/workers/domains \
2 -H "Authorization: Bearer <token>" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "environment": "production",
6 "hostname": "foo.example.com",
7 "service": "foo",
8 "zone_id": "593c9c94de529bbbfaac7c53ced0447d"
9}'
200Updated
1{
2 "errors": [
3 {
4 "code": 1,
5 "message": "string"
6 }
7 ],
8 "messages": [
9 {
10 "code": 1,
11 "message": "string"
12 }
13 ],
14 "success": true,
15 "result": {
16 "environment": "production",
17 "hostname": "foo.example.com",
18 "id": "dbe10b4bc17c295377eabd600e1787fd",
19 "service": "foo",
20 "zone_id": "593c9c94de529bbbfaac7c53ced0447d",
21 "zone_name": "example.com"
22 }
23}