curl --request POST \
--url https://api.prod.payana.cloud/public/api/v1/events/batch \
--header 'Content-Type: application/json' \
--header 'api-key: <api-key>' \
--data '
{
"documents_fiscal_reference": [
"9d3b1c0a8e2f4b6e9a8c7d1e2f3a4b5c6d7e8f901a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d",
"1a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f809"
],
"events_type": [
"030",
"032"
]
}
'import requests
url = "https://api.prod.payana.cloud/public/api/v1/events/batch"
payload = {
"documents_fiscal_reference": ["9d3b1c0a8e2f4b6e9a8c7d1e2f3a4b5c6d7e8f901a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d", "1a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f809"],
"events_type": ["030", "032"]
}
headers = {
"api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
documents_fiscal_reference: [
'9d3b1c0a8e2f4b6e9a8c7d1e2f3a4b5c6d7e8f901a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d',
'1a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f809'
],
events_type: ['030', '032']
})
};
fetch('https://api.prod.payana.cloud/public/api/v1/events/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.prod.payana.cloud/public/api/v1/events/batch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'documents_fiscal_reference' => [
'9d3b1c0a8e2f4b6e9a8c7d1e2f3a4b5c6d7e8f901a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d',
'1a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f809'
],
'events_type' => [
'030',
'032'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"api-key: <api-key>"
],
]);
$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://api.prod.payana.cloud/public/api/v1/events/batch"
payload := strings.NewReader("{\n \"documents_fiscal_reference\": [\n \"9d3b1c0a8e2f4b6e9a8c7d1e2f3a4b5c6d7e8f901a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d\",\n \"1a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f809\"\n ],\n \"events_type\": [\n \"030\",\n \"032\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("api-key", "<api-key>")
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.post("https://api.prod.payana.cloud/public/api/v1/events/batch")
.header("api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"documents_fiscal_reference\": [\n \"9d3b1c0a8e2f4b6e9a8c7d1e2f3a4b5c6d7e8f901a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d\",\n \"1a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f809\"\n ],\n \"events_type\": [\n \"030\",\n \"032\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.prod.payana.cloud/public/api/v1/events/batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"documents_fiscal_reference\": [\n \"9d3b1c0a8e2f4b6e9a8c7d1e2f3a4b5c6d7e8f901a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d\",\n \"1a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f809\"\n ],\n \"events_type\": [\n \"030\",\n \"032\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"documents_fiscal_reference": [
"9d3b1c0a8e2f4b6e9a8c7d1e2f3a4b5c6d7e8f901a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d",
"1a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f809"
],
"message": "multiple receipt events sent successfully and are being processed"
}{
"message": "Claim events (031) cannot be sent in a batch; use the single endpoint instead",
"code": "claim_not_allowed_in_batch"
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "The request contains invalid data",
"details": {
"amount": [
"Amount must be greater than 0"
],
"beneficiary_id": [
"Beneficiary does not exist"
]
}
}
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "The request contains invalid data",
"details": {
"amount": [
"Amount must be greater than 0"
],
"beneficiary_id": [
"Beneficiary does not exist"
]
}
}
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "The request contains invalid data",
"details": {
"amount": [
"Amount must be greater than 0"
],
"beneficiary_id": [
"Beneficiary does not exist"
]
}
}
}Send DIAN Events (Batch)
Valida y encola el producto cruzado de events_type × documents_fiscal_reference. El procesamiento es atómico por evento: si uno falla, los demás del batch se procesan igual.
Los eventos de reclamo (031) no se aceptan acá — deben enviarse uno por uno via POST /events/single.
Igual que en /events/single, la respuesta 200 significa que los eventos fueron persistidos en estado processing y encolados, no que la DIAN los haya aceptado.
curl --request POST \
--url https://api.prod.payana.cloud/public/api/v1/events/batch \
--header 'Content-Type: application/json' \
--header 'api-key: <api-key>' \
--data '
{
"documents_fiscal_reference": [
"9d3b1c0a8e2f4b6e9a8c7d1e2f3a4b5c6d7e8f901a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d",
"1a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f809"
],
"events_type": [
"030",
"032"
]
}
'import requests
url = "https://api.prod.payana.cloud/public/api/v1/events/batch"
payload = {
"documents_fiscal_reference": ["9d3b1c0a8e2f4b6e9a8c7d1e2f3a4b5c6d7e8f901a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d", "1a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f809"],
"events_type": ["030", "032"]
}
headers = {
"api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
documents_fiscal_reference: [
'9d3b1c0a8e2f4b6e9a8c7d1e2f3a4b5c6d7e8f901a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d',
'1a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f809'
],
events_type: ['030', '032']
})
};
fetch('https://api.prod.payana.cloud/public/api/v1/events/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.prod.payana.cloud/public/api/v1/events/batch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'documents_fiscal_reference' => [
'9d3b1c0a8e2f4b6e9a8c7d1e2f3a4b5c6d7e8f901a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d',
'1a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f809'
],
'events_type' => [
'030',
'032'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"api-key: <api-key>"
],
]);
$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://api.prod.payana.cloud/public/api/v1/events/batch"
payload := strings.NewReader("{\n \"documents_fiscal_reference\": [\n \"9d3b1c0a8e2f4b6e9a8c7d1e2f3a4b5c6d7e8f901a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d\",\n \"1a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f809\"\n ],\n \"events_type\": [\n \"030\",\n \"032\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("api-key", "<api-key>")
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.post("https://api.prod.payana.cloud/public/api/v1/events/batch")
.header("api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"documents_fiscal_reference\": [\n \"9d3b1c0a8e2f4b6e9a8c7d1e2f3a4b5c6d7e8f901a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d\",\n \"1a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f809\"\n ],\n \"events_type\": [\n \"030\",\n \"032\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.prod.payana.cloud/public/api/v1/events/batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"documents_fiscal_reference\": [\n \"9d3b1c0a8e2f4b6e9a8c7d1e2f3a4b5c6d7e8f901a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d\",\n \"1a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f809\"\n ],\n \"events_type\": [\n \"030\",\n \"032\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"documents_fiscal_reference": [
"9d3b1c0a8e2f4b6e9a8c7d1e2f3a4b5c6d7e8f901a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d",
"1a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f809"
],
"message": "multiple receipt events sent successfully and are being processed"
}{
"message": "Claim events (031) cannot be sent in a batch; use the single endpoint instead",
"code": "claim_not_allowed_in_batch"
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "The request contains invalid data",
"details": {
"amount": [
"Amount must be greater than 0"
],
"beneficiary_id": [
"Beneficiary does not exist"
]
}
}
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "The request contains invalid data",
"details": {
"amount": [
"Amount must be greater than 0"
],
"beneficiary_id": [
"Beneficiary does not exist"
]
}
}
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "The request contains invalid data",
"details": {
"amount": [
"Amount must be greater than 0"
],
"beneficiary_id": [
"Beneficiary does not exist"
]
}
}
}Authorizations
API key provista por Payana.
Body
Listado de CUFEs (1..200). Cada entrada debe cumplir el formato CUFE.
1 - 200 elementsCUFE (Código Único de Factura Electrónica) emitido por la DIAN. Hash SHA-384 representado como exactamente 96 caracteres hexadecimales.
96^[a-fA-F0-9]{96}$Tipos de evento DIAN a encolar para cada documento. El evento 031 (Reclamo) no se acepta en batch.
1030, 032, 033, 034