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
    • id ⁠string
      Dispatch ID.
Headers
  • Required
    • Authorization ⁠string
      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:

    • attempt ⁠integer
      Current number of attempts at performing the tasks.
    • created_at ⁠string
    • id ⁠string
    • payload ⁠object
      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:records ⁠object

        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
        • default ⁠boolean

          Default: false

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

          Of items of type:

          • object

            With the following properties:

            • name ⁠string

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

              The name of the record.
            • type ⁠string

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

              The type of the record.
            • values ⁠array[ string ]
              A list of values for this record.
            Optional
            • ttl ⁠integer

              Minimum: 300

              Maximum: 2592000

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

        With the following properties:

        • values ⁠array

          Maximum items: 2

          Of items of type:

          • object

            With the following properties:

            • login ⁠string
              The mailbox login.
      • domain:nameservers ⁠object
        This namespace defines the nameservers that must be set on a domain.

        With the following properties:

        • addresses ⁠array[ string ]
          List of nameserver hosts. Leave it empty when you set the service to livedns.
        • service ⁠string

          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:webredirs ⁠object
        This namespace defines web redirection to add to the a domain.

        With the following properties:

        • values ⁠array

          Of items of type:

          • object

            With the following properties:

            • type ⁠string

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

              Type of redirection.
            • url ⁠string
              Target URL.
            Optional
            • host ⁠string
              Source hostname (including the domain name)
            • override ⁠boolean

              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.
            • protocol ⁠string

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

              Redirection protocol.
    • sharing_id ⁠string
      This ID of the user who applied the template.
    • state ⁠integer

      One of: 0, 10, 20, 30

    • target ⁠object
      Information about the target object.

      With the following properties:

      • name ⁠string
      • type ⁠string
    • target_id ⁠string
    • task_history ⁠array

      Of items of type:

      • object

        With the following properties:

        • date ⁠string
        • message ⁠string
        • namespace ⁠string
        • status ⁠integer

          One of: 0, 10, 20, 30

    • task_status ⁠object
      Each entry is an object containing the task's status.
    Optional
    • state_msg ⁠string
      A message when the whole dispatch triggered an error.
    • task_updated_at ⁠string
    • template_id ⁠string
      The ID of the template that was applied.
    • template_name ⁠string
      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:

    • cause ⁠string
    • code ⁠integer
    • message ⁠string
    • object ⁠string

401

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

    With the following properties:

    • cause ⁠string
    • code ⁠integer
    • message ⁠string
    • object ⁠string

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:

    • cause ⁠string
    • code ⁠integer
    • message ⁠string
    • object ⁠string

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
    • Authorization ⁠string
      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
    • page ⁠integer

      Default: 1

      Minimum: 1

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

      Minimum: 1

      How many items to display per page.
Headers
  • Required
    • Authorization ⁠string
      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
    • Filtered-Count ⁠integer
      Number of items returned by the API call.
    • Total-Count ⁠integer
      Total number of items.
    Optional
    • Link ⁠string
      Links to next and last page.
Body
  • application/json
    ⁠array

    Of items of type:

    • object

      With the following properties:

      • description ⁠string
        Template purpose's description.
      • editable ⁠boolean
        true when you can edit the template.
      • href ⁠string
        API URL to the template's details.
      • id ⁠string
        Template ID.
      • name ⁠string
        Template's name.
      • namespaces ⁠array[ 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.
      • orgname ⁠string
      Optional
      • sharing_space ⁠object

        With the following properties:

        • id ⁠string
          UUID
        • name ⁠string
        Optional
        • reseller ⁠boolean
        • sharing_space ⁠object

          With the following properties:

          • id ⁠string
            UUID
          • name ⁠string
        • type ⁠string

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:

    • cause ⁠string
    • code ⁠integer
    • message ⁠string
    • object ⁠string

401

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

    With the following properties:

    • cause ⁠string
    • code ⁠integer
    • message ⁠string
    • object ⁠string

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:

    • cause ⁠string
    • code ⁠integer
    • message ⁠string
    • object ⁠string

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
    • Authorization ⁠string
      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_id ⁠string
      Sharing ID. Organization ID used as a filter or as a billing identifier. See the reference.
Headers
  • Required
    • Authorization ⁠string
      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
    • name ⁠string
      Template's name. Please note that this name must be unique within an organization.
    • payload ⁠object
      The payload is the actual "recipe" of your template. Each property, or namespace, is optional.

      With the following properties:

      Optional
      • dns:records ⁠object

        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
        • default ⁠boolean

          Default: false

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

          Of items of type:

          • object

            With the following properties:

            Required
            • name ⁠string

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

              The name of the record.
            • type ⁠string

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

              The type of the record.
            • values ⁠array[ string ]
              A list of values for this record.
            Optional
            • ttl ⁠integer

              Minimum: 300

              Maximum: 2592000

              The time in seconds that DNS resolvers should cache this record.
      • domain:mailboxes ⁠object
        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
        • values ⁠array

          Maximum items: 2

          Of items of type:

          • object

            With the following properties:

            Required
            • login ⁠string
              The mailbox login.
      • domain:nameservers ⁠object
        This namespace defines the nameservers that must be set on a domain.

        With the following properties:

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

          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:webredirs ⁠object
        This namespace defines web redirection to add to the a domain.

        With the following properties:

        Required
        • values ⁠array

          Of items of type:

          • object

            With the following properties:

            Required
            • type ⁠string

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

              Type of redirection.
            • url ⁠string
              Target URL.
            Optional
            • host ⁠string
              Source hostname (including the domain name)
            • override ⁠boolean

              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.
            • protocol ⁠string

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

              Redirection protocol.
    Optional
    • description ⁠string
      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
    • Location ⁠string
Body
  • application/json
    ⁠object

    With the following properties:

    • message ⁠string
      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:

    • cause ⁠string
    • code ⁠integer
    • message ⁠string
    • object ⁠string

401

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

    With the following properties:

    • cause ⁠string
    • code ⁠integer
    • message ⁠string
    • object ⁠string

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:

    • cause ⁠string
    • code ⁠integer
    • message ⁠string
    • object ⁠string

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
    • Authorization ⁠string
      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
    • id ⁠string
      Template ID.
Headers
  • Required
    • Authorization ⁠string
      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:

    • description ⁠string
      Template purpose's description.
    • editable ⁠boolean
      true when you can edit the template.
    • href ⁠string
      API URL to the template's details.
    • id ⁠string
      Template ID.
    • name ⁠string
      Template's name.
    • namespaces ⁠array[ 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.
    • orgname ⁠string
    • payload ⁠object

      With the following properties:

      Optional
      • dns:records ⁠object

        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
        • default ⁠boolean

          Default: false

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

          Of items of type:

          • object

            With the following properties:

            • name ⁠string

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

              The name of the record.
            • type ⁠string

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

              The type of the record.
            • values ⁠array[ string ]
              A list of values for this record.
            Optional
            • ttl ⁠integer

              Minimum: 300

              Maximum: 2592000

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

        With the following properties:

        • values ⁠array

          Maximum items: 2

          Of items of type:

          • object

            With the following properties:

            • login ⁠string
              The mailbox login.
      • domain:nameservers ⁠object
        This namespace defines the nameservers that must be set on a domain.

        With the following properties:

        • addresses ⁠array[ string ]
          List of nameserver hosts. Leave it empty when you set the service to livedns.
        • service ⁠string

          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:webredirs ⁠object
        This namespace defines web redirection to add to the a domain.

        With the following properties:

        • values ⁠array

          Of items of type:

          • object

            With the following properties:

            • type ⁠string

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

              Type of redirection.
            • url ⁠string
              Target URL.
            Optional
            • host ⁠string
              Source hostname (including the domain name)
            • override ⁠boolean

              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.
            • protocol ⁠string

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

              Redirection protocol.
    • variables ⁠array[ string ]
    Optional
    • sharing_space ⁠object

      With the following properties:

      • id ⁠string
        UUID
      • name ⁠string
      Optional
      • reseller ⁠boolean
      • sharing_space ⁠object

        With the following properties:

        • id ⁠string
          UUID
        • name ⁠string
      • type ⁠string
    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:

    • cause ⁠string
    • code ⁠integer
    • message ⁠string
    • object ⁠string

401

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

    With the following properties:

    • cause ⁠string
    • code ⁠integer
    • message ⁠string
    • object ⁠string

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:

    • cause ⁠string
    • code ⁠integer
    • message ⁠string
    • object ⁠string

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
    • Authorization ⁠string
      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
    • id ⁠string
      Template ID.
Headers
  • Required
    • Authorization ⁠string
      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
    • description ⁠string
      Template description.
    • name ⁠string
      Template's name. Please note that this name must be unique within an organization.
    • payload ⁠object
      The payload is the actual "recipe" of your template. Each property, or namespace, is optional.

      With the following properties:

      Optional
      • dns:records ⁠object

        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
        • default ⁠boolean

          Default: false

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

          Of items of type:

          • object

            With the following properties:

            Required
            • name ⁠string

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

              The name of the record.
            • type ⁠string

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

              The type of the record.
            • values ⁠array[ string ]
              A list of values for this record.
            Optional
            • ttl ⁠integer

              Minimum: 300

              Maximum: 2592000

              The time in seconds that DNS resolvers should cache this record.
      • domain:mailboxes ⁠object
        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
        • values ⁠array

          Maximum items: 2

          Of items of type:

          • object

            With the following properties:

            Required
            • login ⁠string
              The mailbox login.
      • domain:nameservers ⁠object
        This namespace defines the nameservers that must be set on a domain.

        With the following properties:

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

          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:webredirs ⁠object
        This namespace defines web redirection to add to the a domain.

        With the following properties:

        Required
        • values ⁠array

          Of items of type:

          • object

            With the following properties:

            Required
            • type ⁠string

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

              Type of redirection.
            • url ⁠string
              Target URL.
            Optional
            • host ⁠string
              Source hostname (including the domain name)
            • override ⁠boolean

              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.
            • protocol ⁠string

              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:

    • cause ⁠string
    • code ⁠integer
    • message ⁠string
    • object ⁠string

401

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

    With the following properties:

    • cause ⁠string
    • code ⁠integer
    • message ⁠string
    • object ⁠string

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:

    • cause ⁠string
    • code ⁠integer
    • message ⁠string
    • object ⁠string

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
    • Authorization ⁠string
      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
    • id ⁠string
      Template ID.
Headers
  • Required
    • Authorization ⁠string
      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:

    • cause ⁠string
    • code ⁠integer
    • message ⁠string
    • object ⁠string

401

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

    With the following properties:

    • cause ⁠string
    • code ⁠integer
    • message ⁠string
    • object ⁠string

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:

    • cause ⁠string
    • code ⁠integer
    • message ⁠string
    • object ⁠string

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
    • Authorization ⁠string
      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
    • id ⁠string
      Template ID.
Headers
  • Required
    • Authorization ⁠string
      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_id ⁠string
      The ID of the object to which the template applies.
    • object_type ⁠string

      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
    • Location ⁠string
Body
  • application/json
    ⁠object

    With the following properties:

    • dispatch_href ⁠string
      The API URL to the operation being performed.
    • message ⁠string
      Confirmation message.
    • payload ⁠object

      With the following properties:

      Optional
      • dns:records ⁠object

        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
        • default ⁠boolean

          Default: false

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

          Of items of type:

          • object

            With the following properties:

            • name ⁠string

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

              The name of the record.
            • type ⁠string

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

              The type of the record.
            • values ⁠array[ string ]
              A list of values for this record.
            Optional
            • ttl ⁠integer

              Minimum: 300

              Maximum: 2592000

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

        With the following properties:

        • values ⁠array

          Maximum items: 2

          Of items of type:

          • object

            With the following properties:

            • login ⁠string
              The mailbox login.
      • domain:nameservers ⁠object
        This namespace defines the nameservers that must be set on a domain.

        With the following properties:

        • addresses ⁠array[ string ]
          List of nameserver hosts. Leave it empty when you set the service to livedns.
        • service ⁠string

          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:webredirs ⁠object
        This namespace defines web redirection to add to the a domain.

        With the following properties:

        • values ⁠array

          Of items of type:

          • object

            With the following properties:

            • type ⁠string

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

              Type of redirection.
            • url ⁠string
              Target URL.
            Optional
            • host ⁠string
              Source hostname (including the domain name)
            • override ⁠boolean

              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.
            • protocol ⁠string

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

              Redirection protocol.
    • target_id ⁠string
      The ID of the object to which the template was applied.
    • target_type ⁠string

      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:

    • cause ⁠string
    • code ⁠integer
    • message ⁠string
    • object ⁠string

401

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

    With the following properties:

    • cause ⁠string
    • code ⁠integer
    • message ⁠string
    • object ⁠string

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:

    • cause ⁠string
    • code ⁠integer
    • message ⁠string
    • object ⁠string

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
    • Authorization ⁠string
      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