Skip to main content
PATCH
/
v1
/
contacts
/
{id}
Node.js SDK
import Migma from 'migma';

const migma = new Migma('YOUR_API_KEY');

const { data, error } = await migma.contacts.update('CONTACT_ID', {
  firstName: 'John',
  lastName: 'Smith',
  projectId: 'PROJECT_ID'
});
{
  "success": true,
  "data": {
    "id": "<string>",
    "email": "[email protected]",
    "firstName": "<string>",
    "lastName": "<string>",
    "country": "<string>",
    "language": "<string>",
    "tags": [
      "<string>"
    ],
    "customFields": {},
    "status": "active",
    "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.

Path Parameters

id
string
required

Contact ID (MongoDB ObjectId)

Body

application/json
projectId
string
required
firstName
string
lastName
string
country
string | null

ISO 3166-1 alpha-2 country code

language
string | null

Language code (ISO 639-1 or BCP 47)

tags
string[]

Tag names (tags will be auto-created if they don't exist)

customFields
object
status
enum<string>
Available options:
subscribed,
unsubscribed,
bounced,
non-subscribed

Response

Contact updated

success
boolean
required
data
object
error
string | null