> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.trustmary.com/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# Contacts (developers)

Contacts are used to store information about your customers or employees, such as names, emails, or custom IDs. Contacts can be added to different lists, and one contact can exist in multiple lists at the same time (duplicate contacts are merged when importing). You can send survey invitations to contact lists and track individual contacts answers.

# Contact object

### Attributes

**id** string
* Unique identifier for the object.
**email** string (*required*)
* Contact email address. Requires a valid email.
**eid** string
* External identifier, use your CRM/ERP contact identifier to sync data back to your system
**name** string
* Contact full name, first name and last name
**phone** string
* Contact phone number with area code.
**company** string
* Contact company name.
**type** string
* Type of contact. Allowed values: customer, employee
**status** string
* Deliverability status of the contact. 
* Allowed values: unsubscribed, unapproved_country_code, missing_contact_info, error, complaint, bounce, active. If status is other than active no new messages can be sent to the contact.
**field_YOURFIELDNAME** string
* Any number of custom fields can be added. Custom fields need to be added to Trustmary before they can be used. See our article about [custom fields](https://help.trustmary.com/en/article/how-to-create-custom-fields-1enkkw9/) for more information.
**created_at** ISO 8601 with timezone
* Time contact was created.
**updated_at** ISO 8601 with timezone
* Time of last action performed on the contact object.
**deleted_at** ISO 8601 with timezone or null
* If contact was deleted, time of the last deletion.

### Example

```json
{ 
  "id": "gkggiGLXH",
  "email": "contact.email@example.com",
  "name": "Contact Name",
  "phone": "+358501234567",
  "company": "Company Ltd",
  "created_at": "2020-10-22T14:55:52.638Z",
  "updated_at": "2020-10-22T14:55:52.638Z",
  "deleted_at": null,
  "last_action": null,
  "status": "active",
  "type": "customer" 
}
```

# Creating a Contact

```json
POST /contacts
```

### Body attributes

**email** string ( *required*)
* Contact email address. Requires a valid email.
**name** string
* Contact name.
**eid** string
* External identifier, use your CRM/ERP contact identifier to sync data back to your system.
**name** string
* Contact full name, first name and last name
**phone** string
* Contact phone number with area code.
**company** string
* Contact company name.
**field_YOURFIELDNAME** string
* Any number of custom fields can be added. Custom fields need to be added to Trustmary before they can be used. See our article about [custom fields](https://help.trustmary.com/en/article/how-to-create-custom-fields-1enkkw9/) for more information.
**type** string
* Type of contact. Allowed values: customer, employee (will default to customer)
**addToLists** array
* Array of list ids. You can get available list IDs from the app, by opening a list and scrolling down to the bottom where an ID field is located. A list will not be updated if the contact has been added to it earlier.

###### Example

```json
{  
  "email": "contact.email@example.com",
  "name": "Contact Name",
  "phone": "+358501234567",
  "company": "Company Ltd",
  "type": "customer",
  "addToLists": ["MDyzFBay3"]
}
```

### Returning

###### Attributes

**contact** contact_object
* Contains the created/updated contact object.
**action** string
* If the email address was unique action will be IMPORT_CREATE, otherwise corresponding contact was updated and the action will be IMPORT_UPDATE.
**listUpdate** integer
* Number of lists that the contact was added to. If the contact is already on a list, it will not be updated.

###### Example

```json
{ 
  "contact": contact_object,
  "action" : "IMPORT_CREATE",
  "listsUpdated": 1 
}
```

# Getting contacts

### Query parameters

**email** string (required)
* Contact email address. If an email address is given, it will return an array with one contact_object, with corresponding email.
**offset** integer
* This endpoint gives a maximum of 1000 contacts per request. To request the next 1000 contacts, give offset parameter with value 1000, after that 2000 etc.

### Returning

# Deleting a Contact

```json
DELETE /contacts
```

```json
{  
  "email": "contact.email@example.com"
}
```
