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

  1. Go to Contacts → select a list
  2. Click SettingsAPI
  3. Copy the API Key

Request Format

ParameterTypeRequired
apiKeystringYes
emailstringYes
firstNamestringNo
lastNamestringNo
tagsarrayNo

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:

  1. Go to list settings → API
  2. Add Allowed Domains
  3. Save

Next: Teams — Team collaboration and roles