API reference · Orders
Upload Invoice XML - Store
https://api.sandbox.cws.digital/partnerOrders/{id}/invoiceDescription
Attaches the invoice XML to the order.
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 platform reads the file and extracts the invoice data from it. See What is read from the file.
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.