curl --request POST \
--url https://api.mailglyph.com/contacts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "[email protected]",
"subscribed": true,
"data": {
"firstName": "John",
"lastName": "Doe",
"plan": "premium"
}
}
'{
"id": "<string>",
"email": "[email protected]",
"subscribed": true,
"data": {},
"status": "ACTIVE",
"expiresAt": "2023-11-07T05:31:56Z",
"projectId": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"_meta": {
"isNew": true,
"isUpdate": true
}
}{
"id": "<string>",
"email": "[email protected]",
"subscribed": true,
"data": {},
"status": "ACTIVE",
"expiresAt": "2023-11-07T05:31:56Z",
"projectId": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"_meta": {
"isNew": true,
"isUpdate": true
}
}Contacts
Create or update contact
Create a new contact or update existing (upsert by email)
POST
/
contacts
curl --request POST \
--url https://api.mailglyph.com/contacts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "[email protected]",
"subscribed": true,
"data": {
"firstName": "John",
"lastName": "Doe",
"plan": "premium"
}
}
'{
"id": "<string>",
"email": "[email protected]",
"subscribed": true,
"data": {},
"status": "ACTIVE",
"expiresAt": "2023-11-07T05:31:56Z",
"projectId": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"_meta": {
"isNew": true,
"isUpdate": true
}
}{
"id": "<string>",
"email": "[email protected]",
"subscribed": true,
"data": {},
"status": "ACTIVE",
"expiresAt": "2023-11-07T05:31:56Z",
"projectId": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"_meta": {
"isNew": true,
"isUpdate": true
}
}Authorizations
API Key authentication. Secret keys (sk_*) are required for all endpoints except /v1/track. Public keys (pk_*) only work with the /v1/track endpoint for client-side event tracking. Workspaces can have multiple active keys, and sender-domain operations enforce per-key domain scope when configured.
Body
application/json
Optional custom contact data fields. Choose Empty object if you do not want to send any example preset keys.
- Example object
- Empty object
Show child attributes
Show child attributes
Example:
{
"firstName": "John",
"lastName": "Doe",
"plan": "premium"
}
Response
Contact updated
Unique contact identifier
Contact email address
Subscription status
Custom contact data fields
Available options:
ACTIVE, PENDING Show child attributes
Show child attributes

