Import a file
Put a CSV of leads on a campaign in three calls, then watch the import run.
An import runs in the background, the same as an import from the website: the same column matching, duplicate rules and screening. Files can be up to 512 MB.
Needs a key with Read and write access, and the Import leads permission.
Ask for a place to put the file
Send the file's name and its size in bytes. Nothing is created yet.
curl -X POST "https://www.inyoke.com/api/v1/uploads" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d "{\"fileName\": \"leads.csv\", \"byteSize\": $(wc -c < leads.csv | tr -d ' ')}"{
"uploadId": "imports/cm2x9k1tn0000/9f2c4e7a1b8d3f60a5c2e4b79d1a8f35/leads.csv",
"url": "https://files.example.com/...?X-Amz-Signature=...",
"expiresAt": "2026-10-30T15:05:00.000Z"
}Keep uploadId exactly as it is. You send it to start the import.
Put the file at that address
Send the file's bytes to url before expiresAt. This goes straight to file storage, so don't send your API key: storage refuses a request that carries both.
curl -X PUT "$UPLOAD_URL" --upload-file leads.csvA 200 means the file is there. If url has expired, ask for a new one.
Start the import
Send the uploadId with an Idempotency-Key: a new value for each file, such as a UUID. Send the same value if you retry.
curl -X POST "https://www.inyoke.com/api/v1/campaigns/$CAMPAIGN_ID/imports" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $IDEMPOTENCY_KEY" \
-d "{\"uploadId\": \"$UPLOAD_ID\"}"{
"importId": "cm2x9k1im0004",
"listId": "cm2x9k1lt0002",
"listName": "leads · 2026-10-30 14:05 UTC",
"mapping": { "First Name": "firstName", "Last Name": "lastName", "Cell": "phone", "State": "state" },
"replayed": false
}Watch it run
Check every few seconds until status is done, failed or canceled.
curl "https://www.inyoke.com/api/v1/imports/$IMPORT_ID" \
-H "Authorization: Bearer $API_KEY"Matching columns
Without a mapping, the first 64 KB of the file is read to find the header row, and the columns are matched the way the website's import matches them. A plain CSV with headers such as first_name, phone and state needs no setup. The mapping that was used comes back in the answer, so you can send it next time to pin it.
If no column matches phone, the answer is 422 with unplacedColumns: the headers that couldn't be placed.
To set the mapping yourself, send { "<header>": "<target>" }. A column is named by its header, in any case, or by its number counting from 1. Columns you leave out are ignored.
| Target | Column |
|---|---|
name | Name (full) |
firstName, lastName | First name, last name |
phone | Phone |
email, notes, source | Email, notes, source |
state, zip, city, address | Location |
custom:<key> | One of your agency's own fields, by its key on the Fields page |
ignore | Leave the column out |
otherPhone | Other phone (People module only) |
company:name, company:domain, company:phone | Company name, website and phone (People module only) |
companyField:<key> | One of your agency's own company fields (People module only) |
A target is exact: phone works and Phone doesn't. A mapping that can't be used is refused with unknownColumns, badTargets or ambiguous, each listing what to fix.
Options
| Key | Meaning |
|---|---|
uploadId | Required. From the first call. |
mapping | Which target each column goes to. Worked out from the file when left out. |
hasHeader | Whether the first row is a header. Worked out from the file when left out. |
duplicates | How to treat a lead your agency already has. See below. |
listName | Name the new list. At most 120 characters. |
listId | File into an existing list instead of making one. Not with listName. |
By default the leads go into a new list named from the file and the time, with (2), (3) and so on added when the name is taken. A list feeds one campaign: a listId whose list feeds another campaign answers 409. A list that feeds none is attached to this campaign when the import finishes.
duplicates
| Value | Meaning |
|---|---|
default | A duplicate of a number your agency has already called is dropped. Any other duplicate is skipped, and 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 your whole agency. An agency with the People module always imports as skip, whatever you send. Imported leads aren't assigned to anyone.
One import at a time
Imports run one at a time in an agency. While another is running, starting one answers 409 with reason: "import_running". Retry the same request with the same Idempotency-Key, waiting longer each time: 30 seconds, then a minute, then two.
A retry of the same file onto the same campaign, by the same person, returns the first import with status 200 and replayed: true. A key that already started anything else answers 409 with reason: "idempotency_key_reused".
What an import reports
| Field | Meaning |
|---|---|
status | queued, importing, enrolling, done, failed or canceled. |
totalRows | Rows in the file. null until the file has been counted. |
rowsProcessed | Rows read so far. |
inserted | New leads made. |
duplicates | Rows whose number your agency already had, or an earlier row of the file had. |
skipped | Duplicates dropped. |
merged | Existing leads updated from a duplicate row. |
enrolled | Leads put on the campaign. |
enrollBlocked | Leads the campaign's screening refused. |
enrollHeld | Leads parked until someone is licensed for their state. |
error | Why an import failed. null unless status is failed. |
warning | A note about an import that finished. |
Rows the importer rejected aren't listed: the import doesn't keep them.