Template API
https://api.gandi.net/v5/template
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 of0
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
: running20
: done30
: 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 ⁠stringDispatch ID.
- id ⁠string
Headers
Required
- Authorization ⁠stringThe
Authorization
header must start withBearer
for access token, orApikey
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
- Authorization ⁠string
Responses
200
Body
application/json
⁠objectWith the following properties:
- attempt ⁠integerCurrent number of attempts at performing the tasks.
- created_at ⁠string
- id ⁠string
- payload ⁠objectThe 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 itsservice
tolivedns
.Both properties
default
andrecord
are mutually exclusive and you must set one and one only.With the following properties:
Optional
- default ⁠boolean
Default: false
When set totrue
, 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", "KEY", "LOC", "MX", "NAPTR", "NS", "OPENPGPKEY", "PTR", "RP", "SPF", "SRV", "SSHFP", "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.
- name ⁠string
- object
- default ⁠boolean
- domain:mailboxes ⁠objectThis 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 ⁠stringThe mailbox login.
- login ⁠string
- object
- values ⁠array
- domain:nameservers ⁠objectThis 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
tolivedns
. - 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.
- addresses ⁠array[ string ]
- domain:webredirs ⁠objectThis 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 ⁠stringTarget URL.
Optional
- host ⁠stringSource 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 totrue
it will overwrite the record. Otherwise it will trigger an error. - protocol ⁠string
One of: "http", "https", "httpsonly"
Redirection protocol.
- type ⁠string
- object
- values ⁠array
- dns:records ⁠object
- sharing_id ⁠stringThis ID of the user who applied the template.
- state ⁠integer
One of: 0, 10, 20, 30
- target ⁠objectInformation 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
- object
- task_status ⁠objectEach entry is an object containing the task's status.
Optional
- state_msg ⁠stringA message when the whole dispatch triggered an error.
- task_updated_at ⁠string
- template_id ⁠stringThe ID of the template that was applied.
- template_name ⁠stringThe 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" }
- attempt ⁠integer
403
Body
application/json
⁠objectWith the following properties:
- cause ⁠string
- code ⁠integer
- message ⁠string
- object ⁠string
401
Body
application/json
⁠objectWith the following properties:
- cause ⁠string
- code ⁠integer
- message ⁠string
- object ⁠string
403
Body
application/json
⁠objectWith 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 ⁠stringThe
Authorization
header must start withBearer
for access token, orApikey
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
- Authorization ⁠string
Templates ¶
https://api.gandi.net/v5/template/templates
get List of templates ¶
editable: false
and be accompanied by an empty orgname
. This isbecause, 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.
- page ⁠integer
Headers
Required
- Authorization ⁠stringThe
Authorization
header must start withBearer
for access token, orApikey
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
- Authorization ⁠string
Responses
200
Headers
- Total-Count ⁠integerTotal number of items.
Optional
- Link ⁠stringLinks to next and last page.
- Total-Count ⁠integer
Body
application/json
⁠arrayOf items of type:
- object
With the following properties:
- description ⁠stringTemplate purpose's description.
- editable ⁠boolean
true
when you can edit the template. - href ⁠stringAPI URL to the template's details.
- id ⁠stringTemplate ID.
- name ⁠stringTemplate'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 ⁠stringUUID
- name ⁠string
Optional
- reseller ⁠boolean
- sharing_space ⁠object
With the following properties:
- id ⁠stringUUID
- name ⁠string
- id ⁠string
- type ⁠string
- id ⁠string
- description ⁠string
- object
403
Body
application/json
⁠objectWith the following properties:
- cause ⁠string
- code ⁠integer
- message ⁠string
- object ⁠string
401
Body
application/json
⁠objectWith the following properties:
- cause ⁠string
- code ⁠integer
- message ⁠string
- object ⁠string
403
Body
application/json
⁠objectWith 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 ⁠stringThe
Authorization
header must start withBearer
for access token, orApikey
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
- Authorization ⁠string
post Create a new template ¶
sharing_id
in the query string when performing this request.Request
Query String
Optional
- sharing_id ⁠stringSharing ID. Organization ID used as a filter or as a billing identifier. See the reference.
- sharing_id ⁠string
Headers
Required
- Authorization ⁠stringThe
Authorization
header must start withBearer
for access token, orApikey
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
- Authorization ⁠string
Body
application/json
⁠objectWith the following properties:
Required
- name ⁠stringTemplate's name. Please note that this name must be unique within an organization.
- payload ⁠objectThe 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 itsservice
tolivedns
.Both properties
default
andrecord
are mutually exclusive and you must set one and one only.With the following properties:
Optional
- default ⁠boolean
Default: false
When set totrue
, 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", "KEY", "LOC", "MX", "NAPTR", "NS", "OPENPGPKEY", "PTR", "RP", "SPF", "SRV", "SSHFP", "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.
- name ⁠string
- object
- default ⁠boolean
- domain:mailboxes ⁠objectThis 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 ⁠stringThe mailbox login.
- login ⁠string
- object
- values ⁠array
- domain:nameservers ⁠objectThis 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
tolivedns
. - 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.
- addresses ⁠array[ string ]
- domain:webredirs ⁠objectThis 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 ⁠stringTarget URL.
Optional
- host ⁠stringSource 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 totrue
it will overwrite the record. Otherwise it will trigger an error. - protocol ⁠string
One of: "http", "https", "httpsonly"
Redirection protocol.
- type ⁠string
- object
- values ⁠array
- dns:records ⁠object
Optional
- description ⁠stringTemplate 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/" } ] } } }
- name ⁠string
Responses
201
Headers
Optional
- Location ⁠string
Body
application/json
⁠objectWith the following properties:
- message ⁠stringConfirmation message.
- message ⁠string
403
Body
application/json
⁠objectWith the following properties:
- cause ⁠string
- code ⁠integer
- message ⁠string
- object ⁠string
401
Body
application/json
⁠objectWith the following properties:
- cause ⁠string
- code ⁠integer
- message ⁠string
- object ⁠string
403
Body
application/json
⁠objectWith 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 ⁠stringThe
Authorization
header must start withBearer
for access token, orApikey
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
- Authorization ⁠string
Template management ¶
https://api.gandi.net/v5/template/templates/{id}
get Template details ¶
Request
URI Parameters
- id ⁠stringTemplate ID.
- id ⁠string
Headers
Required
- Authorization ⁠stringThe
Authorization
header must start withBearer
for access token, orApikey
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
- Authorization ⁠string
Responses
200
Body
application/json
⁠objectWith the following properties:
- description ⁠stringTemplate purpose's description.
- editable ⁠boolean
true
when you can edit the template. - href ⁠stringAPI URL to the template's details.
- id ⁠stringTemplate ID.
- name ⁠stringTemplate'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 itsservice
tolivedns
.Both properties
default
andrecord
are mutually exclusive and you must set one and one only.With the following properties:
Optional
- default ⁠boolean
Default: false
When set totrue
, 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", "KEY", "LOC", "MX", "NAPTR", "NS", "OPENPGPKEY", "PTR", "RP", "SPF", "SRV", "SSHFP", "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.
- name ⁠string
- object
- default ⁠boolean
- domain:mailboxes ⁠objectThis 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 ⁠stringThe mailbox login.
- login ⁠string
- object
- values ⁠array
- domain:nameservers ⁠objectThis 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
tolivedns
. - 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.
- addresses ⁠array[ string ]
- domain:webredirs ⁠objectThis 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 ⁠stringTarget URL.
Optional
- host ⁠stringSource 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 totrue
it will overwrite the record. Otherwise it will trigger an error. - protocol ⁠string
One of: "http", "https", "httpsonly"
Redirection protocol.
- type ⁠string
- object
- values ⁠array
- dns:records ⁠object
- variables ⁠array[ string ]
Optional
- sharing_space ⁠object
With the following properties:
- id ⁠stringUUID
- name ⁠string
Optional
- reseller ⁠boolean
- sharing_space ⁠object
With the following properties:
- id ⁠stringUUID
- name ⁠string
- id ⁠string
- type ⁠string
- id ⁠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" }
- description ⁠string
403
Body
application/json
⁠objectWith the following properties:
- cause ⁠string
- code ⁠integer
- message ⁠string
- object ⁠string
401
Body
application/json
⁠objectWith the following properties:
- cause ⁠string
- code ⁠integer
- message ⁠string
- object ⁠string
403
Body
application/json
⁠objectWith 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 ⁠stringThe
Authorization
header must start withBearer
for access token, orApikey
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
- Authorization ⁠string
patch Edit a template ¶
Request
URI Parameters
- id ⁠stringTemplate ID.
- id ⁠string
Headers
Required
- Authorization ⁠stringThe
Authorization
header must start withBearer
for access token, orApikey
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
- Authorization ⁠string
Body
application/json
⁠objectWith the following properties:
Optional
- description ⁠stringTemplate description.
- name ⁠stringTemplate's name. Please note that this name must be unique within an organization.
- payload ⁠objectThe 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 itsservice
tolivedns
.Both properties
default
andrecord
are mutually exclusive and you must set one and one only.With the following properties:
Optional
- default ⁠boolean
Default: false
When set totrue
, 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", "KEY", "LOC", "MX", "NAPTR", "NS", "OPENPGPKEY", "PTR", "RP", "SPF", "SRV", "SSHFP", "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.
- name ⁠string
- object
- default ⁠boolean
- domain:mailboxes ⁠objectThis 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 ⁠stringThe mailbox login.
- login ⁠string
- object
- values ⁠array
- domain:nameservers ⁠objectThis 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
tolivedns
. - 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.
- addresses ⁠array[ string ]
- domain:webredirs ⁠objectThis 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 ⁠stringTarget URL.
Optional
- host ⁠stringSource 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 totrue
it will overwrite the record. Otherwise it will trigger an error. - protocol ⁠string
One of: "http", "https", "httpsonly"
Redirection protocol.
- type ⁠string
- object
- values ⁠array
- dns:records ⁠object
Example - update a template's payload:{ "payload": { "domain:nameservers": { "addresses": [], "service": "livedns" }, "dns:records": { "default": true } } }
- description ⁠string
Responses
204
403
Body
application/json
⁠objectWith the following properties:
- cause ⁠string
- code ⁠integer
- message ⁠string
- object ⁠string
401
Body
application/json
⁠objectWith the following properties:
- cause ⁠string
- code ⁠integer
- message ⁠string
- object ⁠string
403
Body
application/json
⁠objectWith 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 ⁠stringThe
Authorization
header must start withBearer
for access token, orApikey
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
- Authorization ⁠string
delete Delete a template ¶
Request
URI Parameters
- id ⁠stringTemplate ID.
- id ⁠string
Headers
Required
- Authorization ⁠stringThe
Authorization
header must start withBearer
for access token, orApikey
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
- Authorization ⁠string
Responses
204
403
Body
application/json
⁠objectWith the following properties:
- cause ⁠string
- code ⁠integer
- message ⁠string
- object ⁠string
401
Body
application/json
⁠objectWith the following properties:
- cause ⁠string
- code ⁠integer
- message ⁠string
- object ⁠string
403
Body
application/json
⁠objectWith 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 ⁠stringThe
Authorization
header must start withBearer
for access token, orApikey
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
- Authorization ⁠string
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 ⁠stringTemplate ID.
- id ⁠string
Headers
Required
- Authorization ⁠stringThe
Authorization
header must start withBearer
for access token, orApikey
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
- Authorization ⁠string
Body
application/json
⁠objectWith the following properties:
Required
- object_id ⁠stringThe 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, onlydomain
is available.
Example:{ "object_type": "domain", "object_id": "ba1167be-2f76-11e9-9dfb-00163ec4cb00" }
- object_id ⁠string
Responses
202
Headers
Optional
- Location ⁠string
Body
application/json
⁠objectWith the following properties:
- dispatch_href ⁠stringThe API URL to the operation being performed.
- message ⁠stringConfirmation 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 itsservice
tolivedns
.Both properties
default
andrecord
are mutually exclusive and you must set one and one only.With the following properties:
Optional
- default ⁠boolean
Default: false
When set totrue
, 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", "KEY", "LOC", "MX", "NAPTR", "NS", "OPENPGPKEY", "PTR", "RP", "SPF", "SRV", "SSHFP", "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.
- name ⁠string
- object
- default ⁠boolean
- domain:mailboxes ⁠objectThis 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 ⁠stringThe mailbox login.
- login ⁠string
- object
- values ⁠array
- domain:nameservers ⁠objectThis 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
tolivedns
. - 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.
- addresses ⁠array[ string ]
- domain:webredirs ⁠objectThis 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 ⁠stringTarget URL.
Optional
- host ⁠stringSource 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 totrue
it will overwrite the record. Otherwise it will trigger an error. - protocol ⁠string
One of: "http", "https", "httpsonly"
Redirection protocol.
- type ⁠string
- object
- values ⁠array
- dns:records ⁠object
- target_id ⁠stringThe ID of the object to which the template was applied.
- target_type ⁠string
One of: "domain"
- dispatch_href ⁠string
403
Body
application/json
⁠objectWith the following properties:
- cause ⁠string
- code ⁠integer
- message ⁠string
- object ⁠string
401
Body
application/json
⁠objectWith the following properties:
- cause ⁠string
- code ⁠integer
- message ⁠string
- object ⁠string
403
Body
application/json
⁠objectWith 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 ⁠stringThe
Authorization
header must start withBearer
for access token, orApikey
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
- Authorization ⁠string