Solicitar timbraje de folios
curl --request POST \
--url https://api.tupana.ai/v2/folio-requests/ \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"master_entity_id": "ment_4829301923847",
"dte_type": 33,
"quantity": 50,
"sii_environment": "certification"
}
'import requests
url = "https://api.tupana.ai/v2/folio-requests/"
payload = {
"master_entity_id": "ment_4829301923847",
"dte_type": 33,
"quantity": 50,
"sii_environment": "certification"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
master_entity_id: 'ment_4829301923847',
dte_type: 33,
quantity: 50,
sii_environment: 'certification'
})
};
fetch('https://api.tupana.ai/v2/folio-requests/', 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.tupana.ai/v2/folio-requests/",
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([
'master_entity_id' => 'ment_4829301923847',
'dte_type' => 33,
'quantity' => 50,
'sii_environment' => 'certification'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-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.tupana.ai/v2/folio-requests/"
payload := strings.NewReader("{\n \"master_entity_id\": \"ment_4829301923847\",\n \"dte_type\": 33,\n \"quantity\": 50,\n \"sii_environment\": \"certification\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("Authorization", "<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.tupana.ai/v2/folio-requests/")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"master_entity_id\": \"ment_4829301923847\",\n \"dte_type\": 33,\n \"quantity\": 50,\n \"sii_environment\": \"certification\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tupana.ai/v2/folio-requests/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"master_entity_id\": \"ment_4829301923847\",\n \"dte_type\": 33,\n \"quantity\": 50,\n \"sii_environment\": \"certification\"\n}"
response = http.request(request)
puts response.read_body{
"id": "fir_8d4a2f7c1e9b5",
"dte_type": 33,
"status": "completed",
"requested_quantity": 50,
"granted_quantity": 50,
"partially_granted": true,
"sii_max_per_request": 9,
"folio_start": 539,
"folio_end": 588,
"caf_xml": "<AUTORIZACION><CAF version=\"1.0\">…</CAF></AUTORIZACION>",
"idempotency_key": "pedido-facturas-2026-08-27-01",
"error": "",
"created_at": "2026-08-27T14:30:00Z",
"completed_at": "2026-08-27T14:32:11Z",
"sii_environment": "production",
"error_code": ""
}{
"id": "fir_8d4a2f7c1e9b5",
"dte_type": 33,
"status": "pending",
"requested_quantity": 50,
"granted_quantity": null,
"folio_start": null,
"folio_end": null,
"caf_xml": null,
"idempotency_key": "pedido-facturas-2026-08-27-01",
"error": "",
"created_at": "2026-08-27T14:30:00Z",
"completed_at": null,
"sii_environment": "production",
"error_code": ""
}{
"error": "La cabecera Idempotency-Key es obligatoria: sin ella un reintento timbraría folios de nuevo."
}{
"detail": "No tienes acceso a esta entidad."
}{
"error": "La clave de idempotencia 'pedido-01' ya se usó en production y ahora se pide en certification. Usa una clave distinta por ambiente.",
"error_code": "idempotency_environment_conflict"
}{
"error": "Ambiente 'staging' desconocido. Valores válidos: certification, production.",
"error_code": "invalid_environment"
}{
"error": "Cuota de timbrajes agotada: 3 de 3 por hora.",
"limit": 3,
"window": "hora",
"used": 3,
"resets_at": "2023-11-07T05:31:56Z"
}Folios
Solicitar timbraje de folios al SII (API v2)
Pide al SII nuevos folios (CAF) para emitir documentos tributarios electrónicos con tu propio facturador.
POST
/
folio-requests
/
Solicitar timbraje de folios
curl --request POST \
--url https://api.tupana.ai/v2/folio-requests/ \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"master_entity_id": "ment_4829301923847",
"dte_type": 33,
"quantity": 50,
"sii_environment": "certification"
}
'import requests
url = "https://api.tupana.ai/v2/folio-requests/"
payload = {
"master_entity_id": "ment_4829301923847",
"dte_type": 33,
"quantity": 50,
"sii_environment": "certification"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
master_entity_id: 'ment_4829301923847',
dte_type: 33,
quantity: 50,
sii_environment: 'certification'
})
};
fetch('https://api.tupana.ai/v2/folio-requests/', 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.tupana.ai/v2/folio-requests/",
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([
'master_entity_id' => 'ment_4829301923847',
'dte_type' => 33,
'quantity' => 50,
'sii_environment' => 'certification'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-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.tupana.ai/v2/folio-requests/"
payload := strings.NewReader("{\n \"master_entity_id\": \"ment_4829301923847\",\n \"dte_type\": 33,\n \"quantity\": 50,\n \"sii_environment\": \"certification\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("Authorization", "<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.tupana.ai/v2/folio-requests/")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"master_entity_id\": \"ment_4829301923847\",\n \"dte_type\": 33,\n \"quantity\": 50,\n \"sii_environment\": \"certification\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tupana.ai/v2/folio-requests/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"master_entity_id\": \"ment_4829301923847\",\n \"dte_type\": 33,\n \"quantity\": 50,\n \"sii_environment\": \"certification\"\n}"
response = http.request(request)
puts response.read_body{
"id": "fir_8d4a2f7c1e9b5",
"dte_type": 33,
"status": "completed",
"requested_quantity": 50,
"granted_quantity": 50,
"partially_granted": true,
"sii_max_per_request": 9,
"folio_start": 539,
"folio_end": 588,
"caf_xml": "<AUTORIZACION><CAF version=\"1.0\">…</CAF></AUTORIZACION>",
"idempotency_key": "pedido-facturas-2026-08-27-01",
"error": "",
"created_at": "2026-08-27T14:30:00Z",
"completed_at": "2026-08-27T14:32:11Z",
"sii_environment": "production",
"error_code": ""
}{
"id": "fir_8d4a2f7c1e9b5",
"dte_type": 33,
"status": "pending",
"requested_quantity": 50,
"granted_quantity": null,
"folio_start": null,
"folio_end": null,
"caf_xml": null,
"idempotency_key": "pedido-facturas-2026-08-27-01",
"error": "",
"created_at": "2026-08-27T14:30:00Z",
"completed_at": null,
"sii_environment": "production",
"error_code": ""
}{
"error": "La cabecera Idempotency-Key es obligatoria: sin ella un reintento timbraría folios de nuevo."
}{
"detail": "No tienes acceso a esta entidad."
}{
"error": "La clave de idempotencia 'pedido-01' ya se usó en production y ahora se pide en certification. Usa una clave distinta por ambiente.",
"error_code": "idempotency_environment_conflict"
}{
"error": "Ambiente 'staging' desconocido. Valores válidos: certification, production.",
"error_code": "invalid_environment"
}{
"error": "Cuota de timbrajes agotada: 3 de 3 por hora.",
"limit": 3,
"window": "hora",
"used": 3,
"resets_at": "2023-11-07T05:31:56Z"
}Authorizations
Headers
Body
application/json
Ambiente del SII contra el que se hace la operación. production (palena) entrega folios REALES, que no se devuelven; certification (maullin) entrega folios de prueba, que NO sirven para emitir. Si se omite, producción. Un valor distinto de los dos se rechaza con 422 en vez de asumir un default.
Available options:
production, certification Example:
"certification"
Response
Ya existía un pedido con esa Idempotency-Key: se devuelve el original, sin timbrar de nuevo
Pedido de timbraje de folios ante el SII.
