---
title: "Imports API reference"
url: "https://coldagentai.com/docs/api/imports.md"
canonical_url: "https://coldagentai.com/docs/api/imports"
last_updated: "2026-10-18"
type: "reference"
summary: "Import campaigns and leads from another sender with the ColdAgentAI API: an Instantly import and a Smartlead lead export in CSV form."
related: ["https://coldagentai.com/docs/api.md", "https://coldagentai.com/docs/authentication.md", "https://coldagentai.com/docs/errors.md", "https://coldagentai.com/docs/api/leads.md", "https://coldagentai.com/docs/api/campaigns.md"]
install: "claude mcp add --transport http coldagentai-free https://coldagentai.com/api/mcp"
---

# Imports API reference

> **For AI agents:** the complete index of ColdAgentAI pages is [llms.txt](https://coldagentai.com/llms.txt). Every page is also served as markdown at its URL plus .md.

Import campaigns and leads from another sender with the ColdAgentAI API: an Instantly import and a Smartlead lead export in CSV form.

Bring campaigns and leads in from another sender. 2 operations.

## Operations

Authenticate as described in [Authentication](https://coldagentai.com/docs/authentication.md). Every operation below is generated from the [OpenAPI document](https://coldagentai.com/docs/openapi.md).

| Method and path | Scope | What it does |
| --- | --- | --- |
| `POST /v1/import/instantly` | write | Import from Instantly |
| `POST /v1/import/smartlead-csv` | write | Import a Smartlead lead export |

## POST /v1/import/instantly

Reads your campaigns, leads and blocklist from Instantly with your Instantly API key (used for this request only, never stored) and creates them here: campaigns as DRAFTS with their sequence, leads (people on your suppression list and new leads beyond your plan's contact cap are skipped and counted), and the blocklist as suppression entries. Reads everything first and writes only if every read succeeded, so a vendor error changes nothing. Mailbox passwords cannot be imported: reconnect every mailbox and add it to each campaign. Limits per import: 25 campaigns, 5000 leads, 5000 blocklist entries; anything beyond is listed in `truncated`.

Scope: `write`. A read key gets 403 forbidden. Success: HTTP 200.

### Request body

Send JSON with `Content-Type: application/json`. The body is required.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `api_key` | string | yes | An Instantly API v2 key. Used for this request only. 1 to 500 characters. |

Request example:

```
{
  "api_key": "abc123"
}
```

### Response

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `campaigns` | array of object | yes | No further constraints. |
| `campaigns[].external_id` | string | yes | No further constraints. |
| `campaigns[].id` | string | yes | No further constraints. |
| `campaigns[].name` | string | yes | No further constraints. |
| `campaigns[].steps_imported` | integer | yes | No further constraints. |
| `campaigns[].warnings` | array of string | yes | No further constraints. |
| `leads` | object | yes | No further constraints. |
| `leads.created` | integer | yes | No further constraints. |
| `leads.updated` | integer | yes | No further constraints. |
| `leads.rejected` | integer | yes | Rows that are not usable, for example an invalid address. |
| `leads.skipped_suppressed` | integer | yes | On your suppression list: not imported. |
| `leads.skipped_over_plan_cap` | integer | yes | New leads that would exceed the plan's active contact cap: not imported. |
| `suppression` | object | yes | No further constraints. |
| `suppression.created` | integer | yes | No further constraints. |
| `suppression.rejected` | integer | yes | No further constraints. |
| `truncated` | array of string | yes | What was cut at the per-import limit, so you can import in parts. |
| `mailboxes` | string | yes | Mailboxes are not importable: reconnect them. |
| `webhooks` | string | yes | No further constraints. |

Response example, HTTP 200:

```
{
  "campaigns": [
    {
      "external_id": "id_8f3a2c1d",
      "id": "id_8f3a2c1d",
      "name": "Example",
      "steps_imported": 1,
      "warnings": [
        "abc123"
      ]
    }
  ],
  "leads": {
    "created": 1,
    "updated": 1,
    "rejected": 1,
    "skipped_suppressed": 1,
    "skipped_over_plan_cap": 1
  },
  "suppression": {
    "created": 1,
    "rejected": 1
  },
  "truncated": [
    "abc123"
  ],
  "mailboxes": "abc123",
  "webhooks": "abc123"
}
```

### Errors

[`invalid_input`](https://coldagentai.com/docs/errors.md#invalid_input), [`unauthorized`](https://coldagentai.com/docs/errors.md#unauthorized), [`forbidden`](https://coldagentai.com/docs/errors.md#forbidden), [`payload_too_large`](https://coldagentai.com/docs/errors.md#payload_too_large), [`rate_limited`](https://coldagentai.com/docs/errors.md#rate_limited), [`internal_error`](https://coldagentai.com/docs/errors.md#internal_error), [`provider_unavailable`](https://coldagentai.com/docs/errors.md#provider_unavailable). Every error uses the [single format](https://coldagentai.com/docs/errors.md#format).

### Rate limits

Counted per key: 200 requests per 10 seconds. Every response carries `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. Over the limit the answer is `429 rate_limited` with `Retry-After`. See [Rate limits](https://coldagentai.com/docs/rate-limits.md).

### Examples

cURL:

```
curl -X POST "https://api.coldagentai.com/v1/import/instantly" \
  -H "Authorization: Bearer $COLDAGENTAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "api_key": "abc123"
}'
```

JavaScript (fetch):

```
const res = await fetch(`https://api.coldagentai.com/v1/import/instantly`, {
  method: 'POST',
  body: JSON.stringify({
    "api_key": "abc123"
  }),
  headers: { Authorization: `Bearer ${process.env.COLDAGENTAI_API_KEY}`, 'Content-Type': 'application/json' },
});
if (!res.ok) throw new Error(JSON.stringify(await res.json()));
const data = await res.json();
```

## POST /v1/import/smartlead-csv

Imports a Smartlead (or generic) lead CSV into a campaign you own. Send the CSV text as the request body and name the campaign in `campaign_id`. Handles a byte-order mark, quoted fields, CRLF and duplicate headers; at most 1000 rows. Cells that start with = + - or @ are kept as text and listed in `flagged_cells`. People on your suppression list and new leads beyond your plan's contact cap are skipped and counted. Smartlead has no API import here: export the CSV from Smartlead and send it.

Scope: `write`. A read key gets 403 forbidden. Success: HTTP 200.

### Query parameters

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `campaign_id` | string | yes | The campaign to add the leads to. 1 to 100 characters |
| `layout` | "smartlead" or "generic" | no | default "smartlead" |

### Request body

Send the body as `text/plain`. The body is required.

Request example:

```
abc123
```

### Response

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `layout` | "smartlead" or "generic" | yes | No further constraints. |
| `rows_read` | integer | yes | No further constraints. |
| `leads` | object | yes | No further constraints. |
| `leads.created` | integer | yes | No further constraints. |
| `leads.updated` | integer | yes | No further constraints. |
| `leads.rejected` | integer | yes | Rows that are not usable, for example an invalid address. |
| `leads.skipped_suppressed` | integer | yes | On your suppression list: not imported. |
| `leads.skipped_over_plan_cap` | integer | yes | New leads that would exceed the plan's active contact cap: not imported. |
| `rejected_rows` | array of object | yes | No further constraints. |
| `rejected_rows[].line` | integer or null | yes | No further constraints. |
| `rejected_rows[].email` | string or null | yes | No further constraints. |
| `rejected_rows[].reason` | string | yes | No further constraints. |
| `flagged_cells` | array of object | yes | No further constraints. |
| `flagged_cells[].line` | integer | yes | No further constraints. |
| `flagged_cells[].column` | string | yes | No further constraints. |
| `flagged_cells[].reason` | string | yes | No further constraints. |
| `warnings` | array of string | yes | No further constraints. |
| `mailboxes` | string | yes | No further constraints. |

Response example, HTTP 200:

```
{
  "layout": "smartlead",
  "rows_read": 1,
  "leads": {
    "created": 1,
    "updated": 1,
    "rejected": 1,
    "skipped_suppressed": 1,
    "skipped_over_plan_cap": 1
  },
  "rejected_rows": [
    {
      "line": 1,
      "email": "maya@example.com",
      "reason": "abc123"
    }
  ],
  "flagged_cells": [
    {
      "line": 1,
      "column": "abc123",
      "reason": "abc123"
    }
  ],
  "warnings": [
    "abc123"
  ],
  "mailboxes": "abc123"
}
```

### Errors

[`invalid_input`](https://coldagentai.com/docs/errors.md#invalid_input), [`unauthorized`](https://coldagentai.com/docs/errors.md#unauthorized), [`forbidden`](https://coldagentai.com/docs/errors.md#forbidden), [`unknown_product`](https://coldagentai.com/docs/errors.md#unknown_product), [`payload_too_large`](https://coldagentai.com/docs/errors.md#payload_too_large), [`rate_limited`](https://coldagentai.com/docs/errors.md#rate_limited), [`internal_error`](https://coldagentai.com/docs/errors.md#internal_error). Every error uses the [single format](https://coldagentai.com/docs/errors.md#format).

### Rate limits

Counted per key: 200 requests per 10 seconds. Every response carries `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. Over the limit the answer is `429 rate_limited` with `Retry-After`. See [Rate limits](https://coldagentai.com/docs/rate-limits.md).

### Examples

cURL:

```
curl -X POST "https://api.coldagentai.com/v1/import/smartlead-csv?campaign_id=id_8f3a2c1d" \
  -H "Authorization: Bearer $COLDAGENTAI_API_KEY" \
  -H "Content-Type: text/plain" \
  -d 'abc123'
```

JavaScript (fetch):

```
const res = await fetch(`https://api.coldagentai.com/v1/import/smartlead-csv?campaign_id=id_8f3a2c1d`, {
  method: 'POST',
  body: "abc123",
  headers: { Authorization: `Bearer ${process.env.COLDAGENTAI_API_KEY}`, 'Content-Type': 'text/plain' },
});
if (!res.ok) throw new Error(JSON.stringify(await res.json()));
const data = await res.json();
```

## Related

- [API reference](https://coldagentai.com/docs/api.md)
- [API authentication](https://coldagentai.com/docs/authentication.md)
- [API errors](https://coldagentai.com/docs/errors.md)
- [Leads API reference](https://coldagentai.com/docs/api/leads.md)
- [Campaigns API reference](https://coldagentai.com/docs/api/campaigns.md)
