Template API

https://api.gandi.net/v5/template

Gandi Configuration Template Management API

Introduction

This section of the documentation will guide you through the api routes that you can use to create, manage, and apply configuration templates.

A template is a set of specific settings that you can apply to one of your domains at any time. You can think of a template as a recipe or script that will perform a serie of operations when you apply it to a given domain.

General information on Gandi's configuration templates can be found in our public documentation at:
https://docs.gandi.net/en/domain_names/advanced_users/configuration_templates.html

Dispatch

https://api.gandi.net/v5/template/dispatch/{id}

get Dispatch information

This route returns the current state of a template dispatch. It provides the payload as it was given to the dispatch, the state, and the history of each operation.

The current state of the dispatch is indicated by two values:

  • state is the global state and it usually keeps a value of 0 unless the whole operation failed before being executed.
  • each task_status.*.status value returns the given namespace status. They are the values you'll be looking for to determine if the dispatch is finished.

The state values take 4 possible values:

  • 0: pending (dispatch or task)
  • 10: running
  • 20: done
  • 30: error

A dispatch is not running any longer when one of these conditions are met:

  • state >= 20
  • every task_status.*.status >= 20

Request

URI Parameters
    • idstring
      Dispatch ID.
Headers
  • Required
    • Authorizationstring
      The Authorization header must start with Bearer for access token, or Apikey depending of the authentication scheme. Apikey is deprecated and be replaced by personal access token.
      Example: Bearer pat_abc-123
      Example: Apikey your-api-key

Responses

200

Body
  • application/json
    object

    With the following properties:

    • attemptinteger
      Current number of attempts at performing the tasks.
    • created_atstring
    • idstring
    • payloadobject
      The template payload as it was when it was applied. This is the only source of data for a dispatch which means that when you change a template's payload it will never affect the related running dispatches.

      With the following properties:

      Optional
      • dns:recordsobject

        This namespace defines the DNS records that will be set on a domain. It is only usefull when the domain is using LiveDNS. Even though it is not required, it's best to combine it with the domain:namservers namespace and set its service to livedns.

        Both properties default and record are mutually exclusive and you must set one and one only.

        With the following properties:

        Optional
        • defaultboolean

          Default: false

          When set to true, use Gandi's default DNS records.
        • recordsarray

          Of items of type:

          • object

            With the following properties:

            • namestring

              Pattern: ^(?:(?!-)[-_*@a-zA-Z0-9]{1,63}(?<!-)(\.|$))*(?<!\.)$

              The name of the record.
            • typestring

              One of: "A", "AAAA", "ALIAS", "CAA", "CDS", "CNAME", "DNAME", "DS", "KEY", "LOC", "MX", "NAPTR", "NS", "OPENPGPKEY", "PTR", "RP", "SPF", "SRV", "SSHFP", "TLSA", "TXT", "WKS"

              The type of the record.
            • valuesarray[ string ]
              A list of values for this record.
            Optional
            • ttlinteger

              Minimum: 300

              Maximum: 2592000

              The time in seconds that DNS resolvers should cache this record.
      • domain:mailboxesobject
        This namespace defines, at most, 2 mailboxes that will be added to the domain if they don't already exist.

        With the following properties:

        • valuesarray

          Maximum items: 2

          Of items of type:

          • object

            With the following properties:

            • loginstring
              The mailbox login.
      • domain:nameserversobject
        This namespace defines the nameservers that must be set on a domain.

        With the following properties:

        • addressesarray[ string ]
          List of nameserver hosts. Leave it empty when you set the service to livedns.
        • servicestring

          One of: "custom", "livedns"

          Type of nameserver service to use. livedns will automatically configure your name servers to Gandi's LiveDNS nameservers. custom lets you specify your own nameservers.
      • domain:webredirsobject
        This namespace defines web redirection to add to the a domain.

        With the following properties:

        • valuesarray

          Of items of type:

          • object

            With the following properties:

            • typestring

              One of: "cloak", "http301", "http302"

              Type of redirection.
            • urlstring
              Target URL.
            Optional
            • hoststring
              Source hostname (including the domain name)
            • overrideboolean

              Default: false

              When you create a redirection on a domain, a DNS record is created if it does not exist. When the record already exists and this parameter is set to true it will overwrite the record. Otherwise it will trigger an error.
            • protocolstring

              One of: "http", "https", "httpsonly"

              Redirection protocol.
    • sharing_idstring
      This ID of the user who applied the template.
    • stateinteger

      One of: 0, 10, 20, 30

    • targetobject
      Information about the target object.

      With the following properties:

      • namestring
      • typestring
    • target_idstring
    • task_historyarray

      Of items of type:

      • object

        With the following properties:

        • datestring
        • messagestring
        • namespacestring
        • statusinteger

          One of: 0, 10, 20, 30

    • task_statusobject
      Each entry is an object containing the task's status.
    Optional
    • state_msgstring
      A message when the whole dispatch triggered an error.
    • task_updated_atstring
    • template_idstring
      The ID of the template that was applied.
    • template_namestring
      The name of the template that was applied.
    Example:
    {
      "sharing_id": "fe0b931c-18c5-11e9-b9b5-00163ec4cb00",
      "payload": {
        "domain:nameservers": {
          "addresses": [],
          "service": "livedns"
        },
        "dns:records": {
          "default": true
        }
      },
      "id": "0f7326c2-0264-11eb-b47b-00163e7504b8",
      "state": 0,
      "target_id": "ba1167be-2f76-11e9-9dfb-00163ec4cb00",
      "template_id": "881f8c9a-fe7d-11ea-b2fe-00163e7504b8",
      "task_history": [
        {
          "namespace": "dns:records",
          "date": "2020-09-29T14:57:47Z",
          "message": "",
          "status": 20
        },
        {
          "namespace": "domain:nameservers",
          "date": "2020-09-29T14:58:48Z",
          "message": "",
          "status": 20
        }
      ],
      "target": {
        "type": "domain",
        "name": "domain-api-test1.net"
      },
      "attempt": 1,
      "task_status": {
        "domain:nameservers": {
          "status": 20
        },
        "dns:records": {
          "status": 20
        }
      },
      "template_name": "test",
      "state_msg": "",
      "created_at": "2020-09-29T14:57:14Z",
      "task_updated_at": "2020-09-29T14:58:48Z"
    }

403

Access to the resource is denied. Mainly due to a lack of permissions to access it.
Body
  • application/json
    object

    With the following properties:

    • causestring
    • codeinteger
    • messagestring
    • objectstring

401

Bad authentication attempt because of a wrong API Key.
Body
  • application/json
    object

    With the following properties:

    • causestring
    • codeinteger
    • messagestring
    • objectstring

403

In case the bearer token has expired, does not have enought permission or does not exists.
Body
  • application/json
    object

    With the following properties:

    • causestring
    • codeinteger
    • messagestring
    • objectstring

Secured by

Http Authorization Scheme

This authentication scheme allows you to pass your Personal Access Token and be granted access to permissions and resources scoped by this token.

Tokens are created in the Organization Tab of the Gandi Admin application, choose the organization the token will have access too. Then go to the sharing tab, and click on "Create a token" button.

The authentication scheme Apikey allows also you to pass your Gandi API Key, but has been deprecated.

Headers
  • Required
    • Authorizationstring
      The Authorization header must start with Bearer for access token, or Apikey depending of the authentication scheme. Apikey is deprecated and be replaced by personal access token.
      Example: Bearer pat_abc-123
      Example: Apikey your-api-key

Templates

https://api.gandi.net/v5/template/templates

get List of templates

This route returns a list of templates that can be used, though not necessairily edited. Some items in the list might be marked as editable: false and be accompanied by an empty orgname. This is
because, as a user, you have limited access to public templates in our system (which are the ones that we provide when you create or transfer a domain name).

Request

Query String
  • Optional
    • pageinteger

      Default: 1

      Minimum: 1

      Which result page to retrieve. If the number is greater than the last page, an empty list is returned.
    • per_pageinteger

      Minimum: 1

      How many items to display per page.
Headers
  • Required
    • Authorizationstring
      The Authorization header must start with Bearer for access token, or Apikey depending of the authentication scheme. Apikey is deprecated and be replaced by personal access token.
      Example: Bearer pat_abc-123
      Example: Apikey your-api-key

Responses

200

Headers
    • Total-Countinteger
      Total number of items.
    Optional
    • Linkstring
      Links to next and last page.
Body
  • application/json
    array

    Of items of type:

    • object

      With the following properties:

      • descriptionstring
        Template purpose's description.
      • editableboolean
        true when you can edit the template.
      • hrefstring
        API URL to the template's details.
      • idstring
        Template ID.
      • namestring
        Template's name.
      • namespacesarray[ string ]
        A list of namespaces that this template implements. The possible values are the keys of a template's payload, as described in the creation route.
      • orgnamestring
      Optional
      • sharing_spaceobject

        With the following properties:

        • idstring
          UUID
        • namestring
        Optional
        • resellerboolean
        • sharing_spaceobject

          With the following properties:

          • idstring
            UUID
          • namestring
        • typestring

403

Access to the resource is denied. Mainly due to a lack of permissions to access it.
Body
  • application/json
    object

    With the following properties:

    • causestring
    • codeinteger
    • messagestring
    • objectstring

401

Bad authentication attempt because of a wrong API Key.
Body
  • application/json
    object

    With the following properties:

    • causestring
    • codeinteger
    • messagestring
    • objectstring

403

In case the bearer token has expired, does not have enought permission or does not exists.
Body
  • application/json
    object

    With the following properties:

    • causestring
    • codeinteger
    • messagestring
    • objectstring

Secured by

Http Authorization Scheme

This authentication scheme allows you to pass your Personal Access Token and be granted access to permissions and resources scoped by this token.

Tokens are created in the Organization Tab of the Gandi Admin application, choose the organization the token will have access too. Then go to the sharing tab, and click on "Create a token" button.

The authentication scheme Apikey allows also you to pass your Gandi API Key, but has been deprecated.

Headers
  • Required
    • Authorizationstring
      The Authorization header must start with Bearer for access token, or Apikey depending of the authentication scheme. Apikey is deprecated and be replaced by personal access token.
      Example: Bearer pat_abc-123
      Example: Apikey your-api-key

post Create a new template

This route creates a new template. By default, a template belongs to the authenticated user. You can specify a different owher, however, by passing a sharing_id in the query string when performing this request.

Request

Query String
  • Optional
    • sharing_idstring
      Sharing ID. Organization ID used as a filter or as a billing identifier. See the reference.
Headers
  • Required
    • Authorizationstring
      The Authorization header must start with Bearer for access token, or Apikey depending of the authentication scheme. Apikey is deprecated and be replaced by personal access token.
      Example: Bearer pat_abc-123
      Example: Apikey your-api-key
Body
  • application/json
    object

    With the following properties:

    Required
    • namestring
      Template's name. Please note that this name must be unique within an organization.
    • payloadobject
      The payload is the actual "recipe" of your template. Each property, or namespace, is optional.

      With the following properties:

      Optional
      • dns:recordsobject

        This namespace defines the DNS records that will be set on a domain. It is only usefull when the domain is using LiveDNS. Even though it is not required, it's best to combine it with the domain:namservers namespace and set its service to livedns.

        Both properties default and record are mutually exclusive and you must set one and one only.

        With the following properties:

        Optional
        • defaultboolean

          Default: false

          When set to true, use Gandi's default DNS records.
        • recordsarray

          Of items of type:

          • object

            With the following properties:

            Required
            • namestring

              Pattern: ^(?:(?!-)[-_*@a-zA-Z0-9]{1,63}(?<!-)(\.|$))*(?<!\.)$

              The name of the record.
            • typestring

              One of: "A", "AAAA", "ALIAS", "CAA", "CDS", "CNAME", "DNAME", "DS", "KEY", "LOC", "MX", "NAPTR", "NS", "OPENPGPKEY", "PTR", "RP", "SPF", "SRV", "SSHFP", "TLSA", "TXT", "WKS"

              The type of the record.
            • valuesarray[ string ]
              A list of values for this record.
            Optional
            • ttlinteger

              Minimum: 300

              Maximum: 2592000

              The time in seconds that DNS resolvers should cache this record.
      • domain:mailboxesobject
        This namespace defines, at most, 2 mailboxes that will be added to the domain if they don't already exist.

        With the following properties:

        Required
        • valuesarray

          Maximum items: 2

          Of items of type:

          • object

            With the following properties:

            Required
            • loginstring
              The mailbox login.
      • domain:nameserversobject
        This namespace defines the nameservers that must be set on a domain.

        With the following properties:

        Required
        • addressesarray[ string ]
          List of nameserver hosts. Leave it empty when you set the service to livedns.
        • servicestring

          One of: "custom", "livedns"

          Type of nameserver service to use. livedns will automatically configure your name servers to Gandi's LiveDNS nameservers. custom lets you specify your own nameservers.
      • domain:webredirsobject
        This namespace defines web redirection to add to the a domain.

        With the following properties:

        Required
        • valuesarray

          Of items of type:

          • object

            With the following properties:

            Required
            • typestring

              One of: "cloak", "http301", "http302"

              Type of redirection.
            • urlstring
              Target URL.
            Optional
            • hoststring
              Source hostname (including the domain name)
            • overrideboolean

              Default: false

              When you create a redirection on a domain, a DNS record is created if it does not exist. When the record already exists and this parameter is set to true it will overwrite the record. Otherwise it will trigger an error.
            • protocolstring

              One of: "http", "https", "httpsonly"

              Redirection protocol.
    Optional
    • descriptionstring
      Template description.
    Example - a template for custom records:
    {
      "name": "test",
      "payload": {
        "domain:nameservers": {
          "addresses": [],
          "service": "livedns"
        },
        "dns:records": {
          "records": [
            {
              "type": "A",
              "name": "@",
              "values": [
                "203.0.113.1"
              ]
            },
            {
              "type": "MX",
              "name": "@",
              "ttl": 10800,
              "values": [
                "10 spool.mail.gandi.net.",
                "50 fb.mail.gandi.net."
              ]
            }
          ]
        }
      }
    }
    Example - a template with mailboxes:
    {
      "name": "test",
      "payload": {
        "domain:mailboxes": {
          "values": [
            {
              "login": "alice"
            },
            {
              "login": "contact"
            }
          ]
        }
      }
    }
    Example - a template with web redirections:
    {
      "name": "test",
      "payload": {
        "domain:webredirs": {
          "values": [
            {
              "type": "http301",
              "host": "www",
              "url": "https://www.gandi.net/"
            }
          ]
        }
      }
    }

Responses

201

The resource has been created.
Headers
  • Optional
    • Locationstring
Body
  • application/json
    object

    With the following properties:

    • messagestring
      Confirmation message.

403

Access to the resource is denied. Mainly due to a lack of permissions to access it.
Body
  • application/json
    object

    With the following properties:

    • causestring
    • codeinteger
    • messagestring
    • objectstring

401

Bad authentication attempt because of a wrong API Key.
Body
  • application/json
    object

    With the following properties:

    • causestring
    • codeinteger
    • messagestring
    • objectstring

403

In case the bearer token has expired, does not have enought permission or does not exists.
Body
  • application/json
    object

    With the following properties:

    • causestring
    • codeinteger
    • messagestring
    • objectstring

Secured by

Http Authorization Scheme

This authentication scheme allows you to pass your Personal Access Token and be granted access to permissions and resources scoped by this token.

Tokens are created in the Organization Tab of the Gandi Admin application, choose the organization the token will have access too. Then go to the sharing tab, and click on "Create a token" button.

The authentication scheme Apikey allows also you to pass your Gandi API Key, but has been deprecated.

Headers
  • Required
    • Authorizationstring
      The Authorization header must start with Bearer for access token, or Apikey depending of the authentication scheme. Apikey is deprecated and be replaced by personal access token.
      Example: Bearer pat_abc-123
      Example: Apikey your-api-key

Template management

https://api.gandi.net/v5/template/templates/{id}

get Template details

This route returns the information of a given template.

Request

URI Parameters
    • idstring
      Template ID.
Headers
  • Required
    • Authorizationstring
      The Authorization header must start with Bearer for access token, or Apikey depending of the authentication scheme. Apikey is deprecated and be replaced by personal access token.
      Example: Bearer pat_abc-123
      Example: Apikey your-api-key

Responses

200

Body
  • application/json
    object

    With the following properties:

    • descriptionstring
      Template purpose's description.
    • editableboolean
      true when you can edit the template.
    • hrefstring
      API URL to the template's details.
    • idstring
      Template ID.
    • namestring
      Template's name.
    • namespacesarray[ string ]
      A list of namespaces that this template implements. The possible values are the keys of a template's payload, as described in the creation route.
    • orgnamestring
    • payloadobject

      With the following properties:

      Optional
      • dns:recordsobject

        This namespace defines the DNS records that will be set on a domain. It is only usefull when the domain is using LiveDNS. Even though it is not required, it's best to combine it with the domain:namservers namespace and set its service to livedns.

        Both properties default and record are mutually exclusive and you must set one and one only.

        With the following properties:

        Optional
        • defaultboolean

          Default: false

          When set to true, use Gandi's default DNS records.
        • recordsarray

          Of items of type:

          • object

            With the following properties:

            • namestring

              Pattern: ^(?:(?!-)[-_*@a-zA-Z0-9]{1,63}(?<!-)(\.|$))*(?<!\.)$

              The name of the record.
            • typestring

              One of: "A", "AAAA", "ALIAS", "CAA", "CDS", "CNAME", "DNAME", "DS", "KEY", "LOC", "MX", "NAPTR", "NS", "OPENPGPKEY", "PTR", "RP", "SPF", "SRV", "SSHFP", "TLSA", "TXT", "WKS"

              The type of the record.
            • valuesarray[ string ]
              A list of values for this record.
            Optional
            • ttlinteger

              Minimum: 300

              Maximum: 2592000

              The time in seconds that DNS resolvers should cache this record.
      • domain:mailboxesobject
        This namespace defines, at most, 2 mailboxes that will be added to the domain if they don't already exist.

        With the following properties:

        • valuesarray

          Maximum items: 2

          Of items of type:

          • object

            With the following properties:

            • loginstring
              The mailbox login.
      • domain:nameserversobject
        This namespace defines the nameservers that must be set on a domain.

        With the following properties:

        • addressesarray[ string ]
          List of nameserver hosts. Leave it empty when you set the service to livedns.
        • servicestring

          One of: "custom", "livedns"

          Type of nameserver service to use. livedns will automatically configure your name servers to Gandi's LiveDNS nameservers. custom lets you specify your own nameservers.
      • domain:webredirsobject
        This namespace defines web redirection to add to the a domain.

        With the following properties:

        • valuesarray

          Of items of type:

          • object

            With the following properties:

            • typestring

              One of: "cloak", "http301", "http302"

              Type of redirection.
            • urlstring
              Target URL.
            Optional
            • hoststring
              Source hostname (including the domain name)
            • overrideboolean

              Default: false

              When you create a redirection on a domain, a DNS record is created if it does not exist. When the record already exists and this parameter is set to true it will overwrite the record. Otherwise it will trigger an error.
            • protocolstring

              One of: "http", "https", "httpsonly"

              Redirection protocol.
    • variablesarray[ string ]
    Optional
    • sharing_spaceobject

      With the following properties:

      • idstring
        UUID
      • namestring
      Optional
      • resellerboolean
      • sharing_spaceobject

        With the following properties:

        • idstring
          UUID
        • namestring
      • typestring
    Example:
    {
      "payload": {
        "domain:nameservers": {
          "addresses": [],
          "service": "livedns"
        },
        "dns:records": {
          "default": true
        }
      },
      "id": "881f8c9a-fe7d-11ea-b2fe-00163e7504b8",
      "editable": true,
      "orgname": "my-organization",
      "description": "",
      "namespaces": [
        "domain:nameservers",
        "dns:records"
      ],
      "variables": [],
      "sharing_space": {
        "id": "fe0b931c-18c5-11e9-b9b5-00163ec4cb00",
        "name": "my-organization"
      },
      "name": "test",
      "href": "http://api.test/v5/template/templates/881f8c9a-fe7d-11ea-b2fe-00163e7504b8"
    }

403

Access to the resource is denied. Mainly due to a lack of permissions to access it.
Body
  • application/json
    object

    With the following properties:

    • causestring
    • codeinteger
    • messagestring
    • objectstring

401

Bad authentication attempt because of a wrong API Key.
Body
  • application/json
    object

    With the following properties:

    • causestring
    • codeinteger
    • messagestring
    • objectstring

403

In case the bearer token has expired, does not have enought permission or does not exists.
Body
  • application/json
    object

    With the following properties:

    • causestring
    • codeinteger
    • messagestring
    • objectstring

Secured by

Http Authorization Scheme

This authentication scheme allows you to pass your Personal Access Token and be granted access to permissions and resources scoped by this token.

Tokens are created in the Organization Tab of the Gandi Admin application, choose the organization the token will have access too. Then go to the sharing tab, and click on "Create a token" button.

The authentication scheme Apikey allows also you to pass your Gandi API Key, but has been deprecated.

Headers
  • Required
    • Authorizationstring
      The Authorization header must start with Bearer for access token, or Apikey depending of the authentication scheme. Apikey is deprecated and be replaced by personal access token.
      Example: Bearer pat_abc-123
      Example: Apikey your-api-key

patch Edit a template

This route updates the information of a given template. Please note that when updating the payload, you must send the full payload and not only the new values.

Request

URI Parameters
    • idstring
      Template ID.
Headers
  • Required
    • Authorizationstring
      The Authorization header must start with Bearer for access token, or Apikey depending of the authentication scheme. Apikey is deprecated and be replaced by personal access token.
      Example: Bearer pat_abc-123
      Example: Apikey your-api-key
Body
  • application/json
    object

    With the following properties:

    Optional
    • descriptionstring
      Template description.
    • namestring
      Template's name. Please note that this name must be unique within an organization.
    • payloadobject
      The payload is the actual "recipe" of your template. Each property, or namespace, is optional.

      With the following properties:

      Optional
      • dns:recordsobject

        This namespace defines the DNS records that will be set on a domain. It is only usefull when the domain is using LiveDNS. Even though it is not required, it's best to combine it with the domain:namservers namespace and set its service to livedns.

        Both properties default and record are mutually exclusive and you must set one and one only.

        With the following properties:

        Optional
        • defaultboolean

          Default: false

          When set to true, use Gandi's default DNS records.
        • recordsarray

          Of items of type:

          • object

            With the following properties:

            Required
            • namestring

              Pattern: ^(?:(?!-)[-_*@a-zA-Z0-9]{1,63}(?<!-)(\.|$))*(?<!\.)$

              The name of the record.
            • typestring

              One of: "A", "AAAA", "ALIAS", "CAA", "CDS", "CNAME", "DNAME", "DS", "KEY", "LOC", "MX", "NAPTR", "NS", "OPENPGPKEY", "PTR", "RP", "SPF", "SRV", "SSHFP", "TLSA", "TXT", "WKS"

              The type of the record.
            • valuesarray[ string ]
              A list of values for this record.
            Optional
            • ttlinteger

              Minimum: 300

              Maximum: 2592000

              The time in seconds that DNS resolvers should cache this record.
      • domain:mailboxesobject
        This namespace defines, at most, 2 mailboxes that will be added to the domain if they don't already exist.

        With the following properties:

        Required
        • valuesarray

          Maximum items: 2

          Of items of type:

          • object

            With the following properties:

            Required
            • loginstring
              The mailbox login.
      • domain:nameserversobject
        This namespace defines the nameservers that must be set on a domain.

        With the following properties:

        Required
        • addressesarray[ string ]
          List of nameserver hosts. Leave it empty when you set the service to livedns.
        • servicestring

          One of: "custom", "livedns"

          Type of nameserver service to use. livedns will automatically configure your name servers to Gandi's LiveDNS nameservers. custom lets you specify your own nameservers.
      • domain:webredirsobject
        This namespace defines web redirection to add to the a domain.

        With the following properties:

        Required
        • valuesarray

          Of items of type:

          • object

            With the following properties:

            Required
            • typestring

              One of: "cloak", "http301", "http302"

              Type of redirection.
            • urlstring
              Target URL.
            Optional
            • hoststring
              Source hostname (including the domain name)
            • overrideboolean

              Default: false

              When you create a redirection on a domain, a DNS record is created if it does not exist. When the record already exists and this parameter is set to true it will overwrite the record. Otherwise it will trigger an error.
            • protocolstring

              One of: "http", "https", "httpsonly"

              Redirection protocol.
    Example - update a template's payload:
    {
      "payload": {
        "domain:nameservers": {
          "addresses": [],
          "service": "livedns"
        },
        "dns:records": {
          "default": true
        }
      }
    }

Responses

204

Template was updated.

403

Access to the resource is denied. Mainly due to a lack of permissions to access it.
Body
  • application/json
    object

    With the following properties:

    • causestring
    • codeinteger
    • messagestring
    • objectstring

401

Bad authentication attempt because of a wrong API Key.
Body
  • application/json
    object

    With the following properties:

    • causestring
    • codeinteger
    • messagestring
    • objectstring

403

In case the bearer token has expired, does not have enought permission or does not exists.
Body
  • application/json
    object

    With the following properties:

    • causestring
    • codeinteger
    • messagestring
    • objectstring

Secured by

Http Authorization Scheme

This authentication scheme allows you to pass your Personal Access Token and be granted access to permissions and resources scoped by this token.

Tokens are created in the Organization Tab of the Gandi Admin application, choose the organization the token will have access too. Then go to the sharing tab, and click on "Create a token" button.

The authentication scheme Apikey allows also you to pass your Gandi API Key, but has been deprecated.

Headers
  • Required
    • Authorizationstring
      The Authorization header must start with Bearer for access token, or Apikey depending of the authentication scheme. Apikey is deprecated and be replaced by personal access token.
      Example: Bearer pat_abc-123
      Example: Apikey your-api-key

delete Delete a template

This route deletes a given template.

Request

URI Parameters
    • idstring
      Template ID.
Headers
  • Required
    • Authorizationstring
      The Authorization header must start with Bearer for access token, or Apikey depending of the authentication scheme. Apikey is deprecated and be replaced by personal access token.
      Example: Bearer pat_abc-123
      Example: Apikey your-api-key

Responses

204

Template was deleted.

403

Access to the resource is denied. Mainly due to a lack of permissions to access it.
Body
  • application/json
    object

    With the following properties:

    • causestring
    • codeinteger
    • messagestring
    • objectstring

401

Bad authentication attempt because of a wrong API Key.
Body
  • application/json
    object

    With the following properties:

    • causestring
    • codeinteger
    • messagestring
    • objectstring

403

In case the bearer token has expired, does not have enought permission or does not exists.
Body
  • application/json
    object

    With the following properties:

    • causestring
    • codeinteger
    • messagestring
    • objectstring

Secured by

Http Authorization Scheme

This authentication scheme allows you to pass your Personal Access Token and be granted access to permissions and resources scoped by this token.

Tokens are created in the Organization Tab of the Gandi Admin application, choose the organization the token will have access too. Then go to the sharing tab, and click on "Create a token" button.

The authentication scheme Apikey allows also you to pass your Gandi API Key, but has been deprecated.

Headers
  • Required
    • Authorizationstring
      The Authorization header must start with Bearer for access token, or Apikey depending of the authentication scheme. Apikey is deprecated and be replaced by personal access token.
      Example: Bearer pat_abc-123
      Example: Apikey your-api-key

post Apply a template

This route applies a template to a domain. You must send the parameter object_type to domain and the object_id to a domain id, that you'll find in the domain list.

The response will contain a location header containing the API URL of the operation being performed. Refer to our dispatch documentation for more information.

Request

URI Parameters
    • idstring
      Template ID.
Headers
  • Required
    • Authorizationstring
      The Authorization header must start with Bearer for access token, or Apikey depending of the authentication scheme. Apikey is deprecated and be replaced by personal access token.
      Example: Bearer pat_abc-123
      Example: Apikey your-api-key
Body
  • application/json
    object

    With the following properties:

    Required
    • object_idstring
      The ID of the object to which the template applies.
    • object_typestring

      One of: "domain"

      The object type to which the template applies. For now, only domain is available.
    Example:
    {
      "object_type": "domain",
      "object_id": "ba1167be-2f76-11e9-9dfb-00163ec4cb00"
    }

Responses

202

The request has been accepted.
Headers
  • Optional
    • Locationstring
Body
  • application/json
    object

    With the following properties:

    • dispatch_hrefstring
      The API URL to the operation being performed.
    • messagestring
      Confirmation message.
    • payloadobject

      With the following properties:

      Optional
      • dns:recordsobject

        This namespace defines the DNS records that will be set on a domain. It is only usefull when the domain is using LiveDNS. Even though it is not required, it's best to combine it with the domain:namservers namespace and set its service to livedns.

        Both properties default and record are mutually exclusive and you must set one and one only.

        With the following properties:

        Optional
        • defaultboolean

          Default: false

          When set to true, use Gandi's default DNS records.
        • recordsarray

          Of items of type:

          • object

            With the following properties:

            • namestring

              Pattern: ^(?:(?!-)[-_*@a-zA-Z0-9]{1,63}(?<!-)(\.|$))*(?<!\.)$

              The name of the record.
            • typestring

              One of: "A", "AAAA", "ALIAS", "CAA", "CDS", "CNAME", "DNAME", "DS", "KEY", "LOC", "MX", "NAPTR", "NS", "OPENPGPKEY", "PTR", "RP", "SPF", "SRV", "SSHFP", "TLSA", "TXT", "WKS"

              The type of the record.
            • valuesarray[ string ]
              A list of values for this record.
            Optional
            • ttlinteger

              Minimum: 300

              Maximum: 2592000

              The time in seconds that DNS resolvers should cache this record.
      • domain:mailboxesobject
        This namespace defines, at most, 2 mailboxes that will be added to the domain if they don't already exist.

        With the following properties:

        • valuesarray

          Maximum items: 2

          Of items of type:

          • object

            With the following properties:

            • loginstring
              The mailbox login.
      • domain:nameserversobject
        This namespace defines the nameservers that must be set on a domain.

        With the following properties:

        • addressesarray[ string ]
          List of nameserver hosts. Leave it empty when you set the service to livedns.
        • servicestring

          One of: "custom", "livedns"

          Type of nameserver service to use. livedns will automatically configure your name servers to Gandi's LiveDNS nameservers. custom lets you specify your own nameservers.
      • domain:webredirsobject
        This namespace defines web redirection to add to the a domain.

        With the following properties:

        • valuesarray

          Of items of type:

          • object

            With the following properties:

            • typestring

              One of: "cloak", "http301", "http302"

              Type of redirection.
            • urlstring
              Target URL.
            Optional
            • hoststring
              Source hostname (including the domain name)
            • overrideboolean

              Default: false

              When you create a redirection on a domain, a DNS record is created if it does not exist. When the record already exists and this parameter is set to true it will overwrite the record. Otherwise it will trigger an error.
            • protocolstring

              One of: "http", "https", "httpsonly"

              Redirection protocol.
    • target_idstring
      The ID of the object to which the template was applied.
    • target_typestring

      One of: "domain"

403

Access to the resource is denied. Mainly due to a lack of permissions to access it.
Body
  • application/json
    object

    With the following properties:

    • causestring
    • codeinteger
    • messagestring
    • objectstring

401

Bad authentication attempt because of a wrong API Key.
Body
  • application/json
    object

    With the following properties:

    • causestring
    • codeinteger
    • messagestring
    • objectstring

403

In case the bearer token has expired, does not have enought permission or does not exists.
Body
  • application/json
    object

    With the following properties:

    • causestring
    • codeinteger
    • messagestring
    • objectstring

Secured by

Http Authorization Scheme

This authentication scheme allows you to pass your Personal Access Token and be granted access to permissions and resources scoped by this token.

Tokens are created in the Organization Tab of the Gandi Admin application, choose the organization the token will have access too. Then go to the sharing tab, and click on "Create a token" button.

The authentication scheme Apikey allows also you to pass your Gandi API Key, but has been deprecated.

Headers
  • Required
    • Authorizationstring
      The Authorization header must start with Bearer for access token, or Apikey depending of the authentication scheme. Apikey is deprecated and be replaced by personal access token.
      Example: Bearer pat_abc-123
      Example: Apikey your-api-key