Skip to main content
When your system is connected through an integration that receives data by push, you send its records to Elastly through the API: catalog items with cost and stock, customers, and quotes, orders, invoices and credits. Send small changes as they happen and large loads as a bulk file. This page covers the connector key, the record format, both ways to send and how to read the result of each record.
The API reference playground sends requests to production with your own API key. A create, update or import request sent from it changes the live data of your workspace.

Get a connector key

The data endpoints accept only a Connector key. A connector key belongs to one integration, and every record it sends lands in that integration. On the integration’s page, select Create key on the Connector keys card, then copy the key; it is shown once. A connector key is always a live key. Rotate and revoke it from the same card. If the integration cannot accept data, requests are refused with 409 and connection_unavailable.

Record format

Every record has the same envelope. A record with an older version than the one already stored is not applied and is reported as stale. The API reference lists every field of catalog items, customers and documents.

Send records as they change

PUT /v1/catalog/items, PUT /v1/customers and PUT /v1/documents each take up to 100 records in a body of up to 2 MiB. Each request needs an Idempotency-Key. See Idempotency.
The response is 202 with an importId and one entry per record, in request order, with its index, externalKey, state and any errors.

Send a bulk file

For a large load, send one file per import.
1

Create the import

POST /v1/imports with the object (catalog_items, customers or documents) and the format (jsonl or csv). Documents are imported as jsonl only. Send an Idempotency-Key. The response is 201 with the import’s id and the state awaiting_file.
2

Upload the file

PUT /v1/imports/{id}/file with the file as the body and Content-Type set to application/x-ndjson for jsonl or text/csv for csv. The file is up to 100 MiB, and each record up to 1 MiB. Uploading again before the import starts replaces the file.
3

Start the import

POST /v1/imports/{id}/commit with an Idempotency-Key. The response is 202 and the import is queued.
4

Follow the import

GET /v1/imports/{id} returns its state and counts. When it finishes, the workspace emits an import.completed event. See Webhooks and events.

Echo the price on an order line

When an order line was sold at a price Elastly served, send that price’s priceId on the line. Elastly links the order line to the exact price decision, so the outcome of that price is known. The priceId comes from a priced line of POST /v1/price or from a channel price. A line of an order document, with the price echoed:
  • priceId is optional and applies to order lines. A line can also carry the version that came with the price; it is accepted for reference and not stored. A version without a priceId is a field error.
  • The line is linked only when the price was served for the same item and the same customer as the order.
  • A priceId that does not match a price served to the workspace does not fail the record. The record is imported without it, and the record’s result carries a notice with the code price_id_unknown and the message “The price id does not match a price served to this workspace. The line was imported without it.”

Read the result of each record

GET /v1/imports/{id}/records lists the result of every record by line, with up to 1,000 per page. Filter with state to see only the records that need attention. Every create or update request also returns an importId that you can read the same way. A record’s result also has notices: remarks about a record that was still imported, each with a field, a code and a message. A record that stays unresolved for 48 hours fails with the message “The referenced records were not received within 48 hours.” followed by the missing keys. Send the missing records and then the failed record again.