Pedir una lectura de folios al SII
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"
}Folios
Pedir una lectura de folios al SII (API v2)
Solicita al SII una lectura de los folios timbrados de una empresa.
POST
/
folio-queries
/
Pedir una lectura de folios al SII
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
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
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.
