Přeskočit na obsah
API dokumentace

Imports and exports

CSV import of contacts (upload, preview, run) and CSV exports.

Technická reference je anglicky (stejně jako strojově čitelný dokument OpenAPI). Celou skupinu pro AI agenta načtete z /api/openapi.json?tag=Imports%20and%20exports.

Přihlášení: Authorization: Bearer pst_... nebo HTTP Basic (e-mail člena firmy a API klíč).

Operace

MetodaCestaPopis
GET/api/v1/tenants/{tenant}/export-fieldsFields an export can contain
GET/api/v1/tenants/{tenant}/exportsList exports
POST/api/v1/tenants/{tenant}/exportsStart a CSV export
GET/api/v1/tenants/{tenant}/exports/{export_id}Get an export
GET/api/v1/tenants/{tenant}/exports/{export_id}/downloadDownload an export (CSV)
GET/api/v1/tenants/{tenant}/importsList imports
POST/api/v1/tenants/{tenant}/importsStart an import
POST/api/v1/tenants/{tenant}/imports/draftsStart an import draft (wizard)
GET/api/v1/tenants/{tenant}/imports/drafts/{import_id}Get an import draft
PUT/api/v1/tenants/{tenant}/imports/drafts/{import_id}Save an import draft
POST/api/v1/tenants/{tenant}/imports/filesUpload a CSV file for import
POST/api/v1/tenants/{tenant}/imports/previewPreview an import: mapping, counts, problems
GET/api/v1/tenants/{tenant}/imports/{import_id}Get an import with its progress and result
DELETE/api/v1/tenants/{tenant}/imports/{import_id}Delete an import record

Fields an export can contain

GET /api/v1/tenants/{tenant}/export-fields

Oprávnění: modul contacts, úroveň read; klíč s přístupem read nebo full

Parametry

NázevKdeTypPovinnéPopis
tenantpathstring (uuid)anoPublic id of the company (tenant), a UUID: GET /api/v3/account-info answers it as data.guid; the app shows it on the API keys page.

Odpovědi

  • 200 OK: application/json object

Chyby

StavKódHodnoty message
401401 unauthorized: missing, unknown, revoked, expired or idle API key.
403403 forbidden: message tenant (another company), scope (read-only key), api_key (person only), or the module the key's roles lack.
429429 rate_limited: wait Retry-After seconds.

List exports

GET /api/v1/tenants/{tenant}/exports

Oprávnění: modul contacts, úroveň read; klíč s přístupem read nebo full

Parametry

NázevKdeTypPovinnéPopis
tenantpathstring (uuid)anoPublic id of the company (tenant), a UUID: GET /api/v3/account-info answers it as data.guid; the app shows it on the API keys page.
idFromquerystringne
idToquerystringne
namequerystringne
pagequeryintegernePage number, from 1. default 1, min 1
pageSizequeryintegerneItems per page, 1 to 100. default 25, min 1, max 100
qquerystringneSearch text (case and diacritics insensitive). max 200 chars
sortquerystringneSort fields separated by commas, "-" = descending, at most 3 (e.g. name,-id).
statusquerystringneStatus filter.

Odpovědi

  • 200 OK: application/json object

Chyby

StavKódHodnoty message
400validationq, sort, status
401401 unauthorized: missing, unknown, revoked, expired or idle API key.
403403 forbidden: message tenant (another company), scope (read-only key), api_key (person only), or the module the key's roles lack.
429429 rate_limited: wait Retry-After seconds.

Start a CSV export

POST /api/v1/tenants/{tenant}/exports

Oprávnění: modul contacts, úroveň full; klíč s přístupem full

Parametry

NázevKdeTypPovinnéPopis
tenantpathstring (uuid)anoPublic id of the company (tenant), a UUID: GET /api/v3/account-info answers it as data.guid; the app shows it on the API keys page.

Tělo požadavku (application/json): Required by the server: name, selection.

PoleTypPovinnéPopis
namestringano
selectionone of: bounced, blacklisted, all, listsano
listIdsarray of stringne
fieldsarray of stringano
purposeIdsarray of stringne
encodingone of: utf-8, windows-1250ano

Odpovědi

Chyby

StavKódHodnoty message
400validation
401401 unauthorized: missing, unknown, revoked, expired or idle API key.
403403 forbidden: message tenant (another company), scope (read-only key), api_key (person only), or the module the key's roles lack.
429429 rate_limited: wait Retry-After seconds.

Get an export

GET /api/v1/tenants/{tenant}/exports/{export_id}

Oprávnění: modul contacts, úroveň read; klíč s přístupem read nebo full

Parametry

NázevKdeTypPovinnéPopis
tenantpathstring (uuid)anoPublic id of the company (tenant), a UUID: GET /api/v3/account-info answers it as data.guid; the app shows it on the API keys page.
export_idpathstringanoId of the export (string of digits).

Odpovědi

Chyby

StavKódHodnoty message
400validation
401401 unauthorized: missing, unknown, revoked, expired or idle API key.
403403 forbidden: message tenant (another company), scope (read-only key), api_key (person only), or the module the key's roles lack.
404not_found
429429 rate_limited: wait Retry-After seconds.

Download an export (CSV)

GET /api/v1/tenants/{tenant}/exports/{export_id}/download

Oprávnění: modul contacts, úroveň full; klíč s přístupem full

Parametry

NázevKdeTypPovinnéPopis
tenantpathstring (uuid)anoPublic id of the company (tenant), a UUID: GET /api/v3/account-info answers it as data.guid; the app shows it on the API keys page.
export_idpathstringanoId of the export (string of digits).

Odpovědi

  • 200 OK: text/csv string

Chyby

StavKódHodnoty message
400validation
401401 unauthorized: missing, unknown, revoked, expired or idle API key.
403403 forbidden: message tenant (another company), scope (read-only key), api_key (person only), or the module the key's roles lack.
404not_found
409conflictstatus
410expiredexport
429429 rate_limited: wait Retry-After seconds.

List imports

GET /api/v1/tenants/{tenant}/imports

Oprávnění: modul contacts, úroveň read; klíč s přístupem read nebo full · Nástroj MCP: list_imports

Imports with status and counts.

Parametry

NázevKdeTypPovinnéPopis
tenantpathstring (uuid)anoPublic id of the company (tenant), a UUID: GET /api/v3/account-info answers it as data.guid; the app shows it on the API keys page.
idFromquerystringne
idToquerystringne
namequerystringne
pagequeryintegernePage number, from 1. default 1, min 1
pageSizequeryintegerneItems per page, 1 to 100. default 25, min 1, max 100
qquerystringneSearch text (case and diacritics insensitive). max 200 chars
sortquerystringneSort fields separated by commas, "-" = descending, at most 3 (e.g. name,-id).
statusquerystringneStatus filter.

Odpovědi

  • 200 OK: application/json object

Chyby

StavKódHodnoty message
400validationq, sort, status
401401 unauthorized: missing, unknown, revoked, expired or idle API key.
403403 forbidden: message tenant (another company), scope (read-only key), api_key (person only), or the module the key's roles lack.
429429 rate_limited: wait Retry-After seconds.

Start an import

POST /api/v1/tenants/{tenant}/imports

Oprávnění: modul contacts, úroveň full; klíč s přístupem full · Nástroj MCP: start_import (přes MCP jen s náhledem a potvrzením)

Runs an import. upsert and update_only need purposeId and consentConfirmed true; unsubscribe, remove and blacklist leave both out.

Parametry

NázevKdeTypPovinnéPopis
tenantpathstring (uuid)anoPublic id of the company (tenant), a UUID: GET /api/v3/account-info answers it as data.guid; the app shows it on the API keys page.

Tělo požadavku (application/json)

PoleTypPovinnéPopis
namestringano
sourcestringanoWhere the contacts come from (se-spec 01 §7.1), e.g. a trade fair.
purposeIdstringnePurpose of processing given to the imported contacts. Optional for OPT_OUT_MODES (the server stores the tenant's first purpose when omitted; those modes write no consent).
consentConfirmedbooleanneThe user confirms a documented, valid purpose for every contact; must be true. Not required for OPT_OUT_MODES.
runAutomationsbooleanneExplicit opt-in: what the import writes starts automations (added to a list, subscribed, contact created ...). Default false: an import is a bulk write that starts none.
optionsImportOptionsneAutofill, start of the purpose consent and the double opt-in e-mail (SE wizard).
draftIdstringneThe wizard's draft this import comes from (deleted when the import starts).
fileIdstringano
mappingImportMappingano
modeone of: upsert, update_only, unsubscribe, remove, blacklistano
kindone of: csv, shoptet_customers, shoptet_newsletterneDefault csv.
subscribersConfirmedbooleanneA Shoptet newsletter export without a consent column: the person confirmed that every row is an active subscriber (required, 400 subscribers otherwise).
shopIdstringanoMain shop of new contacts; lists must belong to it or to the whole company.
listIdsarray of stringano

Odpovědi

Chyby

StavKódHodnoty message
400validationconsent, draftId, purpose, runAutomations
401401 unauthorized: missing, unknown, revoked, expired or idle API key.
403403 forbidden: message tenant (another company), scope (read-only key), api_key (person only), or the module the key's roles lack.
404not_found
429429 rate_limited: wait Retry-After seconds.

Start an import draft (wizard)

POST /api/v1/tenants/{tenant}/imports/drafts

Oprávnění: modul contacts, úroveň full; klíč s přístupem full

SE "Rozpracováno": the wizard saves itself after its first step. Body {name, source, step, state, fileId?, shopId?}; 201 ImportDraft.

Parametry

NázevKdeTypPovinnéPopis
tenantpathstring (uuid)anoPublic id of the company (tenant), a UUID: GET /api/v3/account-info answers it as data.guid; the app shows it on the API keys page.

Tělo požadavku (application/json)

PoleTypPovinnéPopis
namestringne
sourcestringne
stepnumberne
stateImportDraftStatene
fileIdstring or nullne
shopIdstring or nullne

Odpovědi

Chyby

StavKódHodnoty message
400validation
401401 unauthorized: missing, unknown, revoked, expired or idle API key.
403403 forbidden: message tenant (another company), scope (read-only key), api_key (person only), or the module the key's roles lack.
404not_found
429429 rate_limited: wait Retry-After seconds.

Get an import draft

GET /api/v1/tenants/{tenant}/imports/drafts/{import_id}

Oprávnění: modul contacts, úroveň read; klíč s přístupem read nebo full

Parametry

NázevKdeTypPovinnéPopis
tenantpathstring (uuid)anoPublic id of the company (tenant), a UUID: GET /api/v3/account-info answers it as data.guid; the app shows it on the API keys page.
import_idpathstringanoId of the import (string of digits).

Odpovědi

Chyby

StavKódHodnoty message
400validation
401401 unauthorized: missing, unknown, revoked, expired or idle API key.
403403 forbidden: message tenant (another company), scope (read-only key), api_key (person only), or the module the key's roles lack.
404not_found
429429 rate_limited: wait Retry-After seconds.

Save an import draft

PUT /api/v1/tenants/{tenant}/imports/drafts/{import_id}

Oprávnění: modul contacts, úroveň full; klíč s přístupem full

Parametry

NázevKdeTypPovinnéPopis
tenantpathstring (uuid)anoPublic id of the company (tenant), a UUID: GET /api/v3/account-info answers it as data.guid; the app shows it on the API keys page.
import_idpathstringanoId of the import (string of digits).

Tělo požadavku (application/json)

PoleTypPovinnéPopis
namestringne
sourcestringne
stepnumberne
stateImportDraftStatene
fileIdstring or nullne
shopIdstring or nullne

Odpovědi

Chyby

StavKódHodnoty message
400validation
401401 unauthorized: missing, unknown, revoked, expired or idle API key.
403403 forbidden: message tenant (another company), scope (read-only key), api_key (person only), or the module the key's roles lack.
404not_found
429429 rate_limited: wait Retry-After seconds.

Upload a CSV file for import

POST /api/v1/tenants/{tenant}/imports/files

Oprávnění: modul contacts, úroveň full; klíč s přístupem full · Nástroj MCP: upload_import_csv

Uploads CSV text for an import (header row, ; , or tab, up to 5 MB of text; larger files through the administration, up to 64 MB and 300 000 rows). Answers fileId, columns, sample rows, suggestedKind and suggestedMapping.

multipart/form-data with the field file (up to imports.MAX_BYTES; werkzeug spools it to a temporary file, it is read from there as a stream) or JSON {text} (pasted, up to imports.TEXT_MAX_BYTES). 201 with the stored file, its encoding and the suggested kind and mapping.

Parametry

NázevKdeTypPovinnéPopis
tenantpathstring (uuid)anoPublic id of the company (tenant), a UUID: GET /api/v3/account-info answers it as data.guid; the app shows it on the API keys page.

Tělo požadavku (application/json)

object

Odpovědi

Chyby

StavKódHodnoty message
400validationfile
401401 unauthorized: missing, unknown, revoked, expired or idle API key.
403403 forbidden: message tenant (another company), scope (read-only key), api_key (person only), or the module the key's roles lack.
404not_found
429429 rate_limited: wait Retry-After seconds.

Preview an import: mapping, counts, problems

POST /api/v1/tenants/{tenant}/imports/preview

Oprávnění: modul contacts, úroveň full; klíč s přístupem full · Nástroj MCP: preview_import

What an import would do with the file: counts per action and the first rows.

Parametry

NázevKdeTypPovinnéPopis
tenantpathstring (uuid)anoPublic id of the company (tenant), a UUID: GET /api/v3/account-info answers it as data.guid; the app shows it on the API keys page.

Tělo požadavku (application/json)

PoleTypPovinnéPopis
fileIdstringano
mappingImportMappingano
modeone of: upsert, update_only, unsubscribe, remove, blacklistano
kindone of: csv, shoptet_customers, shoptet_newsletterneDefault csv.
subscribersConfirmedbooleanneA Shoptet newsletter export without a consent column: the person confirmed that every row is an active subscriber (required, 400 subscribers otherwise).
shopIdstringanoMain shop of new contacts; lists must belong to it or to the whole company.
listIdsarray of stringano

Odpovědi

Chyby

StavKódHodnoty message
400validation
401401 unauthorized: missing, unknown, revoked, expired or idle API key.
403403 forbidden: message tenant (another company), scope (read-only key), api_key (person only), or the module the key's roles lack.
404not_found
429429 rate_limited: wait Retry-After seconds.

Get an import with its progress and result

GET /api/v1/tenants/{tenant}/imports/{import_id}

Oprávnění: modul contacts, úroveň read; klíč s přístupem read nebo full

Parametry

NázevKdeTypPovinnéPopis
tenantpathstring (uuid)anoPublic id of the company (tenant), a UUID: GET /api/v3/account-info answers it as data.guid; the app shows it on the API keys page.
import_idpathstringanoId of the import (string of digits).

Odpovědi

Chyby

StavKódHodnoty message
400validation
401401 unauthorized: missing, unknown, revoked, expired or idle API key.
403403 forbidden: message tenant (another company), scope (read-only key), api_key (person only), or the module the key's roles lack.
404not_found
429429 rate_limited: wait Retry-After seconds.

Delete an import record

DELETE /api/v1/tenants/{tenant}/imports/{import_id}

Oprávnění: modul contacts, úroveň full; klíč s přístupem full

SE "Odstranit import": only a draft (409 status for an import that started).

Parametry

NázevKdeTypPovinnéPopis
tenantpathstring (uuid)anoPublic id of the company (tenant), a UUID: GET /api/v3/account-info answers it as data.guid; the app shows it on the API keys page.
import_idpathstringanoId of the import (string of digits).

Odpovědi

  • 204 No content

Chyby

StavKódHodnoty message
400validation
401401 unauthorized: missing, unknown, revoked, expired or idle API key.
403403 forbidden: message tenant (another company), scope (read-only key), api_key (person only), or the module the key's roles lack.
404not_found
409conflictstatus
429429 rate_limited: wait Retry-After seconds.

Schémata

Error

PoleTypPovinnéPopis
errorobjectano
json
{
  "error": {
    "code": "validation",
    "message": "email"
  }
}

ExportField

PoleTypPovinnéPopis
idstringanodf_* system field or cf_<id> custom field.
kindone of: custom, contactano
namestringanoCustom fields: their name (tenant data); system fields are named by the UI.
typestringano

ExportInput

PoleTypPovinnéPopis
namestringano
selectionone of: bounced, blacklisted, all, listsano
listIdsarray of stringne
fieldsarray of stringano
purposeIdsarray of stringne
encodingone of: utf-8, windows-1250ano

ExportStatus

one of: queued, running, finished, failed

ExportSummary

PoleTypPovinnéPopis
idstringano
namestringano
statusExportStatusano
selectionone of: bounced, blacklisted, all, listsano
listIdsarray of stringano
fieldsarray of stringano
purposeIdsarray of stringano
encodingone of: utf-8, windows-1250ano
rowCountnumber or nullano
fileNamestring or nullano
downloadablebooleananoThe file exists and its link has not expired.
downloadsnumberano
createdAtstringano
finishedAtstring or nullano
expiresAtstring or nullano
listNamesarray of stringneNames of the chosen lists in their order (SE's column Seznamy); older servers leave it out.

ImportCounts

PoleTypPovinnéPopis
rowsnumberano
createnumberano
updatenumberano
skipSuppressednumberanoUnsubscribed, bounced, complained or suppressed: never re-subscribed and not changed.
skipMissingnumberanoupdate_only and the address is not a contact.
invalidnumberano
duplicatenumberanoSame address earlier in the file.
unsubscribenumberanoOpt-out modes: unsubscribed from the lists, removed from them, put on the blacklist.
removenumberano
blacklistnumberano

ImportDetail

PoleTypPovinnéPopis
sourcestringano
purposeIdstringano
addedToListsnumberanoNew list memberships.
errorsarray of ImportRowProblemanoFirst 50 invalid rows.
reportImportReport or nullanonull until finished.
runAutomationsbooleanneThe import starts automations (ImportRequest.runAutomations); false by default.
optionsImportOptionsne
idstringano
namestringano
statusone of: queued, running, draft, finished, failedano
kindone of: csv, shoptet_customers, shoptet_newsletterano
fileNamestringano
shopIdstringano
modeone of: upsert, update_only, unsubscribe, remove, blacklistano
listIdsarray of stringano
createdAtstringano
startedAtstring or nullanoWhen the run started (null while queued).
finishedAtstring or nullano
progressobjectanoRows the run has processed so far (it commits batch by batch).
countsImportCounts or nullanonull until finished.
listNamesarray of stringneNames of the chosen lists in their order (SE's column Seznamy; the grid only).

ImportDraft

SE "Rozpracováno": the summary, the wizard's state and the stored file while it lasts (24 hours).

PoleTypPovinnéPopis
sourcestringano
stateImportDraftStateano
fileImportFile or nullano
updatedAtstring or nullano
idstringano
namestringano
statusone of: queued, running, draft, finished, failedano
kindone of: csv, shoptet_customers, shoptet_newsletterano
fileNamestringano
shopIdstringano
modeone of: upsert, update_only, unsubscribe, remove, blacklistano
listIdsarray of stringano
createdAtstringano
startedAtstring or nullanoWhen the run started (null while queued).
finishedAtstring or nullano
progressobjectanoRows the run has processed so far (it commits batch by batch).
countsImportCounts or nullanonull until finished.
listNamesarray of stringneNames of the chosen lists in their order (SE's column Seznamy; the grid only).

ImportDraftInput

PoleTypPovinnéPopis
namestringne
sourcestringne
stepnumberne
stateImportDraftStatene
fileIdstring or nullne
shopIdstring or nullne

ImportDraftState

The wizard's own state of a draft import (opaque to the server, with the step).

PoleTypPovinnéPopis
stepnumberne
*anyne

ImportEncoding

one of: utf-8, windows-1250, utf-16

ImportFile

PoleTypPovinnéPopis
fileIdstringano
fileNamestringano
sizenumberanoBytes of the file as uploaded.
delimiterstringano; , tab or the one character the person chose.
quotestringneField enclosure (default ").
hasHeaderbooleannefalse = the first line is data and the columns have no names.
encodingImportEncodinganoWhat the server read the file as (detected).
columnsarray of stringanoHeader row.
rowCountnumberanoData rows without the header.
samplearray of array of stringanoFirst data rows as they are in the file.
suggestedKindone of: csv, shoptet_customers, shoptet_newsletteranoThe server's suggestion from the header names (Czech, Slovak, English, Shoptet).
suggestedMappingImportMappingano

ImportMapping

ImportMapping

ImportOptions

PoleTypPovinnéPopis
autofillobjectneFill empty fields from the first name and the address (SE "Automatické doplnění údajů ke kontaktu").
consentFromobjectneStart of the purpose consent: now, or one date for every row (a date column is the mapped newsletterConsentAt).
doiobjectneDouble opt-in e-mail instead of an immediate subscription (upsert and update_only).

ImportPlan

PoleTypPovinnéPopis
fileIdstringano
mappingImportMappingano
modeone of: upsert, update_only, unsubscribe, remove, blacklistano
kindone of: csv, shoptet_customers, shoptet_newsletterneDefault csv.
subscribersConfirmedbooleanneA Shoptet newsletter export without a consent column: the person confirmed that every row is an active subscriber (required, 400 subscribers otherwise).
shopIdstringanoMain shop of new contacts; lists must belong to it or to the whole company.
listIdsarray of stringano

ImportPreview

PoleTypPovinnéPopis
countsImportCountsano
rowsarray of ImportPreviewRowanoFirst 20 rows.
reportImportReportano

ImportPreviewRow

PoleTypPovinnéPopis
rownumberanoLine in the file, the header is line 1.
emailstringano
actionone of: invalid, unsubscribe, remove, blacklist, create, update, skip_suppressed, skip_missing, duplicateano
errorone of: email_missing, email_invalid, value_invalid, nullano
fieldone of: companyId, firstName, lastName, phone, country, street, city, language, note, email, company, mobile, postalCode, gender, fullName, titleBefore, titleAfter, birthday, newsletterConsent, newsletterConsentAt, registeredAt, nullanoThe field with an invalid value.
valuesobjectanoNormalized values that would be written.
consentboolean or nullanoWhether the row brings a newsletter consent (false = a customer only); null for invalid rows and opt-out modes.

ImportReport

Merge summary of an import: the consent of the rows, existing contacts and their other sources, values left out.

PoleTypPovinnéPopis
consentobjectano
mergeobjectano
droppedobjectanoValues of Shoptet files that did not fit and were left out, per field.

ImportRequest

PoleTypPovinnéPopis
namestringano
sourcestringanoWhere the contacts come from (se-spec 01 §7.1), e.g. a trade fair.
purposeIdstringnePurpose of processing given to the imported contacts. Optional for OPT_OUT_MODES (the server stores the tenant's first purpose when omitted; those modes write no consent).
consentConfirmedbooleanneThe user confirms a documented, valid purpose for every contact; must be true. Not required for OPT_OUT_MODES.
runAutomationsbooleanneExplicit opt-in: what the import writes starts automations (added to a list, subscribed, contact created ...). Default false: an import is a bulk write that starts none.
optionsImportOptionsneAutofill, start of the purpose consent and the double opt-in e-mail (SE wizard).
draftIdstringneThe wizard's draft this import comes from (deleted when the import starts).
fileIdstringano
mappingImportMappingano
modeone of: upsert, update_only, unsubscribe, remove, blacklistano
kindone of: csv, shoptet_customers, shoptet_newsletterneDefault csv.
subscribersConfirmedbooleanneA Shoptet newsletter export without a consent column: the person confirmed that every row is an active subscriber (required, 400 subscribers otherwise).
shopIdstringanoMain shop of new contacts; lists must belong to it or to the whole company.
listIdsarray of stringano

ImportRowProblem

PoleTypPovinnéPopis
rownumberano
errorone of: email_missing, email_invalid, value_invalidano
fieldone of: companyId, firstName, lastName, phone, country, street, city, language, note, email, company, mobile, postalCode, gender, fullName, titleBefore, titleAfter, birthday, newsletterConsent, newsletterConsentAt, registeredAt, nullano

ImportSummary

PoleTypPovinnéPopis
idstringano
namestringano
statusone of: queued, running, draft, finished, failedano
kindone of: csv, shoptet_customers, shoptet_newsletterano
fileNamestringano
shopIdstringano
modeone of: upsert, update_only, unsubscribe, remove, blacklistano
listIdsarray of stringano
createdAtstringano
startedAtstring or nullanoWhen the run started (null while queued).
finishedAtstring or nullano
progressobjectanoRows the run has processed so far (it commits batch by batch).
countsImportCounts or nullanonull until finished.
listNamesarray of stringneNames of the chosen lists in their order (SE's column Seznamy; the grid only).