# Regional Services # Prefix Bindings ## List DLS prefix bindings for an account `client.dls.regionalServices.prefixBindings.list(PrefixBindingListParamsparams, RequestOptionsoptions?): CursorPagination` **get** `/accounts/{account_id}/dls/regional_services/prefix_bindings` List the BYOIP prefix bindings configured for an account. ### Parameters - `params: PrefixBindingListParams` - `account_id: string` Path param: Identifier of a Cloudflare account. - `cursor?: string` Query param: Opaque token for cursor-based pagination. Omit for the first page. Pass the value from a previous response to fetch the next page. - `per_page?: number` Query param ### Returns - `PrefixBindingListResponse` - `id: string` The ID of the binding. - `cidr: string` The CIDR that is bound. - `prefix_id: string` The ID of the parent prefix. - `region_key: string` The region key used for the binding. ### Example ```typescript 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 prefixBindingListResponse of client.dls.regionalServices.prefixBindings.list({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', })) { console.log(prefixBindingListResponse.id); } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "error_chain": [ {} ] } ], "messages": [ { "code": 1000, "message": "message", "error_chain": [ {} ] } ], "result": [ { "id": "id", "cidr": "cidr", "prefix_id": "prefix_id", "region_key": "x" } ], "result_info": { "count": 0, "cursor": "cursor", "per_page": 0 }, "success": true } ``` ## Get a DLS prefix binding `client.dls.regionalServices.prefixBindings.get(stringbindingID, PrefixBindingGetParamsparams, RequestOptionsoptions?): PrefixBindingGetResponse` **get** `/accounts/{account_id}/dls/regional_services/prefix_bindings/{binding_id}` Retrieve a single BYOIP prefix binding by ID. ### Parameters - `bindingID: string` Unique identifier for the prefix binding. - `params: PrefixBindingGetParams` - `account_id: string` Identifier of a Cloudflare account. ### Returns - `PrefixBindingGetResponse` - `id: string` The ID of the binding. - `cidr: string` The CIDR that is bound. - `prefix_id: string` The ID of the parent prefix. - `region_key: string` The region key used for the binding. ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const prefixBinding = await client.dls.regionalServices.prefixBindings.get( 'a1b2c3d4-e5f6-7890-abcd-ef1234567890', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, ); console.log(prefixBinding.id); ``` #### Response ```json { "messages": [ { "code": 1000, "message": "message", "error_chain": [ {} ] } ], "result": { "id": "id", "cidr": "cidr", "prefix_id": "prefix_id", "region_key": "x" }, "success": true, "errors": [ { "code": 1000, "message": "message", "error_chain": [ {} ] } ] } ``` ## Create a DLS prefix binding `client.dls.regionalServices.prefixBindings.create(PrefixBindingCreateParamsparams, RequestOptionsoptions?): PrefixBindingCreateResponse` **post** `/accounts/{account_id}/dls/regional_services/prefix_bindings` Bind a CIDR from a BYOIP prefix to a region. This requires the **IP Prefixes Write** permission in addition to **DLS Write**, because the binding is created against a BYOIP prefix in Addressing. ### Parameters - `params: PrefixBindingCreateParams` - `account_id: string` Path param: Identifier of a Cloudflare account. - `cidr: string` Body param: IP prefix in CIDR notation to bind. - `prefix_id: string` Body param: The ID of the parent IP prefix that contains the CIDR. - `region_key: string` Body param: Region key from managed regions (e.g., "us", "eu"). ### Returns - `PrefixBindingCreateResponse` - `id: string` The ID of the binding. - `cidr: string` The CIDR that is bound. - `prefix_id: string` The ID of the parent prefix. - `region_key: string` The region key used for the binding. ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const prefixBinding = await client.dls.regionalServices.prefixBindings.create({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', cidr: '10.0.1.0/24', prefix_id: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890', region_key: 'eu', }); console.log(prefixBinding.id); ``` #### Response ```json { "messages": [ { "code": 1000, "message": "message", "error_chain": [ {} ] } ], "result": { "id": "id", "cidr": "cidr", "prefix_id": "prefix_id", "region_key": "x" }, "success": true, "errors": [ { "code": 1000, "message": "message", "error_chain": [ {} ] } ] } ``` ## Update a DLS prefix binding `client.dls.regionalServices.prefixBindings.edit(stringbindingID, PrefixBindingEditParamsparams, RequestOptionsoptions?): PrefixBindingEditResponse` **patch** `/accounts/{account_id}/dls/regional_services/prefix_bindings/{binding_id}` Update the region of an existing BYOIP prefix binding. Like creating a binding, this requires **IP Prefixes Write** in addition to **DLS Write**. ### Parameters - `bindingID: string` Unique identifier for the prefix binding. - `params: PrefixBindingEditParams` - `account_id: string` Path param: Identifier of a Cloudflare account. - `region_key: string` Body param: New region key to assign (e.g., "us", "eu", "cfcanary"). ### Returns - `PrefixBindingEditResponse` - `id: string` The ID of the binding. - `cidr: string` The CIDR that is bound. - `prefix_id: string` The ID of the parent prefix. - `region_key: string` The region key used for the binding. ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const response = await client.dls.regionalServices.prefixBindings.edit( 'a1b2c3d4-e5f6-7890-abcd-ef1234567890', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', region_key: 'eu' }, ); console.log(response.id); ``` #### Response ```json { "messages": [ { "code": 1000, "message": "message", "error_chain": [ {} ] } ], "result": { "id": "id", "cidr": "cidr", "prefix_id": "prefix_id", "region_key": "x" }, "success": true, "errors": [ { "code": 1000, "message": "message", "error_chain": [ {} ] } ] } ``` ## Delete a DLS prefix binding `client.dls.regionalServices.prefixBindings.delete(stringbindingID, PrefixBindingDeleteParamsparams, RequestOptionsoptions?): PrefixBindingDeleteResponse` **delete** `/accounts/{account_id}/dls/regional_services/prefix_bindings/{binding_id}` Delete a BYOIP prefix binding. Like creating a binding, this requires **IP Prefixes Write** in addition to **DLS Write**. ### Parameters - `bindingID: string` Unique identifier for the prefix binding. - `params: PrefixBindingDeleteParams` - `account_id: string` Identifier of a Cloudflare account. ### Returns - `PrefixBindingDeleteResponse` - `messages: Array` - `code: number` - `message: string` - `error_chain?: Array` Optional upstream error context for APIv4 errors that wrap downstream service failures. - `success: boolean` - `errors?: Array` - `code: number` - `message: string` - `error_chain?: Array` Optional upstream error context for APIv4 errors that wrap downstream service failures. ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const prefixBinding = await client.dls.regionalServices.prefixBindings.delete( 'a1b2c3d4-e5f6-7890-abcd-ef1234567890', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, ); console.log(prefixBinding.messages); ``` #### Response ```json { "messages": [ { "code": 1000, "message": "message", "error_chain": [ {} ] } ], "success": true, "errors": [ { "code": 1000, "message": "message", "error_chain": [ {} ] } ] } ``` ## Domain Types ### Prefix Binding List Response - `PrefixBindingListResponse` - `id: string` The ID of the binding. - `cidr: string` The CIDR that is bound. - `prefix_id: string` The ID of the parent prefix. - `region_key: string` The region key used for the binding. ### Prefix Binding Get Response - `PrefixBindingGetResponse` - `id: string` The ID of the binding. - `cidr: string` The CIDR that is bound. - `prefix_id: string` The ID of the parent prefix. - `region_key: string` The region key used for the binding. ### Prefix Binding Create Response - `PrefixBindingCreateResponse` - `id: string` The ID of the binding. - `cidr: string` The CIDR that is bound. - `prefix_id: string` The ID of the parent prefix. - `region_key: string` The region key used for the binding. ### Prefix Binding Edit Response - `PrefixBindingEditResponse` - `id: string` The ID of the binding. - `cidr: string` The CIDR that is bound. - `prefix_id: string` The ID of the parent prefix. - `region_key: string` The region key used for the binding. ### Prefix Binding Delete Response - `PrefixBindingDeleteResponse` - `messages: Array` - `code: number` - `message: string` - `error_chain?: Array` Optional upstream error context for APIv4 errors that wrap downstream service failures. - `success: boolean` - `errors?: Array` - `code: number` - `message: string` - `error_chain?: Array` Optional upstream error context for APIv4 errors that wrap downstream service failures.