Skip to content
platform

API reference · Orders · Marketplace Management

Upload Invoice XML - Marketplace

Method
PUT
Route
/partnerOrders/store/: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

Allows the originating store to attach the invoice (nota fiscal) XML to an order that was created there. The request body is the file itself, sent as binary content — the raw byte stream 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 body and rules are identical to those of the store route; what changes is the scope of who uploads.

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 amount of the invoice. That is why the file must be a genuine 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

An invoice is only accepted 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 upload replaces the previous one. Stores configured for multiple invoices accumulate the files: each upload 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/store/: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.