Crear Facturas en Lote
curl --request POST \
--url https://api.example.com/api/v1/invoices/batchimport requests
url = "https://api.example.com/api/v1/invoices/batch"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/api/v1/invoices/batch', 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://api.example.com/api/v1/invoices/batch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/invoices/batch"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/v1/invoices/batch")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/invoices/batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyEndpoints Disponibles
Crear Facturas en Lote
Crea multiples facturas en una sola llamada. Maximo 20 facturas por request.
POST
/
api
/
v1
/
invoices
/
batch
Crear Facturas en Lote
curl --request POST \
--url https://api.example.com/api/v1/invoices/batchimport requests
url = "https://api.example.com/api/v1/invoices/batch"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/api/v1/invoices/batch', 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://api.example.com/api/v1/invoices/batch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/invoices/batch"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/v1/invoices/batch")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/invoices/batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyCreacion masiva de facturas
Emite hasta 20 facturas en una sola llamada. Cada factura se procesa de forma independiente — si una falla, las demas continuan (exito parcial).Request
curl -X POST "https://sandbox.cucu.bo/api/v1/invoices/batch" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"invoices": [
{
"pointOfSaleId": "POS_UUID",
"clientDocumentType": 5,
"clientDocumentNumber": "123456789",
"clientBusinessName": "CLIENTE A S.R.L.",
"paymentMethodCode": 1,
"details": [{
"activityCode": "620100",
"sinProductCode": 83141,
"description": "Servicio A",
"quantity": 1,
"unitMeasure": 58,
"unitPrice": 200.00,
"discount": 0
}]
},
{
"pointOfSaleId": "POS_UUID",
"clientDocumentType": 5,
"clientDocumentNumber": "987654321",
"clientBusinessName": "CLIENTE B S.R.L.",
"paymentMethodCode": 1,
"details": [{
"activityCode": "620100",
"sinProductCode": 83141,
"description": "Servicio B",
"quantity": 2,
"unitMeasure": 58,
"unitPrice": 150.00,
"discount": 0
}]
}
]
}'
Response
{
"success": true,
"data": {
"total": 2,
"successful": 2,
"failed": 0,
"results": [
{
"index": 0,
"success": true,
"invoiceId": "uuid-1",
"invoiceNumber": 43,
"cuf": "ABC123..."
},
{
"index": 1,
"success": true,
"invoiceId": "uuid-2",
"invoiceNumber": 44,
"cuf": "DEF456..."
}
]
}
}
Limites
| Parametro | Valor |
|---|---|
| Maximo facturas por request | 20 |
| Timeout por factura | 30 segundos |
| Comportamiento en error | Exito parcial (las exitosas se emiten, las fallidas se reportan) |
Ejemplo con error parcial
{
"success": true,
"data": {
"total": 3,
"successful": 2,
"failed": 1,
"results": [
{"index": 0, "success": true, "invoiceId": "uuid-1", "invoiceNumber": 43},
{"index": 1, "success": false, "error": "NIT invalido: ABC"},
{"index": 2, "success": true, "invoiceId": "uuid-3", "invoiceNumber": 44}
]
}
}
Las facturas exitosas se emiten ante el SIAT independientemente de las fallidas. No hay rollback global.
⌘I