Skip to content
Start here

Create a DLS prefix binding

client.DLS.RegionalServices.PrefixBindings.New(ctx, params) (*RegionalServicePrefixBindingNewResponse, error)
POST/accounts/{account_id}/dls/regional_services/prefix_bindings

Create a DLS prefix binding

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
ParametersExpand Collapse
params RegionalServicePrefixBindingNewParams
AccountID param.Field[string]

Path param: Identifier of a Cloudflare account.

maxLength32
minLength32
CIDR param.Field[string]

Body param: IP prefix in CIDR notation to bind.

PrefixID param.Field[string]

Body param: The ID of the parent IP prefix that contains the CIDR.

maxLength64
RegionKey param.Field[string]

Body param: Region key from managed regions (e.g., “us”, “eu”).

maxLength128
minLength1
ReturnsExpand Collapse
type RegionalServicePrefixBindingNewResponse struct{…}
ID string

The ID of the binding.

CIDR string

The CIDR that is bound.

PrefixID string

The ID of the parent prefix.

RegionKey string

The region key used for the binding.

maxLength128
minLength1

Create a DLS prefix binding

package main

import (
  "context"
  "fmt"

  "github.com/stainless-sdks/cloudflare-go"
  "github.com/stainless-sdks/cloudflare-go/dls"
  "github.com/stainless-sdks/cloudflare-go/option"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  prefixBinding, err := client.DLS.RegionalServices.PrefixBindings.New(context.TODO(), dls.RegionalServicePrefixBindingNewParams{
    AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
    CIDR: cloudflare.F("10.0.1.0/24"),
    PrefixID: cloudflare.F("a1b2c3d4-e5f6-7890-abcd-ef1234567890"),
    RegionKey: cloudflare.F("eu"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", prefixBinding.ID)
}
{
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": {
    "id": "id",
    "cidr": "cidr",
    "prefix_id": "prefix_id",
    "region_key": "x"
  },
  "success": true,
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ]
}
Returns Examples
{
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": {
    "id": "id",
    "cidr": "cidr",
    "prefix_id": "prefix_id",
    "region_key": "x"
  },
  "success": true,
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ]
}