InyokeDocs
Imports

Start an import

POST
/campaigns/{campaignId}/imports

Starts the website's own import of an uploaded file onto a campaign, in the background; watch it with GET /imports/{importId}. Imports run one at a time in an agency, so a start while another runs answers 409 import_running: retry it later with the same Idempotency-Key. Needs the leads:write scope and the Import leads permission.

Authorization

headerAuthorizationBearer <sk_live_...>

Your API key in an Authorization header: Authorization: Bearer sk_live_.... When a request carries a Bearer key and an x-api-key header, the Bearer key is used.

Path Parameters

campaignId*string

A campaign id from GET /campaigns. A campaign the key's holder can't reach, or an archived one, answers 404, the same as one that doesn't exist.

Header Parameters

Idempotency-Key?string

A value of your choosing, new for each file (a UUID is right), and the same when you retry. A retry of the same file onto the same campaign by the same key holder returns the first import with status 200. A key that started anything else answers 409 idempotency_key_reused. A key names one import for good. An empty value is no key.

Lengthlength <= 200

Request Body

application/json
  1. body
uploadId*string

The uploadId from POST /uploads, after the file has been put at its url.

Length1 <= length <= 1024
mapping?

Which target each column of the file goes to, as { "": "" }. Without a mapping, the server reads the first 64 KB of the file, finds the header row and matches the columns as the website's import does, and a plain CSV with headers such as first_name, phone and state needs no setup. A column is named by its header (in any case) or by its number counting from 1, and every column you leave out is ignored. A target is exact, so "phone" works and "Phone" doesn't. The targets are name, firstName, lastName, phone, email, notes, source, state, zip, city and address (the last four not for an agency with the People module); custom: for one of the agency's own fields, by its key on the Fields page; ignore to leave the column out; and, for an agency with the People module only, otherPhone, company:name, company:domain, company:phone and companyField:. The API makes no new fields. The mapping used comes back in the answer, so you can send it next time to pin it.

Propertiesproperties <= 512
hasHeader?boolean

Whether the first row is a header. Leave it out and it is worked out from the file. A mapping that names a column by its header counts as saying yes.

duplicates?string

What to do with a row whose number the agency already has. default: a duplicate of a number the agency has already called is dropped, and any other duplicate is skipped while the lead you already had joins the list. skip: duplicate rows are dropped, and the lead you already had joins the list. allow: every row is added, duplicates included. merge: duplicate rows are dropped, but their data updates the lead you already had. Duplicates are checked across the whole agency. An agency with the People module matches people its own way, and always imports as skip.

Default"default"
Value in"default""skip""allow""merge"
listName?string

A name for the new list the leads go into, with (2), (3) and so on added when the agency already has it. Without listName or listId, the new list is named from the file name and the minute the import started, in UTC. Send listName or listId, not both.

Length1 <= length <= 120
listId?string

An existing list to file the leads into, from GET /lists. It must feed this campaign or none (a list on none is attached to this campaign when the import finishes), and be switched on. Send listName or listId, not both.

Length1 <= length <= 200
fileName?string

The file's name, for the default list name. It defaults to the name at the end of uploadId.

Length1 <= length <= 255

Response Body

A retry: this Idempotency-Key already started this import, from the same file onto the same campaign by the same key holder, and that import is returned. A different mapping or list name in the retry doesn't change the import, but the mapping in this answer is the one worked out from the retry.

application/json
  1. response
importId*string

Watch the import with GET /imports/{importId}.

listId*string

The list the leads go into.

listName*string
mapping*

The mapping the import uses, one entry for every column of the file, in the shape you send it. A column is keyed by its header, or by its number when it has no header, its header appears twice, or its header is only digits. On a replay it is worked out from the retry's request.

replayed*boolean

True when an earlier start with this Idempotency-Key made the import. The status is then 200, not 201.

curl -X POST 'https://www.inyoke.com/api/v1/campaigns/cmhd4q2nb0001s8a1x7k3p9vz/imports' \  -H 'Idempotency-Key: 3f6b2a8e-4c1d-4e9a-9b7f-2d5c8e1a0f43' \  -H 'Content-Type: application/json' \  -d '{  "uploadId": "imports/cmh8w3k2c0000ab12cd34ef56/9f2c4e7a1b8d3f60a5c2e4b79d1a8f35/leads.csv"}'
Example Response
{  "importId": "cmhe2f3ja0007lq09p1s5v8xc",  "listId": "cmhd4s1pw0006s8a1t9e3h7ud",  "listName": "Vendor leads 2026-10-30",  "mapping": {    "First Name": "firstName",    "Last Name": "lastName",    "Cell": "phone",    "State": "state",    "Coverage": "custom:coverage_amount",    "Lead Date": "ignore"  },  "replayed": true}