Skip to content

Get contact import

GET
/v1/contact-imports/{importId}
curl --request GET \
--url https://api.postlever.com/v1/contact-imports/8f14e45f-ea8f-4b1a-9c2d-2b0a5a1f3c7e \
--header 'Authorization: <Authorization>'

Fetches a contact import’s status, progress and counts.

status is one of:

  • awaiting-upload: no file has arrived yet. This holds past uploadExpiresAt, since an upload that started in time may still be running. 24 hours after creation with no file, the import reports failed, and a file arriving later is not imported.
  • uploaded: the file has arrived and is waiting to be read.
  • importing: the file is being read and its rows written to contacts. A batch the system is retrying after a transient failure still reports importing, not failed.
  • failed: the import stopped; failureReason says why, including no file arriving within 24 hours. With the reason “The contacts were imported, but updating reporting failed”, every row has been written and only reporting figures lag.
  • success: every row has been written or counted.

percentComplete is present only while status is importing: the rows written or counted so far, as a whole percentage of rowCount. Rows are written in batches of 100,000, so it moves in those steps; a smaller file stays at 0 until it is done. It reaches 100 once every row is accounted for, even while the sync that follows the last batch is still finishing.

importId
required
string format: uuid

The id of the contact import, as returned by POST /v1/contact-imports.

The contact import.

Media typeapplication/json

A contact import: one entry of GET /v1/contact-imports, or the response of GET /v1/contact-imports/{importId}.

Once the file is read, addedCount, updatedCount and skippedCount add up to rowCount. malformedCount and duplicateInFileCount are rows dropped before that, so they are not part of the total.

object
id
required
string format: uuid
status
required

Where the import is in its life. failed and success are final.

string
Allowed values: awaiting-upload uploaded importing failed success
method
required

How the file arrived: api for this API, manual for an upload in the app.

string
Allowed values: api manual
percentComplete

Rows written or counted so far as a whole percentage of rowCount, moving in steps of 100,000 rows. Present only while status is importing.

integer
rowCount

The total rows to import, counted once the file was read. Absent until then.

integer
addedCount
required

Rows that became new contacts.

integer
updatedCount

Rows that changed an existing contact. Absent on an import that ran before the count was kept.

integer
skippedCount

Rows whose contact already existed and was left untouched. Absent as updatedCount is.

integer
malformedCount
required

Rows that could not be read as a contact, such as a missing or invalid email, or a value over 255 characters.

integer
duplicateInFileCount

Rows dropped because a later row in the file repeated their email; the last one is imported.

integer
failureReason

Why the import failed. Present only when status is failed.

string
duplicateContactStrategy
required

How a row merged into a contact that already existed.

string
Allowed values: overwrite keep skip
overwriteBrands
required

Under overwrite, whether a row’s brands replaced the contact’s rather than adding to them.

boolean
restoreDisabled
required

Whether a row could enable a disabled contact again.

boolean
createdAt
required

When the import was started, by its upload link being handed out or its file being uploaded in the app.

string format: date-time
completedAt

When the import succeeded. Absent until status is success.

string format: date-time

Example

{
"id": "8f14e45f-ea8f-4b1a-9c2d-2b0a5a1f3c7e",
"status": "awaiting-upload",
"method": "api",
"percentComplete": 42,
"rowCount": 1000,
"addedCount": 800,
"updatedCount": 150,
"skippedCount": 30,
"malformedCount": 5,
"duplicateInFileCount": 15,
"failureReason": "No file arrived within 24 hours of the import being created",
"duplicateContactStrategy": "overwrite"
}

Invalid request payload. Details are provided in the error response.

Media typeapplication/json

Error envelope returned by every v1 endpoint for failures, following RFC 9457 Problem Details with code and errors extensions.

object
type
required

URI identifying the problem type; dereferences to its documentation.

string format: uri
status
required

HTTP status code applicable to this problem.

integer
title
required

Short, human-readable summary of the problem type.

string
detail
required

Detailed explanation specific to this occurrence.

string
code
required

Error code identifying the specific error condition.

string
Allowed values: invalid_request_error authentication_error permission_error not_found_error conflict_error api_error contact_exists operation_in_progress
instance

URI reference identifying this specific occurrence (the request URI).

string format: uri-reference
errors

Provides additional information when the error relates to specific request fields.

Array<object>
object
detail
required

Detailed explanation for this specific field error.

string
pointer

JSON Pointer (RFC 6901) to the request body value that caused the error (e.g. /email, /attributes/firstName).

string
parameter

The URI query parameter that caused the error (e.g. pageSize, name[invalid]).

string

Example

{
"type": "https://docs.postlever.com/error-codes#invalid_request_error",
"status": 400,
"title": "Invalid request",
"detail": "\"nickname\" is not an attribute in the contact schema",
"code": "invalid_request_error",
"instance": "/v1/contacts",
"errors": [
{
"detail": "\"nickname\" is not an attribute in the contact schema",
"pointer": "/attributes/nickname"
}
]
}

Missing or invalid API key.

Media typeapplication/json

Error envelope returned by every v1 endpoint for failures, following RFC 9457 Problem Details with code and errors extensions.

object
type
required

URI identifying the problem type; dereferences to its documentation.

string format: uri
status
required

HTTP status code applicable to this problem.

integer
title
required

Short, human-readable summary of the problem type.

string
detail
required

Detailed explanation specific to this occurrence.

string
code
required

Error code identifying the specific error condition.

string
Allowed values: invalid_request_error authentication_error permission_error not_found_error conflict_error api_error contact_exists operation_in_progress
instance

URI reference identifying this specific occurrence (the request URI).

string format: uri-reference
errors

Provides additional information when the error relates to specific request fields.

Array<object>
object
detail
required

Detailed explanation for this specific field error.

string
pointer

JSON Pointer (RFC 6901) to the request body value that caused the error (e.g. /email, /attributes/firstName).

string
parameter

The URI query parameter that caused the error (e.g. pageSize, name[invalid]).

string

Example

{
"type": "https://docs.postlever.com/error-codes#authentication_error",
"status": 401,
"title": "Authentication failed",
"detail": "Missing or invalid API key",
"code": "authentication_error",
"instance": "/v1/contacts"
}

Permission denied.

Media typeapplication/json

Error envelope returned by every v1 endpoint for failures, following RFC 9457 Problem Details with code and errors extensions.

object
type
required

URI identifying the problem type; dereferences to its documentation.

string format: uri
status
required

HTTP status code applicable to this problem.

integer
title
required

Short, human-readable summary of the problem type.

string
detail
required

Detailed explanation specific to this occurrence.

string
code
required

Error code identifying the specific error condition.

string
Allowed values: invalid_request_error authentication_error permission_error not_found_error conflict_error api_error contact_exists operation_in_progress
instance

URI reference identifying this specific occurrence (the request URI).

string format: uri-reference
errors

Provides additional information when the error relates to specific request fields.

Array<object>
object
detail
required

Detailed explanation for this specific field error.

string
pointer

JSON Pointer (RFC 6901) to the request body value that caused the error (e.g. /email, /attributes/firstName).

string
parameter

The URI query parameter that caused the error (e.g. pageSize, name[invalid]).

string

Example

{
"type": "https://docs.postlever.com/error-codes#permission_error",
"status": 403,
"title": "Permission denied",
"detail": "api key required",
"code": "permission_error",
"instance": "/v1/contacts"
}

No contact import with this id exists in your account.

Media typeapplication/json

Error envelope returned by every v1 endpoint for failures, following RFC 9457 Problem Details with code and errors extensions.

object
type
required

URI identifying the problem type; dereferences to its documentation.

string format: uri
status
required

HTTP status code applicable to this problem.

integer
title
required

Short, human-readable summary of the problem type.

string
detail
required

Detailed explanation specific to this occurrence.

string
code
required

Error code identifying the specific error condition.

string
Allowed values: invalid_request_error authentication_error permission_error not_found_error conflict_error api_error contact_exists operation_in_progress
instance

URI reference identifying this specific occurrence (the request URI).

string format: uri-reference
errors

Provides additional information when the error relates to specific request fields.

Array<object>
object
detail
required

Detailed explanation for this specific field error.

string
pointer

JSON Pointer (RFC 6901) to the request body value that caused the error (e.g. /email, /attributes/firstName).

string
parameter

The URI query parameter that caused the error (e.g. pageSize, name[invalid]).

string

Example

{
"type": "https://docs.postlever.com/error-codes#not_found_error",
"status": 404,
"title": "Not found",
"detail": "Contact import not found",
"code": "not_found_error",
"instance": "/v1/contact-imports/8f14e45f-ea8f-4b1a-9c2d-2b0a5a1f3c7e"
}