Quickstart — Tu primera factura en 5 minutos

1. Obtén tu API key

Regístrate en admin.smartapp.com.co  → Completa onboarding → Ve a Settings → Copia tu API Key.

2. Configura tu tenant

Cada empresa (tenant) necesita:

3. Envía tu primera factura

curl -X POST https://emision.smartapp.com.co/api/v1/service/invoice \
  -H "Authorization: Bearer TU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "customer": {
      "document_type": "31",
      "document_number": "900123456",
      "name": "Cliente Ejemplo SAS",
      "email": "cliente@ejemplo.com"
    },
    "lines": [
      {
        "code": "P001",
        "name": "Servicio de consultoría",
        "quantity": 1,
        "unit_price": 150000,
        "taxes": [
          {"code": "01", "name": "IVA", "rate": 19}
        ]
      }
    ],
    "payment": {
      "method_code": "10",
      "due_date": "2026-06-10"
    }
  }'

Python

import requests
 
resp = requests.post(
    "https://emision.smartapp.com.co/api/v1/service/invoice",
    headers={"Authorization": "Bearer sk_..."},
    json={
        "customer": {"document_type": "31", "document_number": "900123456", "name": "Cliente Ejemplo SAS",
                     "email": "cliente@ejemplo.com"},
        "lines": [{"code": "P001", "name": "Servicio de consultoría", "quantity": 1, "unit_price": 150000,
                    "taxes": [{"code": "01", "name": "IVA", "rate": 19}]}],
        "payment": {"method_code": "10", "due_date": "2026-06-10"}
    }
)
print(resp.json())

PHP

$data = json_encode([
    "customer" => ["document_type" => "31", "document_number" => "900123456",
                   "name" => "Cliente Ejemplo SAS", "email" => "cliente@ejemplo.com"],
    "lines" => [["code" => "P001", "name" => "Servicio de consultoría", "quantity" => 1,
                  "unit_price" => 150000,
                  "taxes" => [["code" => "01", "name" => "IVA", "rate" => 19]]]],
    "payment" => ["method_code" => "10", "due_date" => "2026-06-10"]
]);
 
$ch = curl_init("https://emision.smartapp.com.co/api/v1/service/invoice");
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => ["Authorization: Bearer sk_...", "Content-Type: application/json"],
    CURLOPT_POSTFIELDS => $data,
    CURLOPT_RETURNTRANSFER => true,
]);
echo curl_exec($ch);

Node.js

const resp = await fetch("https://emision.smartapp.com.co/api/v1/service/invoice", {
  method: "POST",
  headers: {
    "Authorization": "Bearer sk_...",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    customer: { document_type: "31", document_number: "900123456",
                name: "Cliente Ejemplo SAS", email: "cliente@ejemplo.com" },
    lines: [{ code: "P001", name: "Servicio de consultoría", quantity: 1, unit_price: 150000,
              taxes: [{ code: "01", name: "IVA", rate: 19 }] }],
    payment: { method_code: "10", due_date: "2026-06-10" }
  })
});
console.log(await resp.json());

C#

using System.Net.Http.Json;
 
var client = new HttpClient();
client.DefaultRequestHeaders.Authorization =
    new AuthenticationHeaderValue("Bearer", "sk_...");
 
var body = new
{
    customer = new { document_type = "31", document_number = "900123456",
                     name = "Cliente Ejemplo SAS", email = "cliente@ejemplo.com" },
    lines = new[] {
        new { code = "P001", name = "Servicio de consultoría", quantity = 1,
              unit_price = 150000,
              taxes = new[] { new { code = "01", name = "IVA", rate = 19 } } }
    },
    payment = new { method_code = "10", due_date = "2026-06-10" }
};
 
var response = await client.PostAsJsonAsync(
    "https://emision.smartapp.com.co/api/v1/service/invoice", body);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);

Java

HttpClient client = HttpClient.newHttpClient();
String body = """
    {
      "customer": {"document_type": "31", "document_number": "900123456",
                   "name": "Cliente Ejemplo SAS", "email": "cliente@ejemplo.com"},
      "lines": [{"code": "P001", "name": "Servicio de consultoría", "quantity": 1,
                 "unit_price": 150000,
                 "taxes": [{"code": "01", "name": "IVA", "rate": 19}]}],
      "payment": {"method_code": "10", "due_date": "2026-06-10"}
    }
    """;
 
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://emision.smartapp.com.co/api/v1/service/invoice"))
    .header("Authorization", "Bearer sk_...")
    .header("Content-Type", "application/json")
    .POST(HttpRequest.BodyPublishers.ofString(body))
    .build();
 
HttpResponse<String> response = client.send(request, BodyHandlers.ofString());
System.out.println(response.body());

4. Recibe la respuesta

{
  "success": true,
  "cufe": "abc123...",
  "xml_url": "https://...",
  "pdf_url": "https://...",
  "status": "accepted",
  "dian_response": {
    "track_id": "xyz789",
    "status": "accepted",
    "status_message": "Documento validado correctamente"
  }
}

5. Verifica el estado

Usa el processId devuelto en el paso anterior:

curl https://emision.smartapp.com.co/v1/billing/status/abc123... \
  -H "Authorization: Bearer TU_API_KEY"

Para facturas POS usa /v1/billing/status/{processId}, para eventos RADIAN usa /v1/events/status/{processId}.

Siguientes pasos