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_status": "complete",
"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",
"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",
"fields": [
{
"key": "invoice_number",
"label": "Número da Fatura",
"value": "INV-81244/2026"
},
{
"key": "invoice_date",
"label": "Data da Fatura",
"value": "2026-09-18"
},
{
"key": "exporter_name",
"label": "Exportador (Vendedor)",
"value": "Shanghai Example Trading Co., Ltd."
},
{
"key": "invoice_amount",
"label": "Valor da Fatura",
"value": "48,250.00"
},
{
"key": "currency",
"label": "Moeda",
"value": "USD"
},
{
"key": "incoterm",
"label": "Incoterm",
"value": "CFR"
},
{
"key": "line_items",
"label": "Itens da Fatura",
"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"
}
]
}
]
}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_status": "complete",
"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",
"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",
"fields": [
{
"key": "invoice_number",
"label": "Número da Fatura",
"value": "INV-81244/2026"
},
{
"key": "invoice_date",
"label": "Data da Fatura",
"value": "2026-09-18"
},
{
"key": "exporter_name",
"label": "Exportador (Vendedor)",
"value": "Shanghai Example Trading Co., Ltd."
},
{
"key": "invoice_amount",
"label": "Valor da Fatura",
"value": "48,250.00"
},
{
"key": "currency",
"label": "Moeda",
"value": "USD"
},
{
"key": "incoterm",
"label": "Incoterm",
"value": "CFR"
},
{
"key": "line_items",
"label": "Itens da Fatura",
"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"
}
]
}
]
}Authorizations
The API key of the organization, in the Authorization: Bearer <key> header. The key starts with qx_.
Headers
A unique value that your system creates for each write, such as a UUID. A repeated call with the same value and the same content gets the first response, and the API writes nothing new. The API keeps the response for 24 hours.
1 - 255Path Parameters
The id of the document. The id starts with doc_.
Body
The field answers, in the { "key": value } format, with at least one key. The key is the key of a field in GET /documents/{id}. The value has the shape of the value of that field, and null erases the answer.
Show child attributes
Show child attributes
{ "invoice_number": "INV-81244/2026" }
Response
The document, with the fields.
A document, with the fields.
The id of the document.
^doc_[1-9][0-9]*$"doc_310"
Show child attributes
Show child attributes
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 progress of the reading of the document. not_started: the reading did not start. extracting, enriching and validating: the reading is in progress. complete: the reading ended. failed: the reading failed. no_reader: the document type has no reading.
not_started, extracting, enriching, validating, complete, failed, no_reader The contact of the document. The value is null when the document has no contact.
Show child attributes
Show child attributes
The id of the collection of the document. The value is null while the document is in Triage.
^col_[1-9][0-9]*$"col_40"
With true, the document is in Triage and has no collection yet.
With true, the document is discarded.
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 In the previous version of a file swap, the id of the current document. The current document is the last document in the chain of file swaps. On the other documents, the value is null.
^doc_[1-9][0-9]*$"doc_325"
The printed number that identifies the document, such as the invoice number. The value is null before the reading.
"INV-81244/2026"
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 The date and the time when the file arrived, in the time zone of the organization. The value is null on an empty slot.
The files of the document. On an empty slot, the list is empty.
Show child attributes
Show child attributes
The date and the time of the creation, in the time zone of the organization.
"2026-09-25T10:30:00.000-03:00"
The fields of the document type, in the catalog order, without the file fields. A field without an answer has value equal to null.
Show child attributes
Show child attributes