Email forwards API

List email forwards

GET /:account/domains/:domain/email_forwards

List email forwards for the domain in the account.

Parameters

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

Example

List all email forwards for 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/email_forwards

Response

Responds with HTTP 200.

{
  "data": [
    {
      "id": 17702,
      "domain_id": 228963,
      "from": ".*@a-domain.com",
      "to": "jane.smith@example.com",
      "created_at": "2016-02-04T13:59:29Z",
      "updated_at": "2016-02-04T13:59:29Z"
    },
    {
      "id": 17703,
      "domain_id": 228963,
      "from": "john@a-domain.com",
      "to": "john@example.com",
      "created_at": "2016-02-04T14:07:13Z",
      "updated_at": "2016-02-04T14:07:13Z"
    }
  ],
  "pagination": {
    "current_page": 1,
    "per_page": 30,
    "total_entries": 2,
    "total_pages": 1
  }
}

Sorting

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

Name Description
id Sort email forwards by ID
from Sort email forwards by sender (alphabetical order)
to Sort email forwards by recipient (alphabetical order)

The default sorting policy is by ascending id.

Create an email forward

POST /:account/domains/:domain/email_forwards

Parameters

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

Example

Create an email forward under 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 '<json>' \
      https://api.dnsimple.com/v2/1010/domains/example.com/email_forwards

Input

Name Type Description
from string Required.
to email Required.
Example
{
  "from": "jim@a-domain.com",
  "to": "jim@another.com"
}

Response

Responds with HTTP 201 on success, renders the email forward.

{
  "data": {
    "id": 17706,
    "domain_id": 228963,
    "from": "jim@a-domain.com",
    "to": "jim@another.com",
    "created_at": "2016-02-04T14:26:50Z",
    "updated_at": "2016-02-04T14:26:50Z"
  }
}

Responds with HTTP 400 if bad request.

Responds with HTTP 400 if the validation fails.

Get an email forward

GET /:account/domains/:domain/email_forward/:email_forward

Parameters

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

Example

Get the email forward with the ID 1 in 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/email_forwards/1

Response

Responds with HTTP 200, renders the email forward.

{
  "data": {
    "id": 17706,
    "domain_id": 228963,
    "from": "jim@a-domain.com",
    "to": "jim@another.com",
    "created_at": "2016-02-04T14:26:50Z",
    "updated_at": "2016-02-04T14:26:50Z"
  }
}

Delete an email forward

DELETE /domains/:domain/email_forwards/:email_forward

Delete the email forward from the domain.

Parameters

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

Example

Delete the email forward with ID 1 under 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/email_forwards/1

Response

Responds with HTTP 204 on success.