Skip to main content
POST
/
v1
/
contacts
Node.js SDK
import Migma from 'migma';

const migma = new Migma('YOUR_API_KEY');

const { data, error } = await migma.contacts.create({
  email: 'john@example.com',
  firstName: 'John',
  lastName: 'Smith',
  status: 'subscribed',
  projectId: 'PROJECT_ID'
});
{
  "success": true,
  "data": {
    "id": "<string>",
    "email": "jsmith@example.com",
    "firstName": "<string>",
    "lastName": "<string>",
    "phone": "<string>",
    "country": "<string>",
    "language": "<string>",
    "tags": [
      "<string>"
    ],
    "customFields": {},
    "createdAt": "2023-11-07T05:31:56Z",
    "updatedAt": "2023-11-07T05:31:56Z"
  },
  "error": "<string>"
}

Authorizations

Authorization
string
header
required

API key authentication. Use 'Authorization: Bearer YOUR_API_KEY' where YOUR_API_KEY is obtained from the Migma dashboard under Settings → API Integration.

Body

application/json
email
string<email>
required
projectId
string
required
firstName
string
lastName
string
phone
string

Phone number (free-form, max 30 chars)

Maximum string length: 30
country
string
language
string
tags
string[]
customFields
object
status
enum<string>

Contact subscription status. Defaults to subscribed.

Available options:
subscribed,
unsubscribed,
bounced,
non-subscribed

Response

Contact created

success
boolean
required
data
object
error
string | null