API reference · Orders
Upload Invoice XML - Marketplace
https://api.sandbox.cws.digital/partnerOrders/store/{id}/invoiceDescription
Allows the origin store to attach the invoice XML to an order that was born in it.
The request body is the file itself, sent as binary content — the raw stream of the .xml bytes. It is not multipart/form-data, there is no form field and the XML does not go inside a JSON.
The invoice must be a real and valid NF-e.
The body and the rules are identical to those of the store route; what changes is the scope of who sends it.
Parameters
Path parameters
| Field | Type | Required | Description | Value |
|---|---|---|---|---|
| id | integer | Yes | Id of the partner order ( |
Request body
application/xmlRequired| Field | Type | Required | Description |
|---|---|---|---|
| string | No |
Business rules
What is read from the file
The platform reads the XML and extracts the access key, the number, the series, the issue date and the total amount of the invoice. That is why the file must be a real NF-e: a well-formed XML that is not an invoice does not carry this data.
The file is stored with the access key as its name.
Both usual formats are accepted — the processed XML, with the invoice envelope, and the XML with only the invoice block.
An empty file or one that is not valid XML is refused, and nothing is saved.
The order must have its payment approved
Only accepts an invoice on an order that has already passed payment approval. Before that, the request is refused and nothing is saved.
One invoice or several
By default the order keeps one file, and each upload replaces the previous one.
Stores configured for multiple invoices accumulate the files: each upload adds one more. The configuration belongs to the store and is done by CWS.
Responses
- 200
The data of the invoice attached to the order.
- 401
Missing, malformed or expired token.
- 404
The order does not exist or is not in your scope.