Contact Fields
Define custom contact fields
Manage contact fields
Get all Contact Fields existing in your account
Pass the API token in the Api-Token
OK.
Personalize your campaigns by adding a merge tag. This field will be replaced with unique contact details for each recipient.
Returns unauthorized error message. Check your credentials.
Returns forbidden error message. Check your permissions.
Rate limit exceeded for the current account.
Internal error. Retry later or contact support.
curl -X GET https://mailtrap.io/api/contacts/fields \
-H 'Authorization: Bearer YOUR_API_KEY'
[
{
"id": 6730,
"name": "First name",
"data_type": "text",
"merge_tag": "first_name"
},
{
"id": 6731,
"name": "Birthdate",
"data_type": "date",
"merge_tag": "birthdate"
},
{
"id": 6732,
"name": "Cats count",
"data_type": "integer",
"merge_tag": "cats_count"
}
]Create new Contact Fields. Please note, you can have up to 40 fields.
Pass the API token in the Api-Token
Personalize your campaigns by adding a merge tag. This field will be replaced with unique contact details for each recipient.
Contact Field Created.
Personalize your campaigns by adding a merge tag. This field will be replaced with unique contact details for each recipient.
Returns unauthorized error message. Check your credentials.
Returns forbidden error message. Check your permissions.
Returns validation errors.
Rate limit exceeded for the current account.
Internal error. Retry later or contact support.
curl -X POST https://mailtrap.io/api/contacts/fields \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"name": "Company", "data_type": "text", "merge_tag": "company"}'
{
"id": 26730,
"name": "My Contact Field",
"data_type": "text",
"merge_tag": "my_contact_field"
}Get a contact Field by ID
Pass the API token in the Api-Token
Unique Contact Field ID
3229Returns attributes of the contact field.
Personalize your campaigns by adding a merge tag. This field will be replaced with unique contact details for each recipient.
Returns unauthorized error message. Check your credentials.
Returns forbidden error message. Check your permissions.
Resource not found
Rate limit exceeded for the current account.
Internal error. Retry later or contact support.
curl -X GET https://mailtrap.io/api/contacts/fields/{field_id} \
-H 'Authorization: Bearer YOUR_API_KEY'
{
"id": 26730,
"name": "My Contact Field",
"data_type": "text",
"merge_tag": "my_contact_field"
}Delete existing Contact Field Please, note, you cannot delete a Contact Field which is used in Automations, Email Campaigns (started or scheduled), and in conditions of Contact Segments (you'll see the corresponding error)
Pass the API token in the Api-Token
Unique Contact Field ID
3229Contact Field successfully deleted
No content
Returns unauthorized error message. Check your credentials.
Returns forbidden error message. Check your permissions.
Resource not found
Returns validation errors.
Rate limit exceeded for the current account.
Internal error. Retry later or contact support.
curl -X DELETE https://mailtrap.io/api/contacts/fields/{field_id} \
-H 'Authorization: Bearer YOUR_API_KEY'
No content
Update existing Contact Field. Please note, you cannot change data_type of the field.
Pass the API token in the Api-Token
Unique Contact Field ID
3229Personalize your campaigns by adding a merge tag. This field will be replaced with unique contact details for each recipient.
OK.
Personalize your campaigns by adding a merge tag. This field will be replaced with unique contact details for each recipient.
Returns unauthorized error message. Check your credentials.
Returns forbidden error message. Check your permissions.
Resource not found
Returns validation errors.
Rate limit exceeded for the current account.
Internal error. Retry later or contact support.
curl -X PATCH https://mailtrap.io/api/contacts/fields/{field_id} \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"name": "Updated Name", "merge_tag": "updated_name"}'
{
"id": 6730,
"name": "Updated name",
"data_type": "text",
"merge_tag": "updated_name"
}Last updated
Was this helpful?

