Contacts API

Contact attributes

Please refer to the definition of the Contact data type in our OpenAPI documentation.

List contacts

GET /:account/contacts

List contacts in the account.

Parameters

Name Type Description
:account integer The account id

Sorting

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

Name Description
id Sort contacts by ID
label Sort contacts by label (alphabetical order)
email Sort contacts by email (alphabetical order)

The default sorting policy is by ascending id.

Example

List all contacts in the account 1010:

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

Response

Responds with HTTP 200 on success.

{
  "data": [
    {
      "id": 1,
      "account_id": 1010,
      "label": "Default",
      "first_name": "First",
      "last_name": "User",
      "job_title": "CEO",
      "organization_name": "Awesome Company",
      "email": "first@example.com",
      "phone": "+18001234567",
      "fax": "+18011234567",
      "address1": "Italian Street, 10",
      "address2": "",
      "city": "Roma",
      "state_province": "RM",
      "postal_code": "00100",
      "country": "IT",
      "created_at": "2013-11-08T17:23:15Z",
      "updated_at": "2015-01-08T21:30:50Z"
    },
    {
      "id": 2,
      "account_id": 1010,
      "label": "",
      "first_name": "Second",
      "last_name": "User",
      "job_title": "",
      "organization_name": "",
      "email": "second@example.com",
      "phone": "+18881234567",
      "fax": "",
      "address1": "French Street",
      "address2": "c/o Someone",
      "city": "Paris",
      "state_province": "XY",
      "postal_code": "00200",
      "country": "FR",
      "created_at": "2014-12-06T15:46:18Z",
      "updated_at": "2014-12-06T15:46:18Z"
    }
  ],
  "pagination": {
    "current_page": 1,
    "per_page": 30,
    "total_entries": 2,
    "total_pages": 1
  }
}

Errors

Responds with HTTP 401 in case of case of authentication issues.

Create a contact

POST /:account/contacts

Parameters

Name Type Description
:account integer The account id

Example

Create a contact 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/contacts

Input

Name Type Description
label string  
first_name string Required.
last_name string Required.
organization_name string The company name. If the organization_name is specified, then you must also include job_title.
job_title string  
address1 string Required.
address2 string  
city string Required.
state_province string Required.
postal_code string Required.
country string Required. The ISO 3166-1 alpha-2 country code, upper case (eg. DE).
email string Required.
phone string Required.
fax string  
Example
{
  "label": "Default",
  "first_name": "First",
  "last_name": "User",
  "job_title": "CEO",
  "organization_name": "Awesome Company",
  "email": "first@example.com",
  "phone": "+18001234567",
  "fax": "+18011234567",
  "address1": "Italian Street, 10",
  "city": "Roma",
  "state_province": "RM",
  "postal_code": "00100",
  "country": "IT"
}

Response

Responds with HTTP 201 on success.

{
  "data": {
    "id": 1,
    "account_id": 1010,
    "label": "Default",
    "first_name": "First",
    "last_name": "User",
    "job_title": "CEO",
    "organization_name": "Awesome Company",
    "email": "first@example.com",
    "phone": "+18001234567",
    "fax": "+18011234567",
    "address1": "Italian Street, 10",
    "address2": "",
    "city": "Roma",
    "state_province": "RM",
    "postal_code": "00100",
    "country": "IT",
    "created_at": "2016-01-19T20:50:26Z",
    "updated_at": "2016-01-19T20:50:26Z"
  }
}

Errors

Responds with HTTP 400 if the contact cannot be created.

Responds with HTTP 401 in case of case of authentication issues.

Retrieve a contact

GET /:account/contacts/:contact

Parameters

Name Type Description
:account integer The account id
:contact integer The contact id

Example

Get the contact with ID 1 in the account 1010:

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

Response

Responds with HTTP 200 on success.

{
  "data": {
    "id": 1,
    "account_id": 1010,
    "label": "Default",
    "first_name": "First",
    "last_name": "User",
    "job_title": "CEO",
    "organization_name": "Awesome Company",
    "email": "first@example.com",
    "phone": "+18001234567",
    "fax": "+18011234567",
    "address1": "Italian Street, 10",
    "address2": "",
    "city": "Roma",
    "state_province": "RM",
    "postal_code": "00100",
    "country": "IT",
    "created_at": "2016-01-19T20:50:26Z",
    "updated_at": "2016-01-19T20:50:26Z"
  }
}

Errors

Responds with HTTP 401 in case of case of authentication issues.

Update a contact

PATCH /:account/contacts/:contact

Parameters

Name Type Description
:account integer The account id
:contact integer The contact id

Example

Update the contact with ID 1 in the account 1010:

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

Input

See create.

Response

Responds with HTTP 200 on success.

{
  "data": {
    "id": 1,
    "account_id": 1010,
    "label": "Default",
    "first_name": "First",
    "last_name": "User",
    "job_title": "CEO",
    "organization_name": "Awesome Company",
    "email": "first@example.com",
    "phone": "+18001234567",
    "fax": "+18011234567",
    "address1": "Italian Street, 10",
    "address2": "",
    "city": "Roma",
    "state_province": "RM",
    "postal_code": "00100",
    "country": "IT",
    "created_at": "2016-01-19T20:50:26Z",
    "updated_at": "2016-01-19T20:50:26Z"
  }
}

Errors

Responds with HTTP 400 if the contact cannot be updated.

Responds with HTTP 401 in case of case of authentication issues.

Delete a contact

DELETE /:account/contacts/:contact

Parameters

Name Type Description
:account integer The account id
:contact integer The contact id

Example

Delete the contact 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/contacts/1

Response

Responds with HTTP 204 on success.

{
  "message": "The contact cannot be deleted because it's currently in use"
}

Errors

Responds with HTTP 400 if the contact cannot be deleted.

Responds with HTTP 401 in case of case of authentication issues.