Ir al contenido

Upsert por lote (máx. 500) de compras, retenciones recibidas o ventas externas

POST
/emitters/{id}/fiscal/{resource}/batch
curl --request POST \
--url https://api.sudte.com/v1/emitters/example/fiscal/purchases/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: example' \
--data '{ "items": [ { "external_id": "odoo:<db_uuid>:account.move:1542", "version": 1, "source": "odoo", "accounting_date": "2026-04-15", "issue_date": "2026-04-15", "doc_class": "1", "doc_type": "example", "generation_code": "example", "control_number": "example", "seal": "example", "counterpart": { "name": "example", "nit": "example", "nrc": "example", "dui": "example", "country_code": "example" }, "amounts": { "additionalProperty": "113.00" }, "attributes": {}, "exclude_from_books": false } ] }'

Idempotente por external_id + version. Respuesta con resultado por ítem. Periodo cerrado = error por ítem.

id
obligatorio
string
resource
obligatorio
string
Allowed values: purchases withholdings-received external-sales
Idempotency-Key
obligatorio
string
<= 255 characters
Media type application/json
object
items
obligatorio
Array<object>
<= 500 items

Compra recibida (purchases), retención/percepción recibida (withholdings-received) o venta no emitida por sudte (external-sales). Campos por tipo en docs/research/reportes-fiscales.md §6.1.

object
external_id
obligatorio
string
version
obligatorio
integer
>= 1
source
string
default: odoo
Allowed values: odoo manual csv
accounting_date
obligatorio
string format: date
issue_date
string format: date
doc_class

1 físico, 2 formulario único, 3 póliza/DUCA, 4 DTE

string
Allowed values: 1 2 3 4
doc_type

CAT-002

string
generation_code
string
control_number
string
seal
string
counterpart

Proveedor, cliente o agente según el recurso

object
name
string
nit
string
nrc
string
dui
string
country_code
string
amounts
object
key
additional properties
string
/^-?\d+(\.\d{1,8})?$/
attributes

Clasificaciones (gasto, origen, kind de retención, applied_to, etc.)

object
exclude_from_books
boolean

Resultado por ítem

Media type application/json
object
results
Array<object>
object
external_id
string
status
string
Allowed values: created updated unchanged error
error
object
type
string format: uri
title
string
status
integer
detail
string
instance
string
request_id
string
errors
Array<object>
object
path
string
message
string
mh
object
codigoMsg
string
descripcionMsg
string
observaciones
Array<string>
blocking_documents

Invalidación rechazada por AV 44: NC/ND vigentes (o pendientes) que ajustan el documento; invalídelas primero

Array<object>
object
id
string
type

CAT-002. Implementados: todos (01, 03, 04, 05, 06, 07, 08, 09, 11, 14 y 15)

string
Allowed values: 01 03 04 05 06 07 08 09 11 14 15
control_number
string
generation_code
string
status

discarded: el emisor abandonó un documento sin sello (rechazado por el MH) con POST /documents/{id}/discard; conserva su historial, ya no se transmite ni se corrige y, si discard.number_released, su número de control lo toma el siguiente documento del mismo alcance y año.

string
Allowed values: draft validated signed sending processed rejected contingency voided error discarded
issue_date
string format: date

Example

{
"results": [
{
"status": "created",
"error": {
"blocking_documents": [
{
"type": "01",
"status": "draft"
}
]
}
}
]
}

Error (RFC 9457)

Media type application/problem+json
object
type
string format: uri
title
string
status
integer
detail
string
instance
string
request_id
string
errors
Array<object>
object
path
string
message
string
mh
object
codigoMsg
string
descripcionMsg
string
observaciones
Array<string>
blocking_documents

Invalidación rechazada por AV 44: NC/ND vigentes (o pendientes) que ajustan el documento; invalídelas primero

Array<object>
object
id
string
type

CAT-002. Implementados: todos (01, 03, 04, 05, 06, 07, 08, 09, 11, 14 y 15)

string
Allowed values: 01 03 04 05 06 07 08 09 11 14 15
control_number
string
generation_code
string
status

discarded: el emisor abandonó un documento sin sello (rechazado por el MH) con POST /documents/{id}/discard; conserva su historial, ya no se transmite ni se corrige y, si discard.number_released, su número de control lo toma el siguiente documento del mismo alcance y año.

string
Allowed values: draft validated signed sending processed rejected contingency voided error discarded
issue_date
string format: date

Example

{
"blocking_documents": [
{
"type": "01",
"status": "draft"
}
]
}