Correct a receipt

Stable throughout v1

Corrects received or rejected counts, rejection reasons, vendor unit costs and receipt charges, adds missed items through add_lines and returns the correction details; one reason covers the changes, and Shopify stock updates follow in the background. Returns 409 PURCHASE_ORDER_STALE if the receipt changed since expected_updated_at; reopen a finalized purchase order before correcting its receipt.

PATCH/purchase-orders/{id}/receipts/{receiptId}
Base URLhttps://api.meetorderpilot.com/connect/v1
Stable throughout v1

Required access

API key
Any ofManage purchase ordersEnter and correct costspermissions
Request limit
Counts as 5 requests. Each key has a capacity of 15, restored at 0.6 a second.
Idempotency-Key requiredRetry with the same key and body to get the original response without repeating the change. The response includes Idempotent-Replayed: true. Responses are saved for 24 hours.

Headers

AuthorizationheaderRequired

Bearer and your key, opk_….

Idempotency-KeyheaderRequired

Up to 100 characters (letters, digits, - _ : .). Kept for 24 hours.

Content-Typeheader

application/json. A body is at most 256 KB.

Parameters

idpath · stringRequired

The purchase order’s id.

receiptIdpath · stringRequired

The receipt’s id from GET /purchase-orders/{id}/receipts.

Body

JSON
add_linesarray of objectOptional

Items that arrived with this delivery but were missed at check-in.

line_idstringRequired

A purchase order line not yet on this receipt.

received_quantityintegerRequired
rejected_quantityintegerOptional
rejection_reasonstring, can be nullOptional
vendor_cost_entered_as_totalnumber, can be nullOptional

When the cost was typed as the line’s total, that total (for the history).

vendor_unit_costnumber, can be nullOptional

The vendor’s price per unit; left out or null, the purchase order’s price. A real change needs “Correct received costs” (a key: Enter and correct costs); sent without “View costs” it is refused.

chargesarray of objectOptional

The receipt’s own charges to add (no id), change (id; the fields sent replace the charge’s, and a missing description or reference is cleared) or remove (id and remove: true). Any charge needs “Correct received costs” (a key: Enter and correct costs) and “View costs”.

amountnumberRequired

Zero or more, two decimals.

descriptionstring, can be nullOptional
expensedbooleanOptional

Expensed, not in item cost. Left out, a charge keeps how it is treated, a new one is split by value.

idstringOptional

A charge’s id from the receipt.

is_estimatedbooleanRequired
referencestring, can be nullOptional
removebooleanOptional
targetsarray of object, can be nullOptional

Lines of this receipt it lands on; empty or left out: every line.

line_idstringRequired

The purchase order line’s id.

option_labelstring, can be nullOptional

One option on that line.

option_unit_costnumber, can be nullOptional

The option’s vendor cost per unit, which a split by value over options needs. Only with “View costs”.

option_valuestring, can be nullOptional
typestringRequired

Any casing is accepted.

One of inbound_shipping, duty_import, brokerage, insurance, handling, tariff, other.

expected_updated_atstring (date-time)Optional

The receipt’s updated_at as you last read it, when you don’t send version. A receipt changed since is 409 PURCHASE_ORDER_STALE.

linesarray of objectOptional

Lines already on the receipt that change.

receipt_line_idstringRequired

A line’s id from the receipt.

received_quantityintegerOptional

What this receipt received of the line, corrected.

rejected_quantityintegerOptional
rejection_reasonstring, can be nullOptional

Required when rejected units rise.

vendor_cost_entered_as_totalnumber, can be nullOptional

When the cost was typed as the line’s total, that total (for the history).

vendor_unit_costnumberOptional

The vendor’s price per unit on this receipt, zero or more. A real change needs “Correct received costs” (a key: Enter and correct costs); sent without “View costs” it is refused.

reasonstringRequired

Why the receipt is changing. Required.

versionstringOptional

The version of the last answer about this record (the receipt in GET /purchase-orders/{id}/receipts, or the last correction), sent back exactly as it is: no read needed first. A change made since is refused (409) with the current version and what changed. Send this or expected_updated_at.

Returns

200

OK: changes, costs_hidden, id, inventory_update_summary, purchase_order_id, purchase_order_status, receipt_number, updated_at, version

Errors

Errors use { "error": { "code", "message" } }. Use code to handle the error. View all error codes.

400

The request isn’t valid (see error.code), or the API version isn’t supported.

401

No valid access token or API key.

402

The store’s subscription isn’t active.

403

Not allowed: the API is off for this store, or the caller lacks the scope or permission.

404

Not found, or not visible to this caller.

405

Wrong method for this path; Allow lists every method the path takes.

408

The request body didn’t arrive in time.

409

The same Idempotency-Key is still being processed (REQUEST_IN_PROGRESS), its outcome is unknown (OUTCOME_UNKNOWN: check the record), or the record changed since it was read.

413

The request body is too large.

422

The request is valid JSON but can’t be done (a rule of the store refuses it), or the Idempotency-Key was used with a different body.

426

The app is older than the oldest version still served (error.code CLIENT_TOO_OLD); see error.min_version and error.upgrade_url.

429

Over a rate limit; wait Retry-After seconds.

500

Something went wrong on our side. A write may have partly happened: check the record before retrying it.

503

Busy, switched off, or billing couldn’t be checked; wait Retry-After seconds.

Was this page useful?