curl --request PATCH \
--url https://app.useqx.com/api/v1/documents/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"fields": {
"incoterm": "CFR"
}
}
'import requests
url = "https://app.useqx.com/api/v1/documents/{id}"
payload = { "fields": { "incoterm": "CFR" } }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({fields: {incoterm: 'CFR'}})
};
fetch('https://app.useqx.com/api/v1/documents/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.useqx.com/api/v1/documents/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'fields' => [
'incoterm' => 'CFR'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.useqx.com/api/v1/documents/{id}"
payload := strings.NewReader("{\n \"fields\": {\n \"incoterm\": \"CFR\"\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://app.useqx.com/api/v1/documents/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"fields\": {\n \"incoterm\": \"CFR\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.useqx.com/api/v1/documents/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"fields\": {\n \"incoterm\": \"CFR\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "doc_318",
"document_type": {
"id": "dtp_31",
"name": "Fatura Comercial (Commercial Invoice)"
},
"status": "uploaded",
"reading": {
"state": "complete",
"finished_at": "2026-09-25T10:33:20.000-03:00",
"refusal": null
},
"contact": {
"id": "com_12",
"type": "company",
"name": "Importadora Exemplo Ltda"
},
"collection_id": "col_40",
"in_triage": false,
"discarded": false,
"discard_reason": null,
"replaced_by": null,
"number": "INV-81244/2026",
"external_id": "CAMBIO-2026-0042",
"arrival_channel": "api",
"arrived_at": "2026-09-25T10:32:05.000-03:00",
"files": [
{
"name": "fatura.pdf",
"content_type": "application/pdf",
"size": 182044
}
],
"created_at": "2026-09-25T10:32:05.000-03:00",
"has_problem": false,
"reading_rules": [],
"fields": [
{
"key": "invoice_number",
"label": "Número da Fatura",
"raw_value": "INV-81244/2026",
"value": "INV-81244/2026",
"value_type": "text",
"source": "reading"
},
{
"key": "invoice_date",
"label": "Data da Fatura",
"raw_value": "18/09/2026",
"value": "2026-09-18",
"value_type": "date",
"source": "reading"
},
{
"key": "exporter_name",
"label": "Exportador (Vendedor)",
"raw_value": "Shanghai Example Trading Co., Ltd.",
"value": "Shanghai Example Trading Co., Ltd.",
"value_type": "text",
"source": "reading"
},
{
"key": "invoice_amount",
"label": "Valor da Fatura",
"raw_value": "48,250.00",
"value": {
"amount": "48250.00",
"currency": "USD"
},
"value_type": "money",
"source": "reading"
},
{
"key": "currency",
"label": "Moeda",
"raw_value": "USD",
"value": "USD",
"value_type": "text",
"source": "reading"
},
{
"key": "incoterm",
"label": "Incoterm",
"raw_value": "CFR",
"value": "CFR",
"value_type": "text",
"source": "operator"
},
{
"key": "line_items",
"label": "Itens da Fatura",
"raw_value": [
{
"part_number": "A-100",
"description": "STAINLESS STEEL VALVE 1/2 IN",
"quantity": "1000",
"quantity_unit": "PCS",
"unit_price": "25.00",
"total_price": "25,000.00"
},
{
"part_number": "B-220",
"description": "BRASS FITTING 3/4 IN",
"quantity": "500",
"quantity_unit": "PCS",
"unit_price": "46.50",
"total_price": "23,250.00"
}
],
"value": [
{
"part_number": "A-100",
"description": "STAINLESS STEEL VALVE 1/2 IN",
"quantity": "1000",
"quantity_unit": "PCS",
"unit_price": "25.00",
"total_price": "25000.00"
},
{
"part_number": "B-220",
"description": "BRASS FITTING 3/4 IN",
"quantity": "500",
"quantity_unit": "PCS",
"unit_price": "46.50",
"total_price": "23250.00"
}
],
"value_type": "table",
"source": "reading",
"complete": true
}
]
}Write fields or send the file
Makes one of two changes to a document. With fields, in JSON, the call writes the field answers, and the written value wins over the value that the reading extracted. A document in Triage goes back to the routing, and the collection of the document runs the validations again. With file, in multipart/form-data, the call sends the file of a document in an open collection, and the reading starts. On a document without a file, the call attaches the file to the same document and responds 200. On a document with a file, the call makes a file swap and responds 201. The file swap creates a new document with the file, and the Location header contains the path of the new document. The old document stays as the previous version, with its file, its state and its reading. The file swap also applies to an approved document, while the collection accepts documents. A call with file counts toward the paid write limit of the key and accepts the Idempotency-Key header.
curl --request PATCH \
--url https://app.useqx.com/api/v1/documents/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"fields": {
"incoterm": "CFR"
}
}
'import requests
url = "https://app.useqx.com/api/v1/documents/{id}"
payload = { "fields": { "incoterm": "CFR" } }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({fields: {incoterm: 'CFR'}})
};
fetch('https://app.useqx.com/api/v1/documents/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.useqx.com/api/v1/documents/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'fields' => [
'incoterm' => 'CFR'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.useqx.com/api/v1/documents/{id}"
payload := strings.NewReader("{\n \"fields\": {\n \"incoterm\": \"CFR\"\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://app.useqx.com/api/v1/documents/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"fields\": {\n \"incoterm\": \"CFR\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.useqx.com/api/v1/documents/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"fields\": {\n \"incoterm\": \"CFR\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "doc_318",
"document_type": {
"id": "dtp_31",
"name": "Fatura Comercial (Commercial Invoice)"
},
"status": "uploaded",
"reading": {
"state": "complete",
"finished_at": "2026-09-25T10:33:20.000-03:00",
"refusal": null
},
"contact": {
"id": "com_12",
"type": "company",
"name": "Importadora Exemplo Ltda"
},
"collection_id": "col_40",
"in_triage": false,
"discarded": false,
"discard_reason": null,
"replaced_by": null,
"number": "INV-81244/2026",
"external_id": "CAMBIO-2026-0042",
"arrival_channel": "api",
"arrived_at": "2026-09-25T10:32:05.000-03:00",
"files": [
{
"name": "fatura.pdf",
"content_type": "application/pdf",
"size": 182044
}
],
"created_at": "2026-09-25T10:32:05.000-03:00",
"has_problem": false,
"reading_rules": [],
"fields": [
{
"key": "invoice_number",
"label": "Número da Fatura",
"raw_value": "INV-81244/2026",
"value": "INV-81244/2026",
"value_type": "text",
"source": "reading"
},
{
"key": "invoice_date",
"label": "Data da Fatura",
"raw_value": "18/09/2026",
"value": "2026-09-18",
"value_type": "date",
"source": "reading"
},
{
"key": "exporter_name",
"label": "Exportador (Vendedor)",
"raw_value": "Shanghai Example Trading Co., Ltd.",
"value": "Shanghai Example Trading Co., Ltd.",
"value_type": "text",
"source": "reading"
},
{
"key": "invoice_amount",
"label": "Valor da Fatura",
"raw_value": "48,250.00",
"value": {
"amount": "48250.00",
"currency": "USD"
},
"value_type": "money",
"source": "reading"
},
{
"key": "currency",
"label": "Moeda",
"raw_value": "USD",
"value": "USD",
"value_type": "text",
"source": "reading"
},
{
"key": "incoterm",
"label": "Incoterm",
"raw_value": "CFR",
"value": "CFR",
"value_type": "text",
"source": "operator"
},
{
"key": "line_items",
"label": "Itens da Fatura",
"raw_value": [
{
"part_number": "A-100",
"description": "STAINLESS STEEL VALVE 1/2 IN",
"quantity": "1000",
"quantity_unit": "PCS",
"unit_price": "25.00",
"total_price": "25,000.00"
},
{
"part_number": "B-220",
"description": "BRASS FITTING 3/4 IN",
"quantity": "500",
"quantity_unit": "PCS",
"unit_price": "46.50",
"total_price": "23,250.00"
}
],
"value": [
{
"part_number": "A-100",
"description": "STAINLESS STEEL VALVE 1/2 IN",
"quantity": "1000",
"quantity_unit": "PCS",
"unit_price": "25.00",
"total_price": "25000.00"
},
{
"part_number": "B-220",
"description": "BRASS FITTING 3/4 IN",
"quantity": "500",
"quantity_unit": "PCS",
"unit_price": "46.50",
"total_price": "23250.00"
}
],
"value_type": "table",
"source": "reading",
"complete": true
}
]
}Authorizations
Headers
Body
Response
The document, with the fields.
A document, with the fields.
The progress of the document. pending: the document waits for the upload. uploaded: the document arrived and waits for the review. approved: the operator approved the document. rejected: the operator rejected the document.
pending, uploaded, approved, rejected The reason for the discard. The value is null on a document that is not discarded. outside_pack: no active operation pack asks for the type of the document. identical_copy: the document repeats the file of another document. superseded: a newer document replaced this document. operator: the operator discarded the document. replaced: a file swap created a new document, and this document stayed as the previous version.
outside_pack, identical_copy, superseded, operator, replaced, null The arrival channel of the file. The value is null on an empty slot. email: the file arrived by email. portal_upload: the client sent the file on the portal. operator_upload: the operator sent the file on the QX screen. spreadsheet: the file came from a spreadsheet. vault: the client reused a file from the Vault on the portal. api: the file arrived through the API.
email, portal_upload, operator_upload, spreadsheet, vault, api, null With true, the document is a document with a problem. In a collection, the reading refused the file, or a blocking validation or a reading rule failed. In Triage, the Triage rule applies: the blocking validations and the reading rules of the message of the document. In Triage, the refused reading stays out. While the reading is in progress, the field leaves out the refusal and the reading rules. The field also leaves out the reading rules that only the team or only the operator sees.