Skip to main content
Base path: /contact/ingestion

Overview

The contact ingestion API allows bulk importing contacts from CSV or Excel files. The flow is:
  1. Upload - Parse file, specify if header row exists, create session
  2. Validate - Apply column mappings and validate all rows
  3. Paginate - Fetch validation results page by page
  4. Execute - Import valid rows, get failed rows CSV
Sessions expire after 30 minutes.

Types

Mappable Fields

Standard Contact Fields

Custom Attributes

Map to custom attributes using the custom. prefix:
Custom attribute values are validated against their defined type:
  • text - String value
  • number - Numeric value
  • boolean - true/false (accepts: true, false, 1, 0, yes, no)
  • date - ISO date string
  • phone_number - Valid phone format
  • email - Valid email format
  • url - Valid URL format

Phone Normalization (Morocco)

Phone numbers are validated and normalized to the Morocco international format (+212XXXXXXXXX). Accepted input formats: Validation rules:
  • Must be a valid Morocco phone number
  • After normalization, must match: +212[5|6|7|8]XXXXXXXX
  • The digit after 212 must be 5, 6, 7, or 8 (Morocco phone prefixes)
Invalid examples:
  • +1234567890 - Non-Morocco country code
  • +212312345678 - Invalid prefix (3 is not a valid prefix)
  • 12345 - Too short
International numbers will be supported in a future update.

Upload a CSV or Excel file to start ingestion

Limits:
  • Maximum 100,000 rows per file
  • Maximum 100 preview rows
  • Supported formats: CSV, XLSX, XLS
Header Row Behavior:
  • When hasHeaderRow=false: Columns are named “Column 0”, “Column 1”, etc. Preview includes all rows.
  • When hasHeaderRow=true: Columns use actual header values from row 0. Preview excludes the header row.
Audience Linking:
  • If audienceId is provided, the audience is validated immediately (fail-fast)
  • If the audience doesn’t exist, the upload fails with 404 error
  • The audience ID is stored in the session and used during execute phase
Example (without header row):
Example (with header row):
Example (with audience linking):

Validate data with column mappings

Response:

Get paginated validation results after validation is comp…

Query Parameters:

Execute the import of valid contacts

Behavior:
  • Only valid rows are imported
  • Existing contacts (matched by phone) are updated
  • New contacts are created
  • Invalid rows are included in the failed CSV
  • Session is marked as executing during import to prevent concurrent requests
  • Session is marked as executed after completion (cannot be executed again)
  • If audienceId was provided at upload, contacts are linked to the audience after import
  • Audience linking is non-fatal: if linking fails, the import still succeeds (contacts are created/updated)
Response:

Failed Rows CSV Format

When import has failures, a CSV file is generated with:
  • All original columns (same order as uploaded file)
  • Additional _error column at the end with failure reason
The presigned URL is valid for 1 hour.

Error Responses

All error responses follow this format:
Common Errors: