Get contact import
const url = 'https://api.postlever.com/v1/contact-imports/8f14e45f-ea8f-4b1a-9c2d-2b0a5a1f3c7e';const options = {method: 'GET', headers: {Authorization: '<Authorization>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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 pastuploadExpiresAt, since an upload that started in time may still be running. 24 hours after creation with no file, the import reportsfailed, 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 reportsimporting, notfailed.failed: the import stopped;failureReasonsays 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.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The id of the contact import, as returned by POST /v1/contact-imports.
Responses
Section titled “Responses”The contact import.
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
Where the import is in its life. failed and success are final.
How the file arrived: api for this API, manual for an upload in the app.
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.
The total rows to import, counted once the file was read. Absent until then.
Rows that became new contacts.
Rows that changed an existing contact. Absent on an import that ran before the count was kept.
Rows whose contact already existed and was left untouched. Absent as updatedCount is.
Rows that could not be read as a contact, such as a missing or invalid email, or a value over 255 characters.
Rows dropped because a later row in the file repeated their email; the last one is imported.
Why the import failed. Present only when status is failed.
How a row merged into a contact that already existed.
Under overwrite, whether a row’s brands replaced the contact’s rather than adding to them.
Whether a row could enable a disabled contact again.
When the import was started, by its upload link being handed out or its file being uploaded in the app.
When the import succeeded. Absent until status is success.
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.
Error envelope returned by every v1 endpoint for failures, following RFC 9457
Problem Details with code and errors extensions.
object
URI identifying the problem type; dereferences to its documentation.
HTTP status code applicable to this problem.
Short, human-readable summary of the problem type.
Detailed explanation specific to this occurrence.
Error code identifying the specific error condition.
URI reference identifying this specific occurrence (the request URI).
Provides additional information when the error relates to specific request fields.
object
Detailed explanation for this specific field error.
JSON Pointer (RFC 6901) to the request body value that caused the error (e.g. /email, /attributes/firstName).
The URI query parameter that caused the error (e.g. pageSize, name[invalid]).
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.
Error envelope returned by every v1 endpoint for failures, following RFC 9457
Problem Details with code and errors extensions.
object
URI identifying the problem type; dereferences to its documentation.
HTTP status code applicable to this problem.
Short, human-readable summary of the problem type.
Detailed explanation specific to this occurrence.
Error code identifying the specific error condition.
URI reference identifying this specific occurrence (the request URI).
Provides additional information when the error relates to specific request fields.
object
Detailed explanation for this specific field error.
JSON Pointer (RFC 6901) to the request body value that caused the error (e.g. /email, /attributes/firstName).
The URI query parameter that caused the error (e.g. pageSize, name[invalid]).
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.
Error envelope returned by every v1 endpoint for failures, following RFC 9457
Problem Details with code and errors extensions.
object
URI identifying the problem type; dereferences to its documentation.
HTTP status code applicable to this problem.
Short, human-readable summary of the problem type.
Detailed explanation specific to this occurrence.
Error code identifying the specific error condition.
URI reference identifying this specific occurrence (the request URI).
Provides additional information when the error relates to specific request fields.
object
Detailed explanation for this specific field error.
JSON Pointer (RFC 6901) to the request body value that caused the error (e.g. /email, /attributes/firstName).
The URI query parameter that caused the error (e.g. pageSize, name[invalid]).
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.
Error envelope returned by every v1 endpoint for failures, following RFC 9457
Problem Details with code and errors extensions.
object
URI identifying the problem type; dereferences to its documentation.
HTTP status code applicable to this problem.
Short, human-readable summary of the problem type.
Detailed explanation specific to this occurrence.
Error code identifying the specific error condition.
URI reference identifying this specific occurrence (the request URI).
Provides additional information when the error relates to specific request fields.
object
Detailed explanation for this specific field error.
JSON Pointer (RFC 6901) to the request body value that caused the error (e.g. /email, /attributes/firstName).
The URI query parameter that caused the error (e.g. pageSize, name[invalid]).
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"}