Skip to content
platform

API reference · Orders · Store Management

Upload Invoice XML - Store

Method
PUT
Route
/partnerOrders/:id/invoice
Base URL
https://ws.autorei.net
Path parameters
:id
Token
Requires Bearer token
Test in Postman

Opens this request in the public API documentation, the official source of the reference.

Description

Attaches the XML of the invoice (nota fiscal) to the order. The request body is the file itself, sent as binary content — the raw stream of the bytes of the .xml. 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, valid NF-e: the platform reads the file and extracts the invoice data from it. See What is read from the file.

Path parameters

Parameter Type Required Description
id integer Yes Id of the partner order (partnerOrderId).

Request body

The bytes of the NF-e .xml file, with no envelope. Send Content-Type: application/xml.

Business rules

What is read from the file

The platform parses the XML and extracts the access key, the number, the series, the issue date and the total value 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 under the access key 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 rejected, and nothing is saved.

The order must have approved payment

Only accepts an invoice on an order that has already passed payment approval. Before that, the request is rejected and nothing is saved.

One invoice or several

By default the order keeps one file, and each submission replaces the previous one. Stores configured for multiple invoices accumulate the files: each submission adds one more. The setting belongs to the store and is made by CWS.

Response · 200

The data of the invoice attached to the order.

Errors

Code When
422 Empty body, a file that is not valid XML, or an order still without approved payment. The reason comes in message.
404 The order does not exist or is not in your scope.
401 Token missing, malformed or expired.

Example request

curl --request PUT 'https://ws.autorei.net/partnerOrders/:id/invoice' \
  --header 'Authorization: Bearer {{access_token}}' \
  --header 'Content-Type: application/xml' \
  --data '<?xml version="1.0" encoding="UTF-8"?>
<nfeProc versao="4.00">
  <NFe>
    <infNFe Id="NFe35260930424972000174550010000012341000012349">
      <ide><nNF>1234</nNF><serie>1</serie></ide>
    </infNFe>
  </NFe>
</nfeProc>'

Example responses

422Rejected — order without approved payment

{
  "status": "UNPROCESSABLE_ENTITY",
  "message": "Envio de XML de NFe permitido somente para pedido com pagamento aprovado"
}

Used in

Generated from the public API collection, published on 2026-09-04: api-docs.cws.digital.