Domains API

List domains

GET /:account/domains

List domains in the account.

Parameters

Name Type Description
:account integer The account id

Example

List all domains in the account 1010:

curl  -H 'Authorization: Bearer <token>' \
      -H 'Accept: application/json' \
      https://api.dnsimple.com/v2/1010/domains

Response

Responds with HTTP 200.

{
  "data": [
    {
      "id": 1,
      "account_id": 1010,
      "registrant_id": null,
      "name": "example-alpha.com",
      "unicode_name": "example-alpha.com",
      "token": "domain-token",
      "state": "hosted",
      "auto_renew": false,
      "private_whois": false,
      "expires_on": null,
      "created_at": "2014-12-06T15:56:55Z",
      "updated_at": "2015-12-09T00:20:56Z"
    },
    {
      "id": 2,
      "account_id": 1010,
      "registrant_id": 21,
      "name": "example-beta.com",
      "unicode_name": "example-beta.com",
      "token": "domain-token",
      "state": "registered",
      "auto_renew": false,
      "private_whois": false,
      "expires_on": "2015-12-06",
      "created_at": "2014-12-06T15:46:52Z",
      "updated_at": "2015-12-09T00:20:53Z"
    }
  ],
  "pagination": {
    "current_page": 1,
    "per_page": 30,
    "total_entries": 2,
    "total_pages": 1
  }
}

Filters

Name Description
:name_like Only include domains containing given string
:registrant_id Only include domains containing given registrant ID

Example

List all domains in the account 1010 that have name matching "example":

curl  -H 'Authorization: Bearer <token>' \
      -H 'Accept: application/json' \
      https://api.dnsimple.com/v2/1010/domains?name_like=example

Sorting

For general information about sorting, please refer to the main guide.

Name Description
id Sort domains by ID
name Sort domains by name (alphabetical order)
expires_on Sort domains by expiration date

The default sorting policy is by ascending name.

Create a domain

POST /:account/domains

Parameters

Name Type Description
:account integer The account id

Example

Create a domain in the account 1010:

curl  -H 'Authorization: Bearer <token>' \
      -H 'Accept: application/json' \
      -H 'Content-Type: application/json' \
      -X POST \
      -d '<json>' \
      https://api.dnsimple.com/v2/1010/domains

Input

Name Type Description
name string Required.
Example
{
  "name": "example.com"
}

Response

Responds with HTTP 201 on success, renders the domain.

{
  "data": {
    "id": 1,
    "account_id": 1010,
    "registrant_id": null,
    "name": "example-alpha.com",
    "unicode_name": "example-alpha.com",
    "token": "domain-token",
    "state": "hosted",
    "auto_renew": false,
    "private_whois": false,
    "expires_on": null,
    "created_at": "2014-12-06T15:56:55Z",
    "updated_at": "2015-12-09T00:20:56Z"
  }
}

Responds with HTTP 400 if bad request.

Responds with HTTP 400 if the validation fails.

Get a domain

GET /:account/domains/:domain

Parameters

Name Type Description
:account integer The account id
:domain string, integer The domain name or id

Example

Get the domain with ID 1 in the account 1010:

curl  -H 'Authorization: Bearer <token>' \
      -H 'Accept: application/json' \
      https://api.dnsimple.com/v2/1010/domains/1

Get the domain example.com in the account 1010:

curl  -H 'Authorization: Bearer <token>' \
      -H 'Accept: application/json' \
      https://api.dnsimple.com/v2/1010/domains/example.com

Response

Responds with HTTP 200, renders the domain.

{
  "data": {
    "id": 1,
    "account_id": 1010,
    "registrant_id": null,
    "name": "example-alpha.com",
    "unicode_name": "example-alpha.com",
    "token": "domain-token",
    "state": "hosted",
    "auto_renew": false,
    "private_whois": false,
    "expires_on": null,
    "created_at": "2014-12-06T15:56:55Z",
    "updated_at": "2015-12-09T00:20:56Z"
  }
}

Delete a domain

DELETE /:account/domains/:domain

Delete the domain in the account.

For domains which are registered with DNSimple, this will not delete the domain from the registry or perform a refund.

Parameters

Name Type Description
:account integer The account id
:domain string, integer The domain name or id

Example

Delete the domain with ID 1 in the account 1010:

curl  -H 'Authorization: Bearer <token>' \
      -H 'Accept: application/json' \
      -H 'Content-Type: application/json' \
      -X DELETE \
      https://api.dnsimple.com/v2/1010/domains/1

Delete the domain example.com in the account 1010:

curl  -H 'Authorization: Bearer <token>' \
      -H 'Accept: application/json' \
      -H 'Content-Type: application/json' \
      -X DELETE \
      https://api.dnsimple.com/v2/1010/domains/example.com

Response

Responds with HTTP 204 on success.

Reset a domain token

POST /:account/domains/:domain/token

Parameters

Name Type Description
:account integer The account id
:domain string, integer The domain name or id

Example

Reset the token for the domain example.com in the account 1010:

curl  -H 'Authorization: Bearer <token>' \
      -H 'Accept: application/json' \
      -H 'Content-Type: application/json' \
      -X POST \
      -d '{}' \
      https://api.dnsimple.com/v2/1010/domains/example.com/token

Input

Empty.

Response

Responds with HTTP 201 on success.

{
  "data": {
    "id": 1,
    "account_id": 1010,
    "registrant_id": null,
    "name": "example-alpha.com",
    "unicode_name": "example-alpha.com",
    "token": "domain-token",
    "state": "hosted",
    "auto_renew": false,
    "private_whois": false,
    "expires_on": null,
    "created_at": "2014-12-06T15:56:55Z",
    "updated_at": "2015-12-09T00:20:56Z"
  }
}

Responds with HTTP 400 if bad request.