REST API
Kargo exposes a REST API for programmatic access to platform resources.
The full interactive API reference, including all available endpoints, request/response schemas, and the ability to try requests directly, is available via Swagger:
https://api.kargo.zone/v1/docs/
Document Intake Swagger UI Guide
This guide explains how to use Kargo Swagger UI to send requests to POST /documents. The endpoint can create or update shipments, orders, and order items.
1A. Open Terminal on macOS
On macOS, press Command + Space to open Spotlight Search. Type Terminal, then click the Terminal application.

Run this command in Terminal. Replace <CLIENT_ID> and <CLIENT_SECRET> with the credentials provided by Kargo. Copy the returned access_token.
curl --request POST \
--url https://mykargo.us.auth0.com/oauth/token \
--header 'content-type: application/json' \
--data '{
"client_id": "<CLIENT_ID>",
"client_secret": "<CLIENT_SECRET>",
"audience": "https://api.kargo.zone/public_graphql",
"grant_type": "client_credentials"
}'
1B. Open Command Prompt on Windows
On Windows, open the Start menu, search for cmd or Command Prompt, then open the application.

Run this command in Command Prompt. Replace <CLIENT_ID> and <CLIENT_SECRET> with the credentials provided by Kargo. Copy the returned access_token.
curl.exe --request POST --url "https://mykargo.us.auth0.com/oauth/token" --header "content-type: application/json" --data "{\"client_id\":\"<CLIENT_ID>\",\"client_secret\":\"<CLIENT_SECRET>\",\"audience\":\"https://api.kargo.zone/public_graphql\",\"grant_type\":\"client_credentials\"}"
The response includes an access_token and token_type.

{
"access_token": "eyJhbGciOi...REDACTED",
"token_type": "Bearer"
}
2. Open Swagger UI and authorize
Open https://api.kargo.zone/v1/docs/. Click Authorize.

In the modal, paste the token value in this format:
Bearer <ACCESS_TOKEN>
Then click Authorize in the modal.

If the token is missing, expired, or invalid, the API returns 401 Unauthorized.
401 response if the token is missing, expired, or invalid
{
"type": "about:blank",
"title": "Unauthorized",
"status": 401,
"detail": "Missing or invalid bearer token."
}
Swagger sends the request without a usable bearer token, or the token is expired or invalid. Kargo rejects the request before processing the document body.
3. Open POST /documents and click Try it out
Scroll to the Documents section, expand POST /documents, then click Try it out.

4. Optional Correlation-Id
Correlation-Id is optional. It is useful for request tracing and log lookup. When supplied, Kargo returns the same value in the response.

5. Edit the request body and execute
In Request body, choose application/json for JSON requests. XML is also supported by using application/xml or text/xml. Select an example from the Examples dropdown, edit the body, then click Execute.

6. Example 1: Create an outbound order with five pallet items
This creates or updates a shipment and order, and creates the requested pallet items. This example omits orderItemUpdateStrategy; when items are provided without a strategy, Kargo defaults to OVERWRITE.
Request
{
"orderNumber": "TEST-EXAMPLE-ORDER-001",
"business": "kargo",
"facility": "sf",
"direction": "OUTBOUND",
"shipmentNumber": "TEST-EXAMPLE-SHIPMENT-001",
"items": [
{
"lpn": "LPNABC",
"sku": "SKU123",
"quantity": 10,
"quantityUnit": "CASE"
},
{
"lpn": "LPNABC",
"sku": "SKU456",
"quantity": 8,
"quantityUnit": "CASE"
},
{
"lpn": "LPNDEF",
"sku": "SKU789",
"quantity": 12,
"quantityUnit": "CASE"
},
{
"lpn": "LPNGHI",
"sku": "SKU123",
"quantity": 6,
"quantityUnit": "CASE"
},
{
"lpn": "LPNJKL",
"sku": "SKU999",
"quantity": 15,
"quantityUnit": "CASE"
}
]
}
Expected response: 201 when one or more entities are created
{
"created": [
{ "type": "SHIPMENT", "id": "6463000", "reference": "TEST-EXAMPLE-SHIPMENT-001" },
{ "type": "ORDER", "id": "1268000", "reference": "TEST-EXAMPLE-ORDER-001" },
{ "type": "ORDER_ITEM", "id": "3700001", "reference": "LPNABC" },
{ "type": "ORDER_ITEM", "id": "3700002", "reference": "LPNABC" },
{ "type": "ORDER_ITEM", "id": "3700003", "reference": "LPNDEF" },
{ "type": "ORDER_ITEM", "id": "3700004", "reference": "LPNGHI" },
{ "type": "ORDER_ITEM", "id": "3700005", "reference": "LPNJKL" }
],
"updated": [],
"removed": [],
"shipment": {
"id": 6463000,
"status": "SCHEDULED",
"orders": [
{
"orderNumber": "TEST-EXAMPLE-ORDER-001",
"status": "CREATED",
"items": [
{ "lpn": "LPNABC", "sku": "SKU123", "quantity": 10, "quantityUnit": "CASE", "id": "3700001" },
{ "lpn": "LPNABC", "sku": "SKU456", "quantity": 8, "quantityUnit": "CASE", "id": "3700002" },
{ "lpn": "LPNDEF", "sku": "SKU789", "quantity": 12, "quantityUnit": "CASE", "id": "3700003" },
{ "lpn": "LPNGHI", "sku": "SKU123", "quantity": 6, "quantityUnit": "CASE", "id": "3700004" },
{ "lpn": "LPNJKL", "sku": "SKU999", "quantity": 15, "quantityUnit": "CASE", "id": "3700005" }
]
}
]
}
}
How this response is generated: Kargo validates orderNumber, business, facility, and direction. business is the business slug and facility is the facility slug. It finds or creates the shipment using shipmentNumber, then finds or creates the order using orderNumber.
Item validation: because this request creates items through the default OVERWRITE strategy, every incoming item must include lpn, sku, quantity, and quantityUnit. If any required item field is missing, Kargo returns 422 Unprocessable Entity. Kargo also checks that the incoming request does not contain duplicate lpn + sku pairs.
Why this response is 201: the response includes new entities in created. In this example, Kargo created a shipment, an order, and order items.
How references are set: shipment references use shipmentNumber. If shipmentNumber is missing, the shipment reference uses orderNumber. Order references use orderNumber. Order item references use identifier when provided; otherwise they use lpn, then sku.
If shipmentNumber is missing: Kargo uses orderNumber as the shipment number. This is allowed, but it can make shipment tracking confusing.
If shipmentNumber is different from the order's current shipment: Kargo finds or creates the shipment for the new shipmentNumber. If the existing order is on another eligible shipment, the order may be remapped to the new shipment first, then OVERWRITE replaces the items on that remapped order. The old shipment is eligible only when it has not arrived and is not linked to another shipment.
If orderNumber is duplicated: Kargo chooses the most recently created eligible order with the same business, facility, direction, and order number.
Important for OVERWRITE: because no strategy is provided and items are present, this request behaves like OVERWRITE. Any existing item that is not included in the request is removed. Always send the complete desired item list.
Repeated request response: 201 with replaced items
{
"created": [
{ "type": "ORDER_ITEM", "id": "3700006", "reference": "LPNABC" },
{ "type": "ORDER_ITEM", "id": "3700007", "reference": "LPNABC" },
{ "type": "ORDER_ITEM", "id": "3700008", "reference": "LPNDEF" },
{ "type": "ORDER_ITEM", "id": "3700009", "reference": "LPNGHI" },
{ "type": "ORDER_ITEM", "id": "3700010", "reference": "LPNJKL" }
],
"updated": [
{ "type": "SHIPMENT", "id": "6463000", "reference": "TEST-EXAMPLE-SHIPMENT-001" },
{ "type": "ORDER", "id": "1268000", "reference": "TEST-EXAMPLE-ORDER-001" }
],
"removed": [
{ "type": "ORDER_ITEM", "id": "3700001", "reference": "LPNABC" },
{ "type": "ORDER_ITEM", "id": "3700002", "reference": "LPNABC" },
{ "type": "ORDER_ITEM", "id": "3700003", "reference": "LPNDEF" },
{ "type": "ORDER_ITEM", "id": "3700004", "reference": "LPNGHI" },
{ "type": "ORDER_ITEM", "id": "3700005", "reference": "LPNJKL" }
],
"shipment": {
"id": 6463000,
"orders": [
{
"orderNumber": "TEST-EXAMPLE-ORDER-001",
"items": [
{ "lpn": "LPNABC", "sku": "SKU123", "id": "3700006" }
]
}
]
}
}
Why this repeated response is 201: the shipment and order already exist, so they appear in updated. The strategy is still OVERWRITE, so Kargo removes the old order item rows and creates new order item rows with the same item content. Because new order items were created, the response code is 201. The lpn, sku, quantity, and quantityUnit can look the same as the previous response, but the order item id values are different.
7. Example 2: Append an order item
APPEND adds incoming items and keeps existing order items.
Request
{
"orderNumber": "TEST-EXAMPLE-ORDER-001",
"business": "kargo",
"facility": "sf",
"direction": "OUTBOUND",
"shipmentNumber": "TEST-EXAMPLE-SHIPMENT-001",
"orderItemUpdateStrategy": "APPEND",
"items": [
{
"lpn": "LPNNEW",
"sku": "SKUAPPEND",
"quantity": 1,
"quantityUnit": "UNIT"
}
]
}
Expected response: 201 when one or more entities are created
{
"created": [
{ "type": "ORDER_ITEM", "id": "3700011", "reference": "LPNNEW" }
],
"updated": [
{ "type": "SHIPMENT", "id": "6463000", "reference": "TEST-EXAMPLE-SHIPMENT-001" },
{ "type": "ORDER", "id": "1268000", "reference": "TEST-EXAMPLE-ORDER-001" }
],
"removed": [],
"shipment": {
"id": 6463000,
"orders": [
{
"orderNumber": "TEST-EXAMPLE-ORDER-001",
"items": [
{ "lpn": "LPNNEW", "sku": "SKUAPPEND", "quantity": 1, "quantityUnit": "UNIT", "id": "3700011" }
]
}
]
}
}
How this response is generated: Kargo finds the matched shipment and order, then validates each incoming item. For APPEND, every incoming item must include lpn, sku, quantity, and quantityUnit. If any required item field is missing, Kargo returns 422 Unprocessable Entity. Kargo checks that the incoming request does not contain duplicate lpn + sku pairs, and that the matched order does not already have the same lpn + sku.
Why this response is 201: the shipment and order already exist, so they appear in updated. The new order item appears in created, so the response code is 201.
How references are set: shipment references use shipmentNumber. Order references use orderNumber. Order item references use identifier when provided; otherwise they use lpn, then sku.
If shipmentNumber is missing: Kargo uses orderNumber as the shipment number before finding the order.
If shipmentNumber is different from the order's current shipment: Kargo finds or creates the shipment for the new shipmentNumber. If the existing order is on another eligible shipment, the order may be remapped to the new shipment first, then APPEND adds the incoming item to that remapped order. The old shipment is eligible only when it has not arrived and is not linked to another shipment.
If orderNumber is duplicated: Kargo chooses the most recently created eligible order with the same business, facility, direction, and order number. APPEND is applied to that matched order.
Important for APPEND: APPEND is for creating new items only. If the same lpn + sku already exists on the matched order, Kargo returns 409 Conflict. Use MERGE to update an existing item, or OVERWRITE to replace the full item list.
Repeated APPEND response: 409 duplicate item key
{
"type": "about:blank",
"title": "Conflict",
"status": 409,
"detail": "DUPLICATE_ORDER_ITEM_KEY: lpn=LPNNEW, sku=SKUAPPEND"
}
Why this repeated response is 409: the item key LPNNEW + SKUAPPEND already exists on the order. APPEND only creates new items and does not update existing items, so Kargo rejects the request with 409 Conflict.
8. Example 3: Merge an order item by LPN + SKU
MERGE updates an existing item when the incoming lpn + sku matches an existing item. If no item matches, it creates a new item.
Request
{
"orderNumber": "TEST-EXAMPLE-ORDER-001",
"business": "kargo",
"facility": "sf",
"direction": "OUTBOUND",
"shipmentNumber": "TEST-EXAMPLE-SHIPMENT-001",
"orderItemUpdateStrategy": "MERGE",
"items": [
{
"lpn": "LPNABC",
"sku": "SKU123",
"quantity": 5,
"quantityUnit": "CASE"
}
]
}