Productsup
Container API

HTTP API

Call the Container API directly over HTTP from any language.

17 min read

The Container API is a standard REST API at http://cde-container-api (port 80). No authentication is needed — it's only accessible from inside the container environment. You can call it from any language using HTTP requests.

Each example below shows the PHP SDK equivalent alongside the raw HTTP request, so you can see what happens under the hood.

Write products to output

Used by data source connectors to import product data into the platform.

PHP SDK:

$this->containerApi->appendManyToOutputFile([
    ['id' => '1', 'name' => 'Product A', 'price' => '9.99'],
    ['id' => '2', 'name' => 'Product B', 'price' => '19.99'],
]);

HTTP:

curl -X POST http://cde-container-api/output/output \
  -H "Content-Type: application/json" \
  -d '{
    "data": [
      {"id": "1", "name": "Product A", "price": "9.99"},
      {"id": "2", "name": "Product B", "price": "19.99"}
    ]
  }'

Response (201):

{
  "message": "Written successfully."
}

The data field is an array of flat key-value objects. Each object represents one product. The optional meta.separator field controls how nested keys are flattened (default: -).

Endpoint reference: Write to output file

Read products from input

Used by export connectors to read all processed product data from the platform.

Read one product at a time

PHP SDK:

foreach ($this->containerApi->yieldFromInputFile() as $product) {
    // process $product
}

HTTP:

# Read the next product
curl http://cde-container-api/input/input/next

Response (200):

{
  "message": "",
  "data": {
    "id": "1",
    "name": "Product A",
    "price": "9.99"
  }
}

Each call returns one product and advances the cursor. When there are no more products, data is empty. Call /input/input/restart to reset the cursor.

Endpoint reference: Read input file

Read products in batches

PHP SDK:

foreach ($this->containerApi->yieldBatchFromInputFile(100) as $batch) {
    // process $batch (array of up to 100 products)
}

HTTP:

# Read a batch of 100 products
curl "http://cde-container-api/input/input/next_batch?size=100"

Response (200):

{
  "message": "",
  "data": [
    {"id": "1", "name": "Product A", "price": "9.99"},
    {"id": "2", "name": "Product B", "price": "19.99"}
  ]
}

Batch size must be between 1 and 999.

Endpoint reference: Read input file batch

Count items

PHP SDK:

$total = $this->containerApi->countItemsFromInputFile();

HTTP:

curl http://cde-container-api/items/input/count

Response (200):

{
  "message": "",
  "data": 1500
}

Endpoint reference: Items count

Read delta input

Used by export-delta connectors. Instead of a single input type, use new, modified, unchanged, or deleted.

PHP SDK:

foreach ($this->containerApi->yieldFromNewFile() as $product) { }
foreach ($this->containerApi->yieldFromModifiedFile() as $product) { }
foreach ($this->containerApi->yieldFromDeletedFile() as $product) { }

HTTP:

curl "http://cde-container-api/input/new/next_batch?size=100"
curl "http://cde-container-api/input/modified/next_batch?size=100"
curl "http://cde-container-api/input/deleted/next_batch?size=100"

The response format is the same as regular input. Replace input in the URL with the delta type.

Stream a whole file

Whole-file streams move a whole file in one request per direction: GET /input/{type}/stream reads input, new, modified, unchanged, or deleted, and POST /output/{type}/stream writes output or feedback. The PHP SDK 1.5.0+ calls them through streamFromFile() and streamToFile(). See Whole-file streams for the client setup.

Both bodies are application/octet-stream: a sequence of frames, each made of a kind (1 byte), the payload length (4-byte unsigned big-endian integer), and the payload.

KindFramePayload
0x01ITEMOne item as a MessagePack map, or as an array when the item's keys are exactly 0..n-1
0x02ENDThe item count as an 8-byte unsigned big-endian integer, so the frame is 13 bytes
0x03ERRORA MessagePack map {"message": "..."}

END is the last frame of a complete stream. When a read fails after the 200 response, the Container API sends an ERROR frame instead of END. Only responses carry ERROR frames: a request that contains one gets 400.

In a response, column names that are numbers, such as 2024, arrive as integer map keys: decode each item with a general MessagePack unpack, not into a map with string keys.

Read a whole file

PHP SDK:

foreach ($this->containerApi->streamFromFile('input') as $product) { }

HTTP:

curl -sS --output items.bin "http://cde-container-api/input/input/stream"

Response (200, application/octet-stream): an ITEM frame per item, then an END frame.

To read an export-delta file, put new, modified, unchanged, or deleted in place of the second input, for example /input/new/stream. Optional query parameters:

ParameterDescription
show-hidden1 adds the columns whose names start with ___, which are hidden by default. The value is an integer, 1 or 0: show-hidden=true gets 400.
classification-idClassification ID as an integer, for the CSA export-delta files new, modified, and unchanged; deleted answers 404 with it

If the read fails before the first item, the response is JSON: 404 with Requested file not provided., 400 when a query value is not an integer, or 500 with Invalid file. After the 200 response, an ERROR frame means the read failed, and a response without an END frame is truncated.

Endpoint reference: Stream from file

Write a whole file

PHP SDK:

// $products is a \Generator that yields product arrays
$this->containerApi->streamToFile('output', $products);

HTTP:

curl -X POST "http://cde-container-api/output/output/stream" \
  -H "Content-Type: application/octet-stream" \
  --data-binary @items.bin

Response (201):

{
  "message": "Written successfully."
}

To build the body with any MessagePack library, write 0x01, the payload length (4 bytes, big-endian), and the MessagePack payload for each item, then 0x02, the length 8, and the item count (8 bytes, big-endian). Chunked transfer and a declared Content-Length both work. To write the feedback file, use /output/feedback/stream.

A body that does not end with a valid END frame writes nothing and gets 400. Other 400 responses come while items are being written: a malformed frame, an item that cannot be decoded or is not a map or array, an empty or duplicate column name, or an END count that does not match the items sent. Items written before such a rejection stay in the file, so treat a rejected write as a failed run. The write gets 409 when the size limit is reached, and 415 for any Content-Type other than application/octet-stream.

Endpoint reference: Stream to file

Stream API

Used by stream connectors — connectors that exchange data with the platform through the Stream API rather than as batch files. Instead of reading and writing whole files, they read items from an input stream and write items to an output stream, one batch at a time, tracking their position with offsets so each run picks up where the previous one left off. The Container API proxies these calls to the Stream API and handles authentication, rate limiting, and retries for you. Stream ids are resolved server-side from the run context, so you address the endpoints simply as input-stream and output-stream.

The typical loop is: read a batch of items → process them → write results to the output stream → commit the offsets you handled. Repeat until the input reports complete.

Read items from the input stream

Items are returned as newline-delimited JSON (application/x-ndjson) — one record per line. Each line is one of: item (a data record), complete (no more items), incomplete (the server reached its time budget — call again to continue), or error.

curl http://cde-container-api/stream-api/input-stream/items \
  -H "Accept: application/x-ndjson"

Response (200, application/x-ndjson):

{"item":{"partition":0,"offset":42,"payload":"{\"id\":\"1\",\"name\":\"Product A\"}","headers":{}}}
{"item":{"partition":0,"offset":43,"payload":"{\"id\":\"2\",\"name\":\"Product B\"}","headers":{}}}
{"complete":{"reason":"eof_reached"}}

Read line by line and act on the frame type. On incomplete, issue the same request again to resume from where you left off.

Endpoint reference: Read input-stream items

Read and commit input-stream offsets

Offsets track how far your connector has consumed each partition. Read the last committed offsets:

curl http://cde-container-api/stream-api/input-stream/offsets \
  -H "Accept: application/vnd.api+json"

Response (200):

{
  "data": {
    "type": "consumer-offsets",
    "id": "<consumer-id>",
    "attributes": { "offsets": [ { "partition": 0, "offset": 43 } ] }
  }
}

Commit the offsets you have finished processing so a restart resumes past them (at-least-once). Send the offset of the next record to read:

curl -X PATCH http://cde-container-api/stream-api/input-stream/offsets \
  -H "Content-Type: application/vnd.api+json" \
  -d '{"data":{"type":"consumer-offsets","attributes":{"offsets":[{"partition":0,"offset":44}]}}}'

Commit after you have written the corresponding output (send-then-commit) — that way a failure only ever redelivers the in-flight batch instead of dropping it.

Endpoint reference: Read offsets · Commit offsets

Write items to the output stream

Send items as newline-delimited JSON — one item per line. The HTTP method selects the write mode:

MethodMode
POSTCreate items
PUTReplace items
PATCHUpdate items
DELETEDelete items
curl -X POST http://cde-container-api/stream-api/output-stream/items \
  -H "Content-Type: application/x-ndjson" \
  --data-binary $'{"id":"1","name":"Product A","price":"9.99"}\n{"id":"2","name":"Product B","price":"19.99"}\n'

Response (200):

{ "message": "Items written to output stream." }

Endpoint reference: Create · Replace · Update · Delete

Delete all items from the output stream

To clear the output stream before a full rewrite, delete with all=true:

curl -X DELETE "http://cde-container-api/stream-api/output-stream/items?all=true" \
  -H "Accept: application/vnd.api+json"

Write feedback

Used by export and export-delta connectors to report the products they could not export. Write feedback for failures only — a row per successful product adds volume to the end-user's feed without adding information.

Feedback has no fixed schema. The keys you send become the columns of the feedback file, so pick fields that help an end-user diagnose the failure. The only constraints are that no column name is empty and that no column is sent twice.

PHP SDK:

$this->containerApi->appendToFeedbackFile([
    'id'      => $product['id'],
    'error'   => 'invalid_sku',
    'message' => 'SKU contains unsupported characters',
]);

// Or in bulk
$this->containerApi->appendManyToFeedbackFile([
    ['id' => '2', 'error' => 'invalid_sku', 'message' => 'SKU contains unsupported characters'],
    ['id' => '7', 'error' => 'missing_attribute', 'message' => 'Missing required attribute: gtin'],
]);

HTTP:

curl -X POST http://cde-container-api/output/feedback \
  -H "Content-Type: application/json" \
  -d '{
    "data": [
      {"id": "2", "error": "invalid_sku", "message": "SKU contains unsupported characters"},
      {"id": "7", "error": "missing_attribute", "message": "Missing required attribute: gtin"}
    ]
  }'

Response (201):

{
  "message": "Written successfully."
}

Feedback is imported as an additional data source on the next site run, so end-users can see which products failed and why.

Endpoint reference: Write to output file (feedback uses the same endpoint with type feedback)

Log messages

Log messages appear in the Dev Portal monitoring.

PHP SDK:

$this->containerApi->info('Import started.');
$this->containerApi->warning('Skipped 3 products with missing IDs.');
$this->containerApi->error('API returned 503, retrying...');

HTTP:

# Log levels: debug, info, notice, warning, error, critical, alert, emergency
curl -X POST http://cde-container-api/activity/logs/info \
  -H "Content-Type: application/json" \
  -d '{
    "message": "Import started.",
    "context": {}
  }'

Response (201):

{
  "message": "success"
}

The context field is optional — use it to attach structured data to the log entry.

Endpoint reference: Add log

Send notifications

Notifications appear in the end-user's notification panel on the ProductsUp platform.

PHP SDK:

$this->containerApi->sendNotification('info', 'Export completed successfully.');

HTTP:

# Notification levels: info, notice, warning, error, success
curl -X POST http://cde-container-api/activity/notifications/info \
  -H "Content-Type: application/json" \
  -d '{
    "message": "Export completed successfully.",
    "context": {}
  }'

Response (201):

{
  "message": "success"
}

Endpoint reference: Add notification

Health check

Verify the Container API is running and ready.

curl http://cde-container-api/ping

Response (200):

{
  "message": "pong"
}

Endpoint reference: Ping

Error responses

All error responses follow the same format:

{
  "message": "Validation failed",
  "errors": {
    "field_name": "Error description"
  }
}
StatusMeaning
201Write successful
200Read successful
400Invalid request — check message and the errors object
404File not found — wrong input type for your connector type
409Output file size limit exceeded
415Unsupported media type: a whole-file stream write needs Content-Type: application/octet-stream
429Rate limit exceeded (logs or notifications)
500Internal server error

See Troubleshooting for detailed fixes for each error.

Generating a typed client

The Container API publishes an OpenAPI specification. You can generate a typed client in any language using tools like OpenAPI Generator or oapi-codegen (Go).

For the full endpoint reference, see API Reference.

On this page

Still stuck?

Reach out to our support team and we’ll help you get unstuck.

Contact support