> ## Documentation Index
> Fetch the complete documentation index at: https://docs.veripay.datagora.mx/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Descarga tu primer CEP en menos de 5 minutos.

<Info>
  Necesitas una cuenta de Veripay y una API key. Crea ambas gratis en el [dashboard](https://veripay.datagora.mx/signup).
</Info>

## 1. Crear una API key

1. Inicia sesión en [veripay.datagora.mx/dashboard](https://veripay.datagora.mx/dashboard).
2. Ve a **API keys → Crear**.
3. Asigna un nombre descriptivo (p. ej. `backend-prod`).
4. Copia el valor `vk_live_...`. **Sólo se muestra una vez.**

<Warning>
  Guarda la key como secreto en tu backend. Nunca la expongas en frontend ni la subas a Git.
</Warning>

## 2. Hacer tu primera llamada

El endpoint **`POST /api/v1/cep/xml_auto`** descarga el CEP en XML e infiere automáticamente emisor y receptor a partir de la CLABE.

<CodeGroup>
  ```bash curl theme={null}
  curl -sS -X POST "https://veripay.datagora.mx/api/v1/cep/xml_auto" \
    -H "Content-Type: application/json" \
    -H "x-api-key: vk_live_xxxxxxxx.SECRETO" \
    -d '{
      "fecha": "2025-08-15",
      "clave_rastreo": "CR12345678",
      "cuenta": "012180001234567890",
      "monto": 1234.56
    }' \
    --output cep.xml
  ```

  ```python python theme={null}
  import requests

  resp = requests.post(
      "https://veripay.datagora.mx/api/v1/cep/xml_auto",
      headers={"x-api-key": "vk_live_xxxxxxxx.SECRETO"},
      json={
          "fecha": "2025-08-15",
          "clave_rastreo": "CR12345678",
          "cuenta": "012180001234567890",
          "monto": 1234.56,
      },
      timeout=15,
  )
  resp.raise_for_status()
  open("cep.xml", "wb").write(resp.content)
  ```

  ```javascript node theme={null}
  const res = await fetch("https://veripay.datagora.mx/api/v1/cep/xml_auto", {
    method: "POST",
    headers: {
      "content-type": "application/json",
      "x-api-key": "vk_live_xxxxxxxx.SECRETO",
    },
    body: JSON.stringify({
      fecha: "2025-08-15",
      clave_rastreo: "CR12345678",
      cuenta: "012180001234567890",
      monto: 1234.56,
    }),
  });
  if (!res.ok) throw new Error(await res.text());
  const buf = Buffer.from(await res.arrayBuffer());
  require("fs").writeFileSync("cep.xml", buf);
  ```

  ```go go theme={null}
  package main

  import (
    "bytes"
    "io"
    "net/http"
    "os"
  )

  func main() {
    body := bytes.NewBufferString(`{"fecha":"2025-08-15","clave_rastreo":"CR12345678","cuenta":"012180001234567890","monto":1234.56}`)
    req, _ := http.NewRequest("POST", "https://veripay.datagora.mx/api/v1/cep/xml_auto", body)
    req.Header.Set("content-type", "application/json")
    req.Header.Set("x-api-key", "vk_live_xxxxxxxx.SECRETO")
    res, _ := http.DefaultClient.Do(req)
    defer res.Body.Close()
    data, _ := io.ReadAll(res.Body)
    os.WriteFile("cep.xml", data, 0644)
  }
  ```
</CodeGroup>

## 3. Interpretar la respuesta

* **`200 OK`** + cuerpo binario XML → CEP encontrado y firmado por Banxico.
* Headers `X-Inferred-Emisor` / `X-Inferred-Receptor` te indican qué dedujo el gateway.
* **`404 NOT_FOUND`** → Banxico no tiene registro con esos parámetros (revisa `fecha` ±1 día y `monto` exacto).
* **`400 INFERENCE_FAILED`** → No se pudo inferir el banco; usa la versión sin `_auto` con `emisor`/`receptor` explícitos.

## 4. Otros formatos disponibles

| Endpoint           | Devuelve           | Cuándo usarlo                     |
| ------------------ | ------------------ | --------------------------------- |
| `/v1/cep/xml_auto` | `application/xml`  | Default, parseable y compacto     |
| `/v1/cep/pdf_auto` | `application/pdf`  | Adjuntar a clientes / facturación |
| `/v1/cep/zip_auto` | `application/zip`  | PDF + XML en un solo request      |
| `/v1/cep/base64`   | `application/json` | Cliente sin soporte binario       |
| `/v1/cep/xml`      | `application/xml`  | Si ya conoces emisor + receptor   |

<Card title="Siguiente paso" icon="arrow-right" href="/api-reference/introduction">
  Explora todos los endpoints en la **Referencia API** con playground interactivo.
</Card>
