Obtener documento específico
curl --request GET \
--url https://api.tupana.ai/v2/documents/{document_id}/ \
--header 'Authorization: <api-key>'import requests
url = "https://api.tupana.ai/v2/documents/{document_id}/"
headers = {"Authorization": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api.tupana.ai/v2/documents/{document_id}/', 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/documents/{document_id}/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <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"
"net/http"
"io"
)
func main() {
url := "https://api.tupana.ai/v2/documents/{document_id}/"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.tupana.ai/v2/documents/{document_id}/")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tupana.ai/v2/documents/{document_id}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"id": "docu_9f2a7c1b8e4d0",
"folio": "<string>",
"date_issued": "2023-12-25",
"amount_with_iva": 123,
"dte_type_code": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"has_trace": true,
"json_param": {
"external_order_id": "PED-123"
},
"additional_info": "Orden de compra N° 4500123 - Centro de costo: Operaciones",
"amount_iva": 123,
"amount_without_iva": 123,
"currency": "CLP",
"sender_id": 123,
"sender_name": "<string>",
"sender_tax_id": "<string>",
"receiver_id": "<string>",
"receiver_name": "<string>",
"receiver_tax_id": "<string>",
"has_credit_note": true,
"is_paid": true,
"traces": [
{
"date_reception": "2023-11-07T05:31:56Z",
"has_receiver_access": true,
"has_issuer_access": true,
"has_holder_access": true,
"is_paid_cash": true,
"has_claims": true,
"is_more_than_eight_days": true,
"has_acknowledgments": true,
"has_guide_reference": true,
"is_rejected": true,
"days_until_executive_merit": 123,
"executive_merit_alert_level": "none",
"events": [
{
"event_code": "ACD",
"event_description": "Acepta Contenido del Documento",
"event_date": "2023-11-07T05:31:56Z",
"responsable_rut": 123,
"responsable_dv": "<string>"
}
]
}
],
"vat_withheld": true,
"exchange_rate": "<string>",
"original_amount": "<string>",
"state": "<string>",
"dte_type_description": "<string>",
"pdf": "<string>",
"xml": "<string>",
"xml_error": "<string>",
"references": [
{
"reference_folio": 123,
"reference_date": "2023-12-25",
"dte_type_code": "<string>",
"reference_reason": "ANULA DOCUMENTO DE LA REFERENCIA"
}
],
"details": [
{
"item_name": "<string>",
"quantity": 123,
"unit_price": 1,
"gross_unit_price": 123,
"is_exempt": false,
"item_description": "<string>",
"discount_percent": 123,
"item_code": "<string>",
"unit": "<string>",
"other_tax": 123,
"item_type_code": 123,
"vat_withholding_code": "48",
"line_number": 1,
"item_total": 4050000,
"show_item_type": "01",
"ticket": {
"ticket_folio": 123,
"generated_at": "2023-11-07T05:31:56Z",
"event_name": "<string>",
"ticket_type": "<string>",
"event_code": "<string>",
"event_datetime": "2023-11-07T05:31:56Z",
"event_place": "<string>",
"event_location": "<string>",
"row": "<string>",
"seat": "<string>"
},
"settled_document_type": "33"
}
],
"header": {
"purchase_transaction_type": "<string>",
"sale_transaction_type": "<string>",
"payment_method": "1",
"due_date": "2023-12-25",
"vat_withheld": false,
"retention_type": "RETRECEPTOR",
"purchase_type": "1"
},
"document_issuer": {
"rut": "<string>",
"business_name": "<string>",
"phone_number": "<string>",
"email": "<string>",
"business_activity": "<string>",
"activity_code": 123,
"sii_branch_code": "<string>",
"address": "<string>",
"district": "<string>",
"city": "<string>"
},
"document_receiver": {
"rut": "<string>",
"business_name": "<string>",
"contact": "<string>",
"business_activity": "<string>",
"address": "<string>",
"district": "<string>",
"city": "<string>"
},
"document_total": {
"net_amount": 123,
"iva_rate": 123,
"iva_amount": 123,
"exempt_amount": 123,
"total_amount": 123
},
"transport_data": {
"transport_type": "1",
"dispatch_type": "2",
"transport_rut": "76234567-6",
"transport_plate": "PJRL69",
"driver_rut": "12345678-5",
"driver_name": "Juan Pérez",
"destination_address": "Aeropuerto Arturo Merino Benitez",
"destination_district": "Pudahuel",
"destination_city": "Santiago",
"transfer_issuer_code": "1",
"authorization_resolution_number": 1234,
"authorization_resolution_date": "2024-03-01",
"departure_port_code": "992",
"arrival_port_code": "134",
"gross_weight": "1414.00",
"gross_weight_unit_code": "6",
"total_packages": 3,
"package_type_code": "22",
"timber_enabled": false,
"comuna_rol": "13101",
"manzana_rol": "12",
"predio_rol": "345",
"geo_ref_system": "1",
"latitude": "-33.45",
"longitude": "-70.65",
"conaf_plan_code": "PM-2024-001",
"trailer_plate": "JK1234",
"departure_date": "2026-11-02",
"departure_time": "08:30",
"arrival_date": "2026-11-02",
"transfer_reason": "Traslado a bodega central para reposición de stock",
"transport_unknown_reason": "El cliente retira con transporte propio no informado",
"destination_commune_role": "13101",
"destination_block_role": "1234",
"destination_property_role": "56",
"work_execution_notice": "AEF-2026-0457",
"destination_latitude": "-36.82",
"destination_longitude": "-73.05"
}
}{
"error": "VALIDATION_ERROR",
"message": "<string>"
}{
"error": "VALIDATION_ERROR",
"message": "<string>"
}{
"error": "No tienes acceso a este documento"
}{
"error": "VALIDATION_ERROR",
"message": "<string>"
}Documentos
Obtener un documento tributario electrónico (API v2)
Detalle completo de un DTE emitido o recibido: folio, montos, emisor, receptor, ítems, referencias, PDF y eventos de la traza del SII.
GET
/
documents
/
{document_id}
/
Obtener documento específico
curl --request GET \
--url https://api.tupana.ai/v2/documents/{document_id}/ \
--header 'Authorization: <api-key>'import requests
url = "https://api.tupana.ai/v2/documents/{document_id}/"
headers = {"Authorization": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api.tupana.ai/v2/documents/{document_id}/', 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/documents/{document_id}/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <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"
"net/http"
"io"
)
func main() {
url := "https://api.tupana.ai/v2/documents/{document_id}/"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.tupana.ai/v2/documents/{document_id}/")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tupana.ai/v2/documents/{document_id}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"id": "docu_9f2a7c1b8e4d0",
"folio": "<string>",
"date_issued": "2023-12-25",
"amount_with_iva": 123,
"dte_type_code": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"has_trace": true,
"json_param": {
"external_order_id": "PED-123"
},
"additional_info": "Orden de compra N° 4500123 - Centro de costo: Operaciones",
"amount_iva": 123,
"amount_without_iva": 123,
"currency": "CLP",
"sender_id": 123,
"sender_name": "<string>",
"sender_tax_id": "<string>",
"receiver_id": "<string>",
"receiver_name": "<string>",
"receiver_tax_id": "<string>",
"has_credit_note": true,
"is_paid": true,
"traces": [
{
"date_reception": "2023-11-07T05:31:56Z",
"has_receiver_access": true,
"has_issuer_access": true,
"has_holder_access": true,
"is_paid_cash": true,
"has_claims": true,
"is_more_than_eight_days": true,
"has_acknowledgments": true,
"has_guide_reference": true,
"is_rejected": true,
"days_until_executive_merit": 123,
"executive_merit_alert_level": "none",
"events": [
{
"event_code": "ACD",
"event_description": "Acepta Contenido del Documento",
"event_date": "2023-11-07T05:31:56Z",
"responsable_rut": 123,
"responsable_dv": "<string>"
}
]
}
],
"vat_withheld": true,
"exchange_rate": "<string>",
"original_amount": "<string>",
"state": "<string>",
"dte_type_description": "<string>",
"pdf": "<string>",
"xml": "<string>",
"xml_error": "<string>",
"references": [
{
"reference_folio": 123,
"reference_date": "2023-12-25",
"dte_type_code": "<string>",
"reference_reason": "ANULA DOCUMENTO DE LA REFERENCIA"
}
],
"details": [
{
"item_name": "<string>",
"quantity": 123,
"unit_price": 1,
"gross_unit_price": 123,
"is_exempt": false,
"item_description": "<string>",
"discount_percent": 123,
"item_code": "<string>",
"unit": "<string>",
"other_tax": 123,
"item_type_code": 123,
"vat_withholding_code": "48",
"line_number": 1,
"item_total": 4050000,
"show_item_type": "01",
"ticket": {
"ticket_folio": 123,
"generated_at": "2023-11-07T05:31:56Z",
"event_name": "<string>",
"ticket_type": "<string>",
"event_code": "<string>",
"event_datetime": "2023-11-07T05:31:56Z",
"event_place": "<string>",
"event_location": "<string>",
"row": "<string>",
"seat": "<string>"
},
"settled_document_type": "33"
}
],
"header": {
"purchase_transaction_type": "<string>",
"sale_transaction_type": "<string>",
"payment_method": "1",
"due_date": "2023-12-25",
"vat_withheld": false,
"retention_type": "RETRECEPTOR",
"purchase_type": "1"
},
"document_issuer": {
"rut": "<string>",
"business_name": "<string>",
"phone_number": "<string>",
"email": "<string>",
"business_activity": "<string>",
"activity_code": 123,
"sii_branch_code": "<string>",
"address": "<string>",
"district": "<string>",
"city": "<string>"
},
"document_receiver": {
"rut": "<string>",
"business_name": "<string>",
"contact": "<string>",
"business_activity": "<string>",
"address": "<string>",
"district": "<string>",
"city": "<string>"
},
"document_total": {
"net_amount": 123,
"iva_rate": 123,
"iva_amount": 123,
"exempt_amount": 123,
"total_amount": 123
},
"transport_data": {
"transport_type": "1",
"dispatch_type": "2",
"transport_rut": "76234567-6",
"transport_plate": "PJRL69",
"driver_rut": "12345678-5",
"driver_name": "Juan Pérez",
"destination_address": "Aeropuerto Arturo Merino Benitez",
"destination_district": "Pudahuel",
"destination_city": "Santiago",
"transfer_issuer_code": "1",
"authorization_resolution_number": 1234,
"authorization_resolution_date": "2024-03-01",
"departure_port_code": "992",
"arrival_port_code": "134",
"gross_weight": "1414.00",
"gross_weight_unit_code": "6",
"total_packages": 3,
"package_type_code": "22",
"timber_enabled": false,
"comuna_rol": "13101",
"manzana_rol": "12",
"predio_rol": "345",
"geo_ref_system": "1",
"latitude": "-33.45",
"longitude": "-70.65",
"conaf_plan_code": "PM-2024-001",
"trailer_plate": "JK1234",
"departure_date": "2026-11-02",
"departure_time": "08:30",
"arrival_date": "2026-11-02",
"transfer_reason": "Traslado a bodega central para reposición de stock",
"transport_unknown_reason": "El cliente retira con transporte propio no informado",
"destination_commune_role": "13101",
"destination_block_role": "1234",
"destination_property_role": "56",
"work_execution_notice": "AEF-2026-0457",
"destination_latitude": "-36.82",
"destination_longitude": "-73.05"
}
}{
"error": "VALIDATION_ERROR",
"message": "<string>"
}{
"error": "VALIDATION_ERROR",
"message": "<string>"
}{
"error": "No tienes acceso a este documento"
}{
"error": "VALIDATION_ERROR",
"message": "<string>"
}Qué hace
Obtiene toda la información completa de un documento tributario específico, incluyendo PDF, XML, productos, información del emisor y receptor, header, y referencias. Este endpoint es útil para consultar detalles completos de un documento ya emitido o recibido.Ejemplos de uso
- Consultar detalles completos de un documento ya emitido
- Descargar el PDF de un documento específico
- Obtener el XML para procesos de integración
- Verificar información de un documento recibido
- Auditar documentos antes de procesarlos
Campos propios (json_param)
Si al crear el documento enviaste json_param, la respuesta lo devuelve tal cual en el campo json_param (null si no se envió). Para buscar un documento por uno de esos valores usa json_param__<key>=<valor> en el listado.
Información adicional (additional_info)
Si al crear el documento enviaste additional_info, la respuesta lo devuelve en el campo additional_info (null si no se envió). Es el texto que se imprime en el recuadro “Información adicional” del PDF; no forma parte del XML enviado al SII. Solo se imprime si tu empresa usa el PDF propio de Tu Pana o emite con el facturador de mercado; con el PDF oficial del SII el texto se guarda pero no aparece en el PDF.
Trazabilidad SII
La respuesta incluye siempre el arraytraces con cada traza del documento en el SII y, dentro de cada una, la lista events con los eventos registrados (acuse de recibo, reclamos, notas de crédito asociadas, etc.). Revisa los schemas Trace y TraceEvent en la referencia para el detalle de cada campo.
A diferencia del endpoint de listado — donde estos eventos son opt-in vía include_trace_events=true — aquí no necesitas ningún flag adicional.Authorizations
Response
Documento obtenido exitosamente con toda la información completa: PDF, XML, detalles (productos), header, información del emisor y receptor, y referencias
