Referencia de API

La API de InvoiceNests permite a sus aplicaciones crear y leer facturas, clientes, pagos, productos y gastos para una sola organización. Todas las solicitudes usan HTTPS y devuelven JSON.

Introducción

La API de InvoiceNests permite a sus aplicaciones crear y leer facturas, clientes, pagos, productos y gastos para una sola organización. Todas las solicitudes usan HTTPS y devuelven JSON.

Autenticación estilo OAuth

Intercambie su client_id + client_secret por tokens de acceso de corta duración. Los tokens de actualización rotan en cada uso.

Verificación sin acceso a BD

Los tokens de acceso JWT se verifican localmente con HMAC: latencia inferior al milisegundo, sin viaje adicional a la base de datos.

1h de acceso / 30d de actualización

Los tokens de acceso duran 1 hora. Los tokens de actualización duran 30 días y rotan en cada uso.

Detección de reutilización

Si se reutiliza un token de actualización, todas las sesiones activas para esa clave se revocan inmediatamente.

Inicio rápido

1

Create an API key

Open Settings -> API -> Create Key. Choose the scopes the integration needs, such as read:invoices. You will receive a Client ID (ak_live_...) and a Secret Key (sk_live_...). The secret is shown only once, so store it securely.

Settings → API → Create Key
2

Exchange your credentials for an access token

Send a POST request to /api/v1/auth/token with your client_id, client_secret, and grant_type="client_credentials". The response includes an access token and a refresh token.

Request
POST https://app.invoicenests.com/api/v1/auth/token
Content-Type: application/json

{
  "client_id":     "ak_live_…",      // public key
  "client_secret": "sk_live_…",      // secret key (shown once)
  "grant_type":    "client_credentials"
}
200 OK
{
  "access_token":  "eyJhbGciOiJIUzI1NiIs…",
  "token_type":    "Bearer",
  "expires_in":    3600,
  "refresh_token": "rt_live_…",
  "scope":         "read:invoices read:clients …"
}
3

Call data endpoints with the access token

Add the Authorization: Bearer ACCESS_TOKEN header to each request, replacing ACCESS_TOKEN with the token from step 2. Data endpoints are available under /api/v1.

Request
GET https://app.invoicenests.com/api/v1/invoices
Authorization: Bearer <access_token>
4

Refresh the token before it expires

Before the access token expires, POST your refresh_token to /api/v1/auth/refresh to receive a new token pair. Each refresh token can only be used once.

Request
POST https://app.invoicenests.com/api/v1/auth/refresh
Content-Type: application/json

{ "refresh_token": "rt_live_…" }

Using React and TypeScript?

Endpoint examples include typed React and TypeScript samples where available. Use the language tabs to switch examples.

Introducción

La API de InvoiceNests permite a sus aplicaciones crear y leer facturas, clientes, pagos, productos y gastos para una sola organización. Todas las solicitudes usan HTTPS y devuelven JSON.