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>

Example

{
"results": [
{
"status": "created"
}
]
}

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>

Example generated

{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"instance": "example",
"request_id": "example",
"errors": [
{
"path": "example",
"message": "example"
}
],
"mh": {
"codigoMsg": "example",
"descripcionMsg": "example",
"observaciones": [
"example"
]
}
}