Import

Import ticket details, customers, or articles. Processes up to 500 records synchronously and supports merge strategies.

The Import object

entityType string

Imported entity type: ticket, customer or article

total integer

Total records processed

created integer

Records created

updated integer

Records updated

skipped integer

Records skipped

warnings string[]

Rows saved with something missing or skipped as duplicates, each starting "Row N:"

Endpoints

POST /api/v1/teams/{teamId}/import

Run Import

Import up to 500 records synchronously. A ticket brings its details, its requester (customer_email is found or created as a customer in the key's test or live mode) and its description as the first customer message. Replies, private notes and attachments are not migrated. A customer created without an email fails with a row error.

Request Body

resource string required

Resource type

records array required

Array of flat record objects or wrapped { data, action, existingId? } records. For ticket create/update records, nonempty arrays at messages, _messages, comments, audits, conversations, threads, _embedded.threads, conversation_parts, or conversation_parts.conversation_parts, on the record or its data object, cause HTTP 400 before any records in the request are written. A truthy source.body paired with an array at conversation_parts or conversation_parts.conversation_parts also causes HTTP 400, even if that array is empty. Empty history without this initial-message shape, customFields and wrapped records with action: "skip" are allowed (empty history and metadata are ignored, with a row warning). A status or sentiment must be one of the team's keys (GET /settings); a row with any other value fails, and its error lists the allowed keys. A ticket priority or source (channel) that is none of the team's is never quietly changed: an update keeps the stored value and a new ticket gets the default (normal, email), with a row warning. Field limits match POST and PATCH: a blank subject, customer name or article title fails its row, and so does a customer name over 200 characters (a long subject is shortened instead). Types match them too: a text field sent as an object, true or a list fails its row naming the field (a spreadsheet number is taken as text), and tags must be a list of strings (a "billing,vip" string fails the row). existingId takes the UUID or the prefixed id that createdIds returns. A wrapped create record may carry an importKey (1 to 200 letters, digits or : . _ -): a ticket or article with a key is created once per team and mode, and the same key again (a retry, another request) is skipped, counted in alreadyImported, with the record's id in existingIds. Make a key unique to one record in one source system and account, for example zendesk:acme:1001 (a bare id like 1001 is in every account). A key that already names another record fails that row instead of writing onto the record. One key on two created tickets or articles of a request is refused (HTTP 400 naming both). Anyone who can read a record can read its key, so put nothing private in a key. A key made only from a row's content would make the same row in a later file look already imported, so a key for a row with no id should also name its file (a hash of the whole file). An edited file is a new file then: send the records it already imported as updates (action update with existingId). A ticket record's customFields must fit the team's ticket fields, as on POST /tickets; a customer record's values under one of the team's customer field ids must fit that field, as on POST /customers (other keys are kept as sent). Record fields: tickets take subject (or title), description, customer_email, customer_name, assigned_to, status, priority, source (or channel), tags, notes, external_id; customers take name, email, status, sentiment, tags, notes, external_id, phone, company, avatar_url; articles take title, content, excerpt, status, tags, is_public, slug, meta_description, notes, category (is_public is true or false, also as text: a create without it is team only, an update changes it only when sent, and an article gets its publishedAt the first time it is published and visible to customers); any of them also created_at and updated_at (tickets closed_at) with preserveTimestamps. An update sets updatedAt to the time of the import unless preserveTimestamps is on and the record has its own updated_at. camelCase names (customerEmail, externalId) work too. A field the import doesn't read is named in a row warning.

mergeStrategy string

What a customer row does when the team already has a customer with its email (in the key's test or live mode): 'skip' leaves that customer alone and the row is counted as skipped with a warning naming it, 'overwrite' updates it with the row (a blank cell leaves that field as it is), 'merge' fills only its empty fields. A row that repeats an email from an earlier row of the same request is skipped. For wrapped records with action 'update', 'skip' writes nothing, and 'overwrite' and 'merge' both write every field the row sends, except a priority or channel that is blank or none of the team's, which leaves the stored one (with a warning when it is unknown).

Default: skip

Code Examples

bash
curl -X POST "https://www.cstar.help/api/v1/teams/{teamId}/import" \
  -H "Authorization: Bearer sk_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{"resource":"customers","records":[{"name":"Jane","email":"jane@example.com"}],"mergeStrategy":"skip"}'

Responses

201 Import result
json
{
  "success": true,
  "data": {
    "object": "import_result",
    "logId": "550e8400-e29b-41d4-a716-446655440001",
    "entityType": "customer",
    "success": true,
    "total": 1,
    "created": 1,
    "updated": 0,
    "skipped": 0,
    "failed": 0,
    "createdIds": [
      {
        "rowIndex": 1,
        "id": "cus_a1B2c3D4e5F6"
      }
    ],
    "alreadyImported": 0,
    "existingIds": [],
    "durationMs": 10
  }
}

409 Idempotency-Key in use: its first request is still running (Retry-After says when to send it again) or it was used on another endpoint
json
{
  "success": false,
  "error": {
    "type": "invalid_request_error",
    "code": "idempotency_key_in_use",
    "message": "A request with this Idempotency-Key is still being processed. Retry after it finishes.",
    "doc_url": "https://www.cstar.help/developers/errors#idempotency_key_in_use",
    "request_id": "req_abc123"
  },
  "meta": {
    "requestId": "req_abc123",
    "timestamp": "2025-12-10T14:30:00Z"
  }
}

422 Idempotency-Key already used within 24 hours for a request with a different body
json
{
  "success": false,
  "error": {
    "type": "invalid_request_error",
    "code": "idempotency_key_reused",
    "message": "The Idempotency-Key was already used for a request with a different body. Generate a new key for this request.",
    "doc_url": "https://www.cstar.help/developers/errors#idempotency_key_reused",
    "request_id": "req_abc123"
  },
  "meta": {
    "requestId": "req_abc123",
    "timestamp": "2025-12-10T14:30:00Z"
  }
}

401 Authentication failed: missing or invalid API key
json
{
  "success": false,
  "error": {
    "type": "authentication_error",
    "code": "invalid_api_key",
    "message": "The API key provided is invalid or has been revoked",
    "doc_url": "https://www.cstar.help/developers/errors#invalid_api_key",
    "request_id": "req_abc123"
  },
  "meta": {
    "timestamp": "2025-12-10T14:30:00Z"
  }
}

403 Insufficient permissions: wrong key type or team access
json
{
  "success": false,
  "error": {
    "type": "authentication_error",
    "code": "insufficient_permissions",
    "message": "Your API key does not have permission for this operation",
    "doc_url": "https://www.cstar.help/developers/errors#insufficient_permissions",
    "request_id": "req_abc123"
  },
  "meta": {
    "timestamp": "2025-12-10T14:30:00Z"
  }
}

429 Rate limit exceeded
json
{
  "success": false,
  "error": {
    "type": "rate_limit_error",
    "code": "rate_limit_exceeded",
    "message": "Rate limit exceeded. Try again in 60 seconds.",
    "retryAfter": 60,
    "doc_url": "https://www.cstar.help/developers/errors#rate_limit_exceeded",
    "request_id": "req_abc123"
  },
  "meta": {
    "timestamp": "2025-12-10T14:30:00Z"
  }
}

GET /api/v1/teams/{teamId}/import

List Import Logs

List import history logs in the key's mode: a test key sees test imports only, a live key live ones.

Code Examples

bash
curl -X GET "https://www.cstar.help/api/v1/teams/{teamId}/import" \
  -H "Authorization: Bearer sk_live_your_key"

Responses

200 Import logs
json
{
  "success": true,
  "data": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440001",
      "object": "import_log",
      "entityType": "customer",
      "sourcePlatform": "api",
      "sourceFilename": "customers.csv",
      "totalRecords": 50,
      "created": 45,
      "updated": 0,
      "skipped": 5,
      "failed": 0,
      "errors": null,
      "matchKey": "none",
      "mergeStrategy": {},
      "completedAt": "2025-12-10T14:30:02Z",
      "createdAt": "2025-12-10T14:30:00Z"
    }
  ]
}

401 Authentication failed: missing or invalid API key
json
{
  "success": false,
  "error": {
    "type": "authentication_error",
    "code": "invalid_api_key",
    "message": "The API key provided is invalid or has been revoked",
    "doc_url": "https://www.cstar.help/developers/errors#invalid_api_key",
    "request_id": "req_abc123"
  },
  "meta": {
    "timestamp": "2025-12-10T14:30:00Z"
  }
}

403 Insufficient permissions: wrong key type or team access
json
{
  "success": false,
  "error": {
    "type": "authentication_error",
    "code": "insufficient_permissions",
    "message": "Your API key does not have permission for this operation",
    "doc_url": "https://www.cstar.help/developers/errors#insufficient_permissions",
    "request_id": "req_abc123"
  },
  "meta": {
    "timestamp": "2025-12-10T14:30:00Z"
  }
}

429 Rate limit exceeded
json
{
  "success": false,
  "error": {
    "type": "rate_limit_error",
    "code": "rate_limit_exceeded",
    "message": "Rate limit exceeded. Try again in 60 seconds.",
    "retryAfter": 60,
    "doc_url": "https://www.cstar.help/developers/errors#rate_limit_exceeded",
    "request_id": "req_abc123"
  },
  "meta": {
    "timestamp": "2025-12-10T14:30:00Z"
  }
}