Add subscribers directly from your website or app using the Contact API.
API Endpoint
POST https://your-maillayer-domain.com/api/lists/{listId}/contacts
Getting Your API Key
- Go to Contacts → select a list
- Click Settings → API
- Copy the API Key
Request Format
| Parameter | Type | Required |
|---|---|---|
apiKey | string | Yes |
email | string | Yes |
firstName | string | No |
lastName | string | No |
tags | array | No |
Example Request
curl -X POST "https://your-domain.com/api/lists/abc123/contacts" \
-H "Content-Type: application/json" \
-d '{
"apiKey": "list_abc123_xyz",
"email": "user@example.com",
"firstName": "John",
"tags": ["newsletter"]
}'
Response
Success:
{
"success": true,
"contact": {
"id": "contact_abc123",
"email": "user@example.com"
}
}
Error:
{
"success": false,
"error": "Invalid email format"
}
Domain Restrictions
Restrict which domains can use your API:
- Go to list settings → API
- Add Allowed Domains
- Save
Next: Teams — Team collaboration and roles
