REST APIContacts

Contacts Endpoints

Create, update, delete, and manage contacts in your audiences.

POST/api/contacts

Create Contact

Create a new contact in an audience.

Request Body

FieldTypeRequiredDescription
emailstringYesContact email address
audienceIdstringYesID of the audience to add contact to
firstNamestringNoContact's first name
lastNamestringNoContact's last name
phonestringNoPhone number
statusstringNosubscribed, unsubscribed, pending, bounced
tagsstring[]NoArray of tags
customFieldsobjectNoCustom field values

Example Request

curlTerminal
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
curl -X POST https://api.metigan.com/api/contacts \
  -H "x-api-key: your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "john@example.com",
    "audienceId": "aud_abc123",
    "firstName": "John",
    "lastName": "Doe",
    "phone": "+1234567890",
    "status": "subscribed",
    "tags": ["customer", "newsletter"],
    "customFields": {
      "company": "Acme Inc",
      "role": "Developer"
    }
  }'

Response

201 CreatedJSON
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{
  "success": true,
  "data": {
    "id": "con_xyz789",
    "email": "john@example.com",
    "firstName": "John",
    "lastName": "Doe",
    "phone": "+1234567890",
    "status": "subscribed",
    "audienceId": "aud_abc123",
    "tags": ["customer", "newsletter"],
    "customFields": {
      "company": "Acme Inc",
      "role": "Developer"
    },
    "createdAt": "2024-01-19T10:30:00Z",
    "updatedAt": "2024-01-19T10:30:00Z"
  }
}
GET/api/contacts

List Contacts

Retrieve a paginated list of contacts with optional filters.

Query Parameters

ParameterTypeDescription
audienceIdstringFilter by audience ID
statusstringFilter by status
tagstringFilter by tag
searchstringSearch by email or name
pagenumberPage number (default: 1)
limitnumberItems per page (default: 50, max: 100)

Example Request

curlTerminal
1
2
curl -X GET "https://api.metigan.com/api/contacts?audienceId=aud_abc123&status=subscribed&page=1&limit=50" \
  -H "x-api-key: your_api_key"

Response

200 OKJSON
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{
  "success": true,
  "contacts": [
    {
      "id": "con_xyz789",
      "email": "john@example.com",
      "firstName": "John",
      "lastName": "Doe",
      "status": "subscribed",
      "audienceId": "aud_abc123",
      "tags": ["customer"],
      "createdAt": "2024-01-19T10:30:00Z"
    }
  ],
  "pagination": {
    "total": 1234,
    "page": 1,
    "limit": 50,
    "pages": 25
  }
}
GET/api/contacts/:id

Get Contact

Retrieve a single contact by ID.

Example Request

curlTerminal
1
2
curl -X GET https://api.metigan.com/api/contacts/con_xyz789 \
  -H "x-api-key: your_api_key"

Response

200 OKJSON
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{
  "success": true,
  "data": {
    "id": "con_xyz789",
    "email": "john@example.com",
    "firstName": "John",
    "lastName": "Doe",
    "phone": "+1234567890",
    "status": "subscribed",
    "audienceId": "aud_abc123",
    "tags": ["customer", "newsletter"],
    "customFields": {
      "company": "Acme Inc"
    },
    "createdAt": "2024-01-19T10:30:00Z",
    "updatedAt": "2024-01-19T10:30:00Z",
    "lastActivityAt": "2024-01-19T12:00:00Z"
  }
}
GET/api/contacts/email/:email

Get Contact by Email

Retrieve a contact by email address within an audience.

Example Request

curlTerminal
1
2
curl -X GET "https://api.metigan.com/api/contacts/email/john@example.com?audienceId=aud_abc123" \
  -H "x-api-key: your_api_key"
PATCH/api/contacts/:id

Update Contact

Update an existing contact's information.

Request Body

Only include fields you want to update.

FieldTypeDescription
firstNamestringFirst name
lastNamestringLast name
phonestringPhone number
statusstringContact status
tagsstring[]Replace all tags
customFieldsobjectCustom field values

Example Request

curlTerminal
1
2
3
4
5
6
7
8
9
10
curl -X PATCH https://api.metigan.com/api/contacts/con_xyz789 \
  -H "x-api-key: your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "firstName": "Johnny",
    "tags": ["customer", "vip", "newsletter"],
    "customFields": {
      "company": "New Company Inc"
    }
  }'

Response

200 OKJSON
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{
  "success": true,
  "data": {
    "id": "con_xyz789",
    "email": "john@example.com",
    "firstName": "Johnny",
    "lastName": "Doe",
    "status": "subscribed",
    "tags": ["customer", "vip", "newsletter"],
    "customFields": {
      "company": "New Company Inc"
    },
    "updatedAt": "2024-01-19T14:00:00Z"
  }
}
DELETE/api/contacts/:id

Delete Contact

Permanently delete a contact.

Irreversible Action

This action cannot be undone. Consider changing the contact's status to "unsubscribed" instead.

Example Request

curlTerminal
1
2
curl -X DELETE https://api.metigan.com/api/contacts/con_xyz789 \
  -H "x-api-key: your_api_key"

Response

200 OKJSON
1
2
3
4
{
  "success": true,
  "message": "Contact deleted successfully"
}
POST/api/contacts/bulk

Bulk Import Contacts

Import multiple contacts at once. Duplicates are automatically handled.

Request Body

FieldTypeDescription
audienceIdstringTarget audience ID
contactsarrayArray of contact objects (max 1000)
skipDuplicatesbooleanSkip instead of updating duplicates

Example Request

curlTerminal
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
curl -X POST https://api.metigan.com/api/contacts/bulk \
  -H "x-api-key: your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "audienceId": "aud_abc123",
    "skipDuplicates": true,
    "contacts": [
      {
        "email": "user1@example.com",
        "firstName": "User",
        "lastName": "One",
        "tags": ["import"]
      },
      {
        "email": "user2@example.com",
        "firstName": "User",
        "lastName": "Two",
        "tags": ["import"]
      }
    ]
  }'

Response

200 OKJSON
1
2
3
4
5
6
7
{
  "success": true,
  "imported": 2,
  "failed": 0,
  "skipped": 0,
  "errors": []
}

Contact Statuses

Available contact status values:

StatusDescription
subscribedActive subscriber, can receive emails
pendingAwaiting confirmation (double opt-in)
unsubscribedOpted out, will not receive emails
bouncedEmail bounced, delivery failed
complainedMarked email as spam