Report completion: shipped or handed over
POST /v1/orders/{id}/completion
Reports that one of your own API orders was shipped outside the Meykt warehouse (kind=shipped, tracking numbers optional) or handed over without a package (kind=handed_over with handover_kind). The order is then shipped or completed respectively. The same idempotency_key with the same content returns 200 and the same report; different content returns 409 idempotency_conflict. One report applies per order; you can only take it back in Meykt. Rejected (409 operation_state_conflict, errors[].message names the reason): already completed, cancelled, handed over to a fulfiller (the fulfiller reports), shipped, picked or reserved in the Meykt warehouse, dispatch sections in use.
Required scopes: "orders:complete".
#Parameters
#path: id
Required. Meykt ID of an order of this API channel and this environment.
| Field | Type | Presence | null | Meaning, limits and examples |
|---|---|---|---|---|
| $ (whole value) | string | Whole value | Not allowed | format: "uuid". |
#Request body
Request body required.
Content type: application/json
| Field | Type | Presence | null | Meaning, limits and examples |
|---|---|---|---|---|
| $ (whole value) | object | Whole value | Not allowed | When {"properties":{"kind":{"const":"handed_over"}},"required":["kind"]} matches, the then rules apply; otherwise the else rules apply. Examples: [{"idempotency_key":"33333333-3333-4333-8333-333333333333","kind":"shipped","tracking":[{"carrier":"DHL","number":"EXAMPLE-TRACKING-1"}]},{"idempotency_key":"33333333-3333-4333-8333-333333333333","kind":"handed_over","handover_kind":"picked_up"}]. Additional properties are not allowed. |
| kind | string | Required when parent is present | Not allowed | shipped records shipment outside the Meykt warehouse; handed_over records completion without a package. enum: ["shipped","handed_over"]. |
| handover_kind | string | Optional | Not allowed | Required exactly when kind is handed_over. outside_meykt means complete without claiming a shipment or physical handover. enum: ["picked_up","on_site","in_person","not_required","outside_meykt"]. |
| completed_at | string | Optional | Not allowed | Time of shipment or handover; defaults to now. Must be within the last 400 days and no more than five minutes in the future. format: "date-time". |
| tracking | array | Optional | Not allowed | Tracking numbers for shipped reports only. Omit or send an empty list for handed_over; no duplicate numbers. maxItems: 10. x-meykt-unique-by: [["number"]]. |
| tracking[] | object | Every array item | Not allowed | Additional properties are not allowed. |
| tracking[].carrier | string | Required when parent is present | Not allowed | Carrier name without line breaks, control characters or angle brackets. minLength: 1. maxLength: 80. pattern: "^[^\\p{Cc}<>]+$". |
| tracking[].number | string | Required when parent is present | Not allowed | Tracking number, unique within this list; letters, digits, spaces and . / _ - only, starting with a letter or digit. minLength: 1. maxLength: 120. pattern: "^[A-Za-z0-9][A-Za-z0-9 ./_-]*$". |
| note | string | Optional | Not allowed | Optional note accompanying the completion report. minLength: 1. maxLength: 500. |
| idempotency_key | string | Required when parent is present | Not allowed | UUID for this completion report; keep it unchanged on an identical retry. format: "uuid". |
| $ (whole value) | object | Conditional: then | Allowed by schema | When {"properties":{"kind":{"const":"handed_over"}},"required":["kind"]} matches. |
| tracking | any JSON value | Optional | Allowed by schema | When {"properties":{"kind":{"const":"handed_over"}},"required":["kind"]} matches. maxItems: 0. |
| $ | requirement | Required: handover_kind | See field type | When {"properties":{"kind":{"const":"handed_over"}},"required":["kind"]} matches. |
| $ (whole value) | any JSON value | Conditional: else | Not allowed | Unless {"properties":{"kind":{"const":"handed_over"}},"required":["kind"]} matches. not: {"required":["handover_kind"]}. |
#Response 200, 201
200: Success; see the status meaning of the operation. 201: Success
Content type: application/json
| Field | Type | Presence | null | Meaning, limits and examples |
|---|---|---|---|---|
| $ (whole value) | object | Whole value | Not allowed | — |
| data | object | Required when parent is present | Not allowed | Authorized response payload or documented event data. |
| data.order_id | string | Required when parent is present | Not allowed | Meykt order ID from authorized reads; not order number/external reference. format: "uuid". |
| data.kind | string | Required when parent is present | Not allowed | Kind selects required fields. enum: ["shipped","handed_over"]. |
| data.handover_kind | string or null | Required when parent is present | Allowed by schema | outside_meykt = completed without a shipment or handover recorded in Meykt ("Just complete"). enum: ["picked_up","on_site","in_person","not_required","outside_meykt",null]. |
| data.reported_by | string | Required when parent is present | Not allowed | api = this channel, meykt = the Meykt interface or AI access, automatic = the setting "Hand over after production". enum: ["api","meykt","automatic"]. |
| data.completed_at | string | Required when parent is present | Not allowed | Time the shipment or handover was completed. format: "date-time". |
| data.note | string or null | Required when parent is present | Allowed by schema | Human-readable note accompanying this order or operation. |
| data.tracking | array | Required when parent is present | Not allowed | Tracking numbers; each number at most once. maxItems: 10. |
| data.tracking[] | object | Every array item | Not allowed | Additional properties are not allowed. |
| data.tracking[].carrier | string | Required when parent is present | Not allowed | Name of the carrier, e.g. GLS. minLength: 1. maxLength: 80. |
| data.tracking[].number | string | Required when parent is present | Not allowed | Tracking number or package sequence number, as indicated by this object and its type. minLength: 1. maxLength: 120. pattern: "^[A-Za-z0-9][A-Za-z0-9 ./_-]*$". |
#Response 400, 401, 403, 404, 409, 422, 429, 500, 503
400: The request is not valid JSON. 401: The key is missing, unknown, revoked or expired. 403: The key lacks a required scope, or the operation requires a live key. 404: Not found. Also applies to IDs that belong to another organization — we deliberately do not distinguish between "does not exist" and "does not belong to you". 409: The same ID already exists with different content. It is never overwritten. 422: Content validation failed. The response lists all affected locations at once. 429: A rate limit was reached and the request did not run. Wait for Retry-After, then repeat it unchanged. X-RateLimit-Scope names the limit: key (120 requests per minute), organization (300 per minute across all keys), write (1,000 at once, refilling at 60 per minute) or list (300 unfiltered list pages at once, refilling at 10 per minute). 500: Unexpected error on our side. 503: Temporarily unavailable. Repeat the same request with the same business identity.
Content type: application/json
| Field | Type | Presence | null | Meaning, limits and examples |
|---|---|---|---|---|
| $ (whole value) | object | Whole value | Not allowed | — |
| error | object | Required when parent is present | Not allowed | Machine-readable error code; use it to select the documented recovery path. |
| error.code | string | Required when parent is present | Not allowed | Machine-readable, permanently stable error code. Program against it, not against message. |
| error.message | string | Required when parent is present | Not allowed | Explanation for humans. May change at any time. |
| error.field | string | Optional | Not allowed | Affected location in the request, if it can be determined. |
| error.doc_url | string | Required when parent is present | Not allowed | Documentation link explaining this API error. format: "uri". |
Machine-readable version of this page: https://www.meykt.com/developers/fields-create-order-completion.md