Skip to content
Start here

Create Registration

client.RegistrarSandbox.Registrations.New(ctx, params) (*RegistrationNewResponse, error)
POST/accounts/{account_id}/registrar-sandbox/registrations

Starts a domain registration workflow.

Prerequisites

  • The account must not already be at the maximum supported domain limit. A single account may own up to 500 domains in total across registrations created through either the dashboard or this API.
  • The domain must be on a supported extension for programmatic registration.
  • Use POST /domain-check immediately before calling this endpoint to confirm real-time availability and pricing.

Defaults

  • years: defaults to the extension’s minimum registration period (1 year for most extensions, but varies — for example, .ai (if supported) requires a minimum of 2 years).
  • auto_renew: defaults to false. Setting it to true is an explicit opt-in authorizing Cloudflare to charge the account’s default payment method up to 30 days before domain expiry to renew the registration. Renewal pricing may change over time based on registry pricing.
  • privacy_mode: defaults to redaction.

Premium domains

Premium domain registration is not currently supported by this API. If POST /domain-check returns tier: premium, do not call this endpoint for that domain.

Response behavior

By default, the server holds the connection for a bounded, server-defined amount of time while the registration completes. Most registrations finish within this window and return 201 Created with a completed workflow status.

If the registration is still processing after this synchronous wait window, the server returns 202 Accepted. Poll the URL in links.self to track progress.

To skip the wait and receive an immediate 202, send Prefer: respond-async.

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 RegistrationNewParams
AccountID param.Field[string]

Path param: Identifier.

maxLength32
DomainName param.Field[string]

Body param: Provides a fully qualified domain name (FQDN), including the extension (e.g., example.com, mybrand.app). The domain name uniquely identifies a registration. Cloudflare permits only one registration per domain, making the domain name a natural idempotency key for registration requests.

Acknowledgements param.Field[map[string, unknown]]Optional

Body param: Provides user acknowledgements for a specific extension or premium registration flow. The extension registration schema from the extension discovery endpoint identifies the required keys.

AutoRenew param.Field[bool]Optional

Body param: Enable or disable automatic renewal. Defaults to false if omitted. Setting this field to true is an explicit opt-in authorizing Cloudflare to charge the account’s default payment method up to 30 days before domain expiry to renew the domain automatically. Renewal pricing may change over time based on registry pricing.

ContactExtensions param.Field[map[string, unknown]]Optional

Body param: Provides registry-specific contact extension values for the registrant. GET /accounts/{account_id}/registrar/extensions/{extension} identifies the required keys and allowed values for each extension in the registration_schema.properties.contact_extensions object.

Examples include .us nexus fields, .uk registrant type fields, and .ca legal type fields. Omit this object when the extension’s registration schema excludes contact_extensions.

Contacts param.Field[RegistrationNewParamsContacts]Optional

Body param: Provides contact data for the registration request.

The per-extension schema from GET /accounts/{account_id}/registrar/extensions/{extension} defines the accepted contact roles. Every currently supported extension requires only contacts.registrant from API callers. Callers may provide additional roles such as technical, administrator, and billing when the extension schema includes them. When a registry requires an omitted role, Cloudflare may derive that contact from contacts.registrant.

When the request omits either the entire contacts object or contacts.registrant, the system uses the account’s default address book entry as the registrant contact. The account owner must configure this default at https://dash.cloudflare.com/{account_id}/domains/registrations, where they can create or update the address book entry and accept the required agreement. Dashboard settings currently provide the only way to manage address book entries.

Without either a default address book entry or a registrant contact, the registration request fails validation.

Administrator RegistrationNewParamsContactsAdministratorOptional

Optional administrator contact. Accepted only when the extension schema includes this role. When the registry requires an omitted contact, Cloudflare may derive it from contacts.registrant.

Email string

Email address for the registrant. Used for domain-related communications from the registry, including ownership verification and renewal notices.

formatemail
Phone string

Phone number in E.164 format: +{country_code}.{number} without spaces or dashes. Examples: +1.5555555555 (US), +44.2071234567 (UK), +81.312345678 (Japan).

PostalInfo RegistrationNewParamsContactsAdministratorPostalInfo

Postal/mailing information for the contact. The name field is the complete contact name in one string. Some registries require a complete personal name, including a family or last name where applicable, but this API does not accept separate first-name and last-name fields for registration contacts.

Address RegistrationNewParamsContactsAdministratorPostalInfoAddress

Physical mailing address for the registrant contact.

City string

City or locality name.

CountryCode string

Two-letter country code per ISO 3166-1 alpha-2 (e.g., US, GB, CA, DE).

PostalCode string

Postal or ZIP code.

State string

State, province, or region. Use the standard abbreviation where applicable (e.g., TX for Texas, ON for Ontario).

Street string

Street address including building/suite number.

Name string

Full legal name of the contact, including all required name components for an individual or authorized representative. Some registries require a complete personal name that includes a family or last name where applicable. Provide the complete name in this single field, for example Ada Lovelace; do not send separate first-name or last-name fields.

Organization stringOptional

Organization or company name. Optional for individual registrants.

Fax stringOptional

Fax number in E.164 format (e.g., +1.5555555555). Optional. Most registrations do not require a fax number.

Billing RegistrationNewParamsContactsBillingOptional

Optional billing contact. Accepted only when the extension schema includes this role. When the registry requires an omitted contact, Cloudflare may derive it from contacts.registrant.

Email string

Email address for the registrant. Used for domain-related communications from the registry, including ownership verification and renewal notices.

formatemail
Phone string

Phone number in E.164 format: +{country_code}.{number} without spaces or dashes. Examples: +1.5555555555 (US), +44.2071234567 (UK), +81.312345678 (Japan).

PostalInfo RegistrationNewParamsContactsBillingPostalInfo

Postal/mailing information for the contact. The name field is the complete contact name in one string. Some registries require a complete personal name, including a family or last name where applicable, but this API does not accept separate first-name and last-name fields for registration contacts.

Address RegistrationNewParamsContactsBillingPostalInfoAddress

Physical mailing address for the registrant contact.

City string

City or locality name.

CountryCode string

Two-letter country code per ISO 3166-1 alpha-2 (e.g., US, GB, CA, DE).

PostalCode string

Postal or ZIP code.

State string

State, province, or region. Use the standard abbreviation where applicable (e.g., TX for Texas, ON for Ontario).

Street string

Street address including building/suite number.

Name string

Full legal name of the contact, including all required name components for an individual or authorized representative. Some registries require a complete personal name that includes a family or last name where applicable. Provide the complete name in this single field, for example Ada Lovelace; do not send separate first-name or last-name fields.

Organization stringOptional

Organization or company name. Optional for individual registrants.

Fax stringOptional

Fax number in E.164 format (e.g., +1.5555555555). Optional. Most registrations do not require a fax number.

Registrant RegistrationNewParamsContactsRegistrantOptional

Optional registrant contact. If omitted, the account’s default address book entry is used instead.

Email string

Email address for the registrant. Used for domain-related communications from the registry, including ownership verification and renewal notices.

formatemail
Phone string

Phone number in E.164 format: +{country_code}.{number} without spaces or dashes. Examples: +1.5555555555 (US), +44.2071234567 (UK), +81.312345678 (Japan).

PostalInfo RegistrationNewParamsContactsRegistrantPostalInfo

Postal/mailing information for the contact. The name field is the complete contact name in one string. Some registries require a complete personal name, including a family or last name where applicable, but this API does not accept separate first-name and last-name fields for registration contacts.

Address RegistrationNewParamsContactsRegistrantPostalInfoAddress

Physical mailing address for the registrant contact.

City string

City or locality name.

CountryCode string

Two-letter country code per ISO 3166-1 alpha-2 (e.g., US, GB, CA, DE).

PostalCode string

Postal or ZIP code.

State string

State, province, or region. Use the standard abbreviation where applicable (e.g., TX for Texas, ON for Ontario).

Street string

Street address including building/suite number.

Name string

Full legal name of the contact, including all required name components for an individual or authorized representative. Some registries require a complete personal name that includes a family or last name where applicable. Provide the complete name in this single field, for example Ada Lovelace; do not send separate first-name or last-name fields.

Organization stringOptional

Organization or company name. Optional for individual registrants.

Fax stringOptional

Fax number in E.164 format (e.g., +1.5555555555). Optional. Most registrations do not require a fax number.

Technical RegistrationNewParamsContactsTechnicalOptional

Optional technical contact. Accepted only when the extension schema includes this role. When the registry requires an omitted contact, Cloudflare may derive it from contacts.registrant.

Email string

Email address for the registrant. Used for domain-related communications from the registry, including ownership verification and renewal notices.

formatemail
Phone string

Phone number in E.164 format: +{country_code}.{number} without spaces or dashes. Examples: +1.5555555555 (US), +44.2071234567 (UK), +81.312345678 (Japan).

PostalInfo RegistrationNewParamsContactsTechnicalPostalInfo

Postal/mailing information for the contact. The name field is the complete contact name in one string. Some registries require a complete personal name, including a family or last name where applicable, but this API does not accept separate first-name and last-name fields for registration contacts.

Address RegistrationNewParamsContactsTechnicalPostalInfoAddress

Physical mailing address for the registrant contact.

City string

City or locality name.

CountryCode string

Two-letter country code per ISO 3166-1 alpha-2 (e.g., US, GB, CA, DE).

PostalCode string

Postal or ZIP code.

State string

State, province, or region. Use the standard abbreviation where applicable (e.g., TX for Texas, ON for Ontario).

Street string

Street address including building/suite number.

Name string

Full legal name of the contact, including all required name components for an individual or authorized representative. Some registries require a complete personal name that includes a family or last name where applicable. Provide the complete name in this single field, for example Ada Lovelace; do not send separate first-name or last-name fields.

Organization stringOptional

Organization or company name. Optional for individual registrants.

Fax stringOptional

Fax number in E.164 format (e.g., +1.5555555555). Optional. Most registrations do not require a fax number.

PrivacyMode param.Field[RegistrationNewParamsPrivacyMode]Optional

Body param: Sets the WHOIS privacy mode for the registration. Defaults to redaction.

  • off: Disables WHOIS privacy.
  • redaction: Requests WHOIS redaction where the extension supports it. Some extensions exclude privacy and redaction.
const RegistrationNewParamsPrivacyModeOff RegistrationNewParamsPrivacyMode = "off"
const RegistrationNewParamsPrivacyModeRedaction RegistrationNewParamsPrivacyMode = "redaction"
Years param.Field[int64]Optional

Body param: Sets the registration term from 1 to 10 years. When omitted, this field defaults to the registry’s minimum registration period for the extension. Most extensions require 1 year, while some require longer minimum terms (e.g., .ai requires 2 years).

Each registry may also enforce its own maximum registration term. A request above that maximum fails. When uncertain, omit this field to use the default.

maximum10
minimum1
Prefer param.Field[string]Optional

Header param: Set to respond-async to receive an immediate 202 Accepted without waiting for the operation to complete (RFC 7240).

The header may be combined with other preferences using standard comma-separated syntax.

ReturnsExpand Collapse
type RegistrationNewResponse struct{…}

Status of an async registration workflow.

Completed bool

Indicates whether the workflow reached a terminal state. A succeeded or failed state returns true; pending, in_progress, action_required, and blocked return false.

CreatedAt Time
formatdate-time
State RegistrationNewResponseState

Describes the workflow lifecycle state.

  • pending: The workflow awaits processing.
  • in_progress: Processing started. Continue polling links.self. An internal deadline limits the duration of this state.
  • action_required: The workflow pauses for user action. See context.action for details. Stop automated polling until the user completes the required action.
  • blocked: A third party, such as the domain extension’s registry or a losing registrar, prevents progress. Continue polling because the block may resolve when the third party responds.
  • succeeded: Terminal state. The operation completed successfully. completed equals true. For registrations, context.registration contains the resulting registration resource.
  • failed: Terminal state. The operation failed. completed equals true. See error.code and error.message for the reason. Require user review before retrying.
One of the following:
const RegistrationNewResponseStatePending RegistrationNewResponseState = "pending"
const RegistrationNewResponseStateInProgress RegistrationNewResponseState = "in_progress"
const RegistrationNewResponseStateActionRequired RegistrationNewResponseState = "action_required"
const RegistrationNewResponseStateBlocked RegistrationNewResponseState = "blocked"
const RegistrationNewResponseStateSucceeded RegistrationNewResponseState = "succeeded"
const RegistrationNewResponseStateFailed RegistrationNewResponseState = "failed"
UpdatedAt Time
formatdate-time
Context map[string, unknown]Optional

Provides workflow-specific data.

For domain-centric workflows, context.domain_name identifies the workflow subject.

Error RegistrationNewResponseErrorOptional

Provides error details when a workflow reaches the failed state. The workflow type (registration, update, etc.) and underlying registry response determine the specific codes and messages. Workflow error codes differ from immediate HTTP error errors[].code values in non-2xx responses. Surface error.message to the user for context.

Code string

Machine-readable error code identifying the failure reason.

Message string

Human-readable explanation of the failure. May include registry-specific details.

Create Registration

package main

import (
  "context"
  "fmt"

  "github.com/cloudflare/cloudflare-go"
  "github.com/cloudflare/cloudflare-go/option"
  "github.com/cloudflare/cloudflare-go/registrar_sandbox"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  registration, err := client.RegistrarSandbox.Registrations.New(context.TODO(), registrar_sandbox.RegistrationNewParams{
    AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
    DomainName: cloudflare.F("my-brand-example.io"),
    Contacts: cloudflare.F(registrar_sandbox.RegistrationNewParamsContacts{
      Administrator: cloudflare.F(registrar_sandbox.RegistrationNewParamsContactsAdministrator{
        Email: cloudflare.F("katherine@example.io"),
        Phone: cloudflare.F("+1.5555550102"),
        PostalInfo: cloudflare.F(registrar_sandbox.RegistrationNewParamsContactsAdministratorPostalInfo{
          Address: cloudflare.F(registrar_sandbox.RegistrationNewParamsContactsAdministratorPostalInfoAddress{
            City: cloudflare.F("San Francisco"),
            CountryCode: cloudflare.F("US"),
            PostalCode: cloudflare.F("94103"),
            State: cloudflare.F("CA"),
            Street: cloudflare.F("789 Mission St"),
          }),
          Name: cloudflare.F("Katherine Johnson"),
          Organization: cloudflare.F("Example Admin Inc"),
        }),
      }),
      Billing: cloudflare.F(registrar_sandbox.RegistrationNewParamsContactsBilling{
        Email: cloudflare.F("dorothy@example.io"),
        Phone: cloudflare.F("+1.5555550103"),
        PostalInfo: cloudflare.F(registrar_sandbox.RegistrationNewParamsContactsBillingPostalInfo{
          Address: cloudflare.F(registrar_sandbox.RegistrationNewParamsContactsBillingPostalInfoAddress{
            City: cloudflare.F("San Francisco"),
            CountryCode: cloudflare.F("US"),
            PostalCode: cloudflare.F("94105"),
            State: cloudflare.F("CA"),
            Street: cloudflare.F("101 Howard St"),
          }),
          Name: cloudflare.F("Dorothy Vaughan"),
          Organization: cloudflare.F("Example Billing Inc"),
        }),
      }),
      Registrant: cloudflare.F(registrar_sandbox.RegistrationNewParamsContactsRegistrant{
        Email: cloudflare.F("ada@example.io"),
        Phone: cloudflare.F("+1.5555555555"),
        PostalInfo: cloudflare.F(registrar_sandbox.RegistrationNewParamsContactsRegistrantPostalInfo{
          Address: cloudflare.F(registrar_sandbox.RegistrationNewParamsContactsRegistrantPostalInfoAddress{
            City: cloudflare.F("Austin"),
            CountryCode: cloudflare.F("US"),
            PostalCode: cloudflare.F("78701"),
            State: cloudflare.F("TX"),
            Street: cloudflare.F("123 Main St"),
          }),
          Name: cloudflare.F("Ada Lovelace"),
          Organization: cloudflare.F("Example Inc"),
        }),
      }),
      Technical: cloudflare.F(registrar_sandbox.RegistrationNewParamsContactsTechnical{
        Email: cloudflare.F("grace@example.io"),
        Phone: cloudflare.F("+1.5555550101"),
        PostalInfo: cloudflare.F(registrar_sandbox.RegistrationNewParamsContactsTechnicalPostalInfo{
          Address: cloudflare.F(registrar_sandbox.RegistrationNewParamsContactsTechnicalPostalInfoAddress{
            City: cloudflare.F("San Francisco"),
            CountryCode: cloudflare.F("US"),
            PostalCode: cloudflare.F("94105"),
            State: cloudflare.F("CA"),
            Street: cloudflare.F("456 Market St"),
          }),
          Name: cloudflare.F("Grace Hopper"),
          Organization: cloudflare.F("Example Technical Inc"),
        }),
      }),
    }),
    Years: cloudflare.F(int64(1)),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", registration.Completed)
}
{
  "errors": [],
  "messages": [],
  "result": {
    "completed": true,
    "context": {
      "domain_name": "example.com",
      "registration": {
        "auto_renew": true,
        "created_at": "2025-10-27T10:00:00Z",
        "domain_name": "example.com",
        "expires_at": "2026-10-27T10:00:00Z",
        "locked": true,
        "privacy_mode": "redaction",
        "status": "active"
      }
    },
    "created_at": "2025-10-27T10:00:00Z",
    "links": {
      "resource": "/accounts/abc/registrar/registrations/example.com",
      "self": "/accounts/abc/registrar/registrations/example.com/registration-status"
    },
    "state": "succeeded",
    "updated_at": "2025-10-27T10:00:03Z"
  },
  "success": true
}
{
  "errors": [],
  "messages": [],
  "result": {
    "completed": false,
    "context": {
      "domain_name": "example.com"
    },
    "created_at": "2025-10-27T10:00:00Z",
    "links": {
      "resource": "/accounts/abc/registrar/registrations/example.com",
      "self": "/accounts/abc/registrar/registrations/example.com/registration-status"
    },
    "state": "in_progress",
    "updated_at": "2025-10-27T10:00:10Z"
  },
  "success": true
}
{
  "errors": [
    {
      "code": 10000,
      "message": "Domain limit reached: you cannot register more than 500 domains.",
      "source": {
        "pointer": "/domain_name"
      }
    }
  ],
  "messages": [],
  "result": null,
  "success": false
}
{
  "errors": [
    {
      "code": 10000,
      "message": "domain_name is required",
      "source": {
        "pointer": "/domain_name"
      }
    }
  ],
  "messages": [],
  "result": null,
  "success": false
}
{
  "errors": [
    {
      "code": 10000,
      "message": "Must be a boolean",
      "source": {
        "pointer": "/auto_renew"
      }
    }
  ],
  "messages": [],
  "result": null,
  "success": false
}
{
  "errors": [
    {
      "code": 10000,
      "message": "No registrant contact provided and no default address book entry found for this account."
    }
  ],
  "messages": [],
  "result": null,
  "success": false
}
{
  "errors": [
    {
      "code": 10000,
      "message": "Registration is not supported for this extension"
    }
  ],
  "messages": [],
  "result": null,
  "success": false
}
Returns Examples
{
  "errors": [],
  "messages": [],
  "result": {
    "completed": true,
    "context": {
      "domain_name": "example.com",
      "registration": {
        "auto_renew": true,
        "created_at": "2025-10-27T10:00:00Z",
        "domain_name": "example.com",
        "expires_at": "2026-10-27T10:00:00Z",
        "locked": true,
        "privacy_mode": "redaction",
        "status": "active"
      }
    },
    "created_at": "2025-10-27T10:00:00Z",
    "links": {
      "resource": "/accounts/abc/registrar/registrations/example.com",
      "self": "/accounts/abc/registrar/registrations/example.com/registration-status"
    },
    "state": "succeeded",
    "updated_at": "2025-10-27T10:00:03Z"
  },
  "success": true
}
{
  "errors": [],
  "messages": [],
  "result": {
    "completed": false,
    "context": {
      "domain_name": "example.com"
    },
    "created_at": "2025-10-27T10:00:00Z",
    "links": {
      "resource": "/accounts/abc/registrar/registrations/example.com",
      "self": "/accounts/abc/registrar/registrations/example.com/registration-status"
    },
    "state": "in_progress",
    "updated_at": "2025-10-27T10:00:10Z"
  },
  "success": true
}
{
  "errors": [
    {
      "code": 10000,
      "message": "Domain limit reached: you cannot register more than 500 domains.",
      "source": {
        "pointer": "/domain_name"
      }
    }
  ],
  "messages": [],
  "result": null,
  "success": false
}
{
  "errors": [
    {
      "code": 10000,
      "message": "domain_name is required",
      "source": {
        "pointer": "/domain_name"
      }
    }
  ],
  "messages": [],
  "result": null,
  "success": false
}
{
  "errors": [
    {
      "code": 10000,
      "message": "Must be a boolean",
      "source": {
        "pointer": "/auto_renew"
      }
    }
  ],
  "messages": [],
  "result": null,
  "success": false
}
{
  "errors": [
    {
      "code": 10000,
      "message": "No registrant contact provided and no default address book entry found for this account."
    }
  ],
  "messages": [],
  "result": null,
  "success": false
}
{
  "errors": [
    {
      "code": 10000,
      "message": "Registration is not supported for this extension"
    }
  ],
  "messages": [],
  "result": null,
  "success": false
}