// Documentos electrónicos
Consultar documento soporte
Trae un documento soporte por su ID con el estado ante la DIAN, el CUDS, el proveedor, los totales y los archivos.
GET
/api/v1/support-documents/{id}En esta página
Con el support_document_id que devolvió el 202, consulta hasta que final sea true. Los estados son los de la factura: PENDING, ACCEPTED o REJECTED. Ver Consultar factura.
Headers
| Header | Obligatorio | Valor |
|---|---|---|
nestfac-api-key |
Sí | Tu API key. Ver Autenticación. |
Parámetros de ruta
Path
- idstring (uuid)obligatorio
- El
support_document_iddel documento.
Ejemplo
curl "https://api-sandbox.nestfac.co/api/v1/support-documents/804e2c7b-d10c-4443-b830-e3b9e8162f2f" \
-H "nestfac-api-key: $NESTFAC_API_KEY"// Node.js 18+ (fetch nativo). Corre en TU servidor: la API key nunca va al navegador.
const res = await fetch("https://api-sandbox.nestfac.co/api/v1/support-documents/804e2c7b-d10c-4443-b830-e3b9e8162f2f", {
headers: {
"nestfac-api-key": process.env.NESTFAC_API_KEY,
},
});
const json = await res.json();
if (!res.ok) throw new Error(`${json.code ?? res.status}: ${json.message ?? JSON.stringify(json.errors)}`);
console.log(json.data);import os
import requests
res = requests.get(
"https://api-sandbox.nestfac.co/api/v1/support-documents/804e2c7b-d10c-4443-b830-e3b9e8162f2f",
headers={
"nestfac-api-key": os.environ["NESTFAC_API_KEY"],
},
timeout=30,
)
data = res.json()
if not res.ok:
raise RuntimeError(f"{data.get('code', res.status_code)}: {data.get('message') or data.get('errors')}")
print(data["data"])<?php
$ch = curl_init('https://api-sandbox.nestfac.co/api/v1/support-documents/804e2c7b-d10c-4443-b830-e3b9e8162f2f');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'nestfac-api-key: ' . getenv('NESTFAC_API_KEY'),
],
]);
$response = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($status >= 400) {
throw new RuntimeException(($response['code'] ?? $status) . ': ' . ($response['message'] ?? json_encode($response['errors'] ?? null)));
}
print_r($response['data']);// .NET 7+
using System.Net.Http;
using System.Text;
using var http = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://api-sandbox.nestfac.co/api/v1/support-documents/804e2c7b-d10c-4443-b830-e3b9e8162f2f");
request.Headers.Add("nestfac-api-key", Environment.GetEnvironmentVariable("NESTFAC_API_KEY"));
var response = await http.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode) throw new Exception($"{(int)response.StatusCode}: {result}");
Console.WriteLine(result);// Java 15+ (java.net.http)
import java.net.URI;
import java.net.http.*;
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api-sandbox.nestfac.co/api/v1/support-documents/804e2c7b-d10c-4443-b830-e3b9e8162f2f"))
.header("nestfac-api-key", System.getenv("NESTFAC_API_KEY"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() >= 400) throw new RuntimeException(response.body());
System.out.println(response.body());package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
req, _ := http.NewRequest("GET", "https://api-sandbox.nestfac.co/api/v1/support-documents/804e2c7b-d10c-4443-b830-e3b9e8162f2f", nil)
req.Header.Set("nestfac-api-key", os.Getenv("NESTFAC_API_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
out, _ := io.ReadAll(res.Body)
fmt.Println(res.StatusCode, string(out))
}// La API key NUNCA va en el navegador. React llama a TU backend,
// y tu backend llama a NestFac con la key (pestaña Node.js).
import { useEffect, useState } from "react";
export function useNestfac(path = "/support-documents/804e2c7b-d10c-4443-b830-e3b9e8162f2f") {
const [data, setData] = useState(null);
const [error, setError] = useState(null);
useEffect(() => {
const ctrl = new AbortController();
fetch(`/api/nestfac${path}`, { signal: ctrl.signal })
.then(async (res) => {
const json = await res.json();
if (!res.ok) throw new Error(json.message ?? json.code);
setData(json.data);
})
.catch((e) => e.name !== "AbortError" && setError(e));
return () => ctrl.abort();
}, [path]);
return { data, error, loading: !data && !error };
}200 OK
{
"success": true,
"data": {
"id": "804e2c7b-d10c-4443-b830-e3b9e8162f2f",
"billing_account_id": "3f6c2a9e-5b1d-4c7e-9a2f-8d1e0b4c6a71",
"number": "SEDS984000021",
"prefix": "SEDS",
"consecutive": "984000021",
"reference_code": "COMPRA-2026-103",
"residency": "10",
"generation_mode": "1",
"status": "ACCEPTED",
"final": true,
"dian": {
"status": "ACCEPTED",
"cuds": "36fc3c90245d098a6ffe7d3ba45a71e664937d73daf45128566229a43e4292693d167b037df5a3cb47a6e3ff1e37d24a",
"qr": null,
"track_id": "36fc3c90245d098a6ffe7d3ba45a71e664937d73daf45128566229a43e4292693d167b037df5a3cb47a6e3ff1e37d24a",
"accepted_at": "2026-10-23T12:26:42.312Z",
"errors": []
},
"vendor": {
"document_type_code": "31",
"document_number": "1075123456",
"name": "Pedro Pérez Gómez"
},
"issue_date": "2026-10-23T12:26:39.499Z",
"due_date": null,
"currency": "COP",
"totals": {
"line_extension": "400000.00",
"line_discounts": "0.00",
"adjustments": "0.00",
"taxes": "76000.00",
"withholdings": "0.00",
"rounding": "0.00",
"total": "476000.00"
},
"foreign_currency": null,
"payment": { "form_code": "1", "method_code": "10", "due_days": null },
"files": {
"xml": { "available": true, "url": "/api/v1/support-documents/804e2c7b-…/files/xml" },
"application-response": { "available": true, "url": "/api/v1/support-documents/804e2c7b-…/files/application-response" },
"pdf": { "available": false, "url": "/api/v1/support-documents/804e2c7b-…/files/pdf" },
"zip": { "available": true, "url": "/api/v1/support-documents/804e2c7b-…/files/zip" }
},
"email_sent_at": null,
"created_at": "2026-10-23T12:26:39.811Z",
"updated_at": "2026-10-23T12:26:42.313Z"
}
}Campos de la respuesta
Misma forma que la factura, con estas diferencias:
data
- dian.cudsstring
Código único del documento soporte (CUDS). Es el equivalente del CUFE de la factura.
- residencystring
- Residencia del proveedor (
10o11). - generation_modestring
1por operación,2acumulado semanal.- reference_codestring | null
- Tu
reference_codeal crearlo. - vendorobject
Resumen del proveedor:
document_type_code,document_numberyname.- totalsobject
- Igual que en la factura, sin
prepaid,paidnipending. - filesobject
xml,application-response,pdfyzip. El documento soporte no tieneattached-document.
// Revisado contra la API el 24 de octubre de 2026.