curl --request POST \
--url https://api.tupana.ai/v2/folio-queries/ \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"master_entity_id": "ment_4829301923847",
"dte_type": 33,
"sii_environment": "certification"
}
'import requests
url = "https://api.tupana.ai/v2/folio-queries/"
payload = {
"master_entity_id": "ment_4829301923847",
"dte_type": 33,
"sii_environment": "certification"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
master_entity_id: 'ment_4829301923847',
dte_type: 33,
sii_environment: 'certification'
})
};
fetch('https://api.tupana.ai/v2/folio-queries/', 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-queries/",
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,
'sii_environment' => 'certification'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$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-queries/"
payload := strings.NewReader("{\n \"master_entity_id\": \"ment_4829301923847\",\n \"dte_type\": 33,\n \"sii_environment\": \"certification\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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-queries/")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"master_entity_id\": \"ment_4829301923847\",\n \"dte_type\": 33,\n \"sii_environment\": \"certification\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tupana.ai/v2/folio-queries/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"master_entity_id\": \"ment_4829301923847\",\n \"dte_type\": 33,\n \"sii_environment\": \"certification\"\n}"
response = http.request(request)
puts response.read_body{
"id": "foqu_3b7f1e9d5c2a8",
"dte_type": 33,
"status": "pending",
"result": {
"available": 3,
"max_per_request": 8,
"last_timbraje": "<string>",
"timbrajes": [
{}
]
},
"error": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"completed_at": "2023-11-07T05:31:56Z",
"sii_environment": "production",
"error_code": ""
}{
"error": "<string>",
"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"
}Pedir una lectura de folios al SII
Crea una consulta de folios contra el SII. Es un recurso asíncrono: responde 201 con status: "pending" y lee en segundo plano.
Consultar no consume folios: el trámite se queda en el paso 1 del portal, que no reserva ningún rango. Por eso no lleva Idempotency-Key — repetirla no cuesta nada irreversible.
curl --request POST \
--url https://api.tupana.ai/v2/folio-queries/ \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"master_entity_id": "ment_4829301923847",
"dte_type": 33,
"sii_environment": "certification"
}
'import requests
url = "https://api.tupana.ai/v2/folio-queries/"
payload = {
"master_entity_id": "ment_4829301923847",
"dte_type": 33,
"sii_environment": "certification"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
master_entity_id: 'ment_4829301923847',
dte_type: 33,
sii_environment: 'certification'
})
};
fetch('https://api.tupana.ai/v2/folio-queries/', 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-queries/",
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,
'sii_environment' => 'certification'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$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-queries/"
payload := strings.NewReader("{\n \"master_entity_id\": \"ment_4829301923847\",\n \"dte_type\": 33,\n \"sii_environment\": \"certification\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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-queries/")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"master_entity_id\": \"ment_4829301923847\",\n \"dte_type\": 33,\n \"sii_environment\": \"certification\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tupana.ai/v2/folio-queries/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"master_entity_id\": \"ment_4829301923847\",\n \"dte_type\": 33,\n \"sii_environment\": \"certification\"\n}"
response = http.request(request)
puts response.read_body{
"id": "foqu_3b7f1e9d5c2a8",
"dte_type": 33,
"status": "pending",
"result": {
"available": 3,
"max_per_request": 8,
"last_timbraje": "<string>",
"timbrajes": [
{}
]
},
"error": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"completed_at": "2023-11-07T05:31:56Z",
"sii_environment": "production",
"error_code": ""
}{
"error": "<string>",
"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
API Key para autenticación. Debe proporcionarse en el header Authorization con el formato: 'Api-Key YOUR-API-KEY' (incluye el prefijo 'Api-Key ' seguido de tu API key)
Body
ID de la entidad. El public ID de la entidad (ment_...).
"ment_4829301923847"
Tipo de DTE a consultar.
33
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.
production, certification "certification"
Response
Consulta creada.
Consulta de folios al SII. Es un recurso para que puedas seguirla: antes esto era una acción que respondía 202 sin nada que consultar.
"foqu_3b7f1e9d5c2a8"
33
pending, processing, completed, failed Lo que dijo el SII cuando la consulta terminó.
Show child attributes
Show child attributes
Motivo cuando la consulta no terminó bien.
Ambiente del SII en el que se hizo la operación. Un CAF de certification NO sirve para emitir.
production, certification Vocabulario cerrado del desenlace fallido; vacío si no hubo error. Ver la página de códigos de error.
, certification_not_enabled, missing_certificate, no_folios_authorized, sii_unavailable, sii_unrecognized_page 