# Data Localization Suite # Regions ## List DLS regions for an account `client.dls.regions.list(RegionListParamsparams, RequestOptionsoptions?): CursorPagination` **get** `/accounts/{account_id}/dls/regions` List the DLS regions (managed and custom) available to an account. ### Parameters - `params: RegionListParams` - `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 - `type?: "managed" | "custom"` Query param: Filter regions by type. Omit to return all regions. - `"managed"` - `"custom"` ### Returns - `RegionListResponse` - `id: string` - `created_on: string` - `modified_on: string` - `name: string` - `region_key: string` - `version: number` - `version_created_on: string` ### 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 regionListResponse of client.dls.regions.list({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', })) { console.log(regionListResponse.id); } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "error_chain": [ {} ] } ], "messages": [ { "code": 1000, "message": "message", "error_chain": [ {} ] } ], "result": [ { "id": "id", "created_on": "2019-12-27T18:11:19.117Z", "modified_on": "2019-12-27T18:11:19.117Z", "name": "name", "region_key": "x", "version": 0, "version_created_on": "2019-12-27T18:11:19.117Z" } ], "result_info": { "count": 0, "cursor": "cursor", "per_page": 0 }, "success": true } ``` ## Get a DLS region `client.dls.regions.get(stringregionID, RegionGetParamsparams, RequestOptionsoptions?): RegionGetResponse` **get** `/accounts/{account_id}/dls/regions/{region_id}` Retrieve a single DLS region (managed or custom) by ID or region key. ### Parameters - `regionID: string` UUID of the region (custom or managed) or region_key of a managed region. - `params: RegionGetParams` - `account_id: string` Identifier of a Cloudflare account. ### Returns - `RegionGetResponse` - `id: string` - `created_on: string` - `modified_on: string` - `name: string` - `region_key: string` - `version: number` - `version_created_on: string` ### 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 region = await client.dls.regions.get('a1b2c3d4-e5f6-7890-abcd-ef1234567890', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(region.id); ``` #### Response ```json { "messages": [ { "code": 1000, "message": "message", "error_chain": [ {} ] } ], "result": { "id": "id", "created_on": "2019-12-27T18:11:19.117Z", "modified_on": "2019-12-27T18:11:19.117Z", "name": "name", "region_key": "x", "version": 0, "version_created_on": "2019-12-27T18:11:19.117Z" }, "success": true, "errors": [ { "code": 1000, "message": "message", "error_chain": [ {} ] } ] } ``` ## Domain Types ### Region List Response - `RegionListResponse` - `id: string` - `created_on: string` - `modified_on: string` - `name: string` - `region_key: string` - `version: number` - `version_created_on: string` ### Region Get Response - `RegionGetResponse` - `id: string` - `created_on: string` - `modified_on: string` - `name: string` - `region_key: string` - `version: number` - `version_created_on: string` # 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.