Skip to main content
POST
/
v1
/
contacts
/
imports
cURL
curl -X POST https://api.migma.ai/v1/contacts/imports \
  -H "Authorization: Bearer $MIGMA_API_KEY" \
  -F "file=@contacts.csv" \
  -F "projectId=PROJECT_ID" \
  -F 'columnMap={"email":"Email","firstName":"First Name"}' \
  -F "onConflict=upsert" \
  -F "tags=newsletter,launch"
{
  "success": true,
  "data": {
    "object": "contact_import",
    "id": "<string>",
    "status": "processing"
  },
  "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 → Developers → API Keys.

Body

multipart/form-data
file
file
required

CSV file to import

projectId
string
required

Project ID

columnMap
string
required

JSON string mapping subscriber fields to CSV header names. Only email is required. Supported keys: email, firstName, lastName, name, phone, country, language, and customFields (an object mapping each custom field key to its CSV header). Example: {"email":"Email","firstName":"First Name","customFields":{"plan":"Plan"}}.

onConflict
enum<string>
default:upsert

How to handle rows whose email already exists.

Available options:
skip,
upsert
delimiter
string
default:,

CSV field delimiter.

tags
string

Tag names to apply to every imported contact, as a JSON array (e.g. ["newsletter"]) or a comma-separated string. Tags are created if they do not exist.

Response

Import accepted for background processing

success
boolean
required
data
object
error
string | null