Skip to Content

Start or resume a list migration

The complete encoded JSON request, including new-start metadata, must not exceed 3000000 bytes.

POST
/v1/contacts/imports

The complete encoded JSON request, including new-start metadata, must not exceed 3000000 bytes. Admits a durable import using the preview hash and an Idempotency-Key header, or resumes the same persisted input at its committed cursor. The header is required for mode:new and optional for mode:resume. Only mode:new supports idempotent replay. Resume uses expectedGeneration and must not be automatically retried; read getImportJob after an ambiguous response. Imports never restore an existing unsubscribe, suppression or bounce. Imported suppressions use the contact's namespace. Namespace-scoped credentials import contacts and restrictions only into their own namespace; organization-level suppressions protect every namespace. New active contacts are billable and normal contact events apply.

Authorization

apiKey
headerx-api-key<token>

Header Parameters

idempotency-key?string
Length1 <= length <= 255

Request Body

application/json
  1. body
mode*"new"
Value in"new"
input*
planHash*string

Response Body

Success

application/json
  1. response
id*ContactImportJobId
Match^cimport_[0-9a-hjkmnp-tv-z]{16,24}$
namespaceId*|null
topicId*TopicId
Match^tpc_[0-9a-hjkmnp-tv-z]{16,24}$
preset*string
Value in"beehiiv""substack""kit""mailchimp"
status*string
Value in"queued""running""finalizing""completed""failed"
generation*integer
Range0 <= value <= 9007199254740991
counts*
processedRows*integer
Range0 <= value <= 9007199254740991
totalRows*integer
Range0 <= value <= 9007199254740991
createdAt*string
startedAt*string|null
updatedAt*string
completedAt*string|null
failure*|null
resumable*boolean
Example Request
import { createClient } from "samva";

const samva = createClient({ apiKey: process.env.SAMVA_API_KEY! });

const result = await samva.contacts.startImport({
  "mode": "new",
  "input": {
    "preset": "beehiiv",
    "topicId": "example",
    "files": [
      {
        "name": "example",
        "csv": "example"
      }
    ]
  },
  "planHash": "example"
});
Example Response
{
  "id": "string",
  "namespaceId": "string",
  "topicId": "string",
  "preset": "beehiiv",
  "status": "queued",
  "generation": 0,
  "counts": {
    "totalRows": 0,
    "uniqueAddresses": 0,
    "subscribed": 0,
    "unsubscribed": 0,
    "suppressed": 0,
    "skipped": 0,
    "conflicts": 0,
    "created": 0,
    "existing": 0
  },
  "processedRows": 0,
  "totalRows": 0,
  "createdAt": "string",
  "startedAt": "string",
  "updatedAt": "string",
  "completedAt": "string",
  "failure": {
    "code": "string",
    "message": "string",
    "retryable": true
  },
  "resumable": true
}

Related documentation