Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we
store it to create your key and to recognise you if you sign in with another
provider. By signing up you are subscribing to the APIs.io and API Evangelist
newsletters — you can unsubscribe from any issue. See our
Privacy Policy and Terms.
openapi: 3.2.0
info:
title: Lexiel Facturación API
version: 1.0.0
description: 'API REST de Lexiel para integraciones servidor a servidor. Guía con ejemplos: https://lexiel.ai/es/developers (English: https://lexiel.ai/en/developers).
**Autenticación**: `Authorization: Bearer lx_…` con una clave creada en Ajustes > API (plan de pago). La clave actúa como el usuario que la creó, dentro de su despacho: solo ve y modifica lo que ese usuario ve en la aplicación. Nunca la pongas en un navegador ni en una app; úsala solo desde tu servidor.
**Ámbitos**: cada clave tiene ámbitos (`cases:read`, `cases:write`, `documents:read`, `documents:write`, `conversations:read`, `conversations:write`, `invoices:read`, `invoices:write`, `calendar:read`, `clients:read`, `clients:write`, `analytics:read`). Cada operación indica el suyo en `x-required-scope`; sin él responde 403 `API_KEY_SCOPE` con `error.requiredScope`. Las claves anteriores al 11-11-2026 tienen todos.
**Límites**: 60 peticiones por minuto por clave (y por IP de origen), además de los límites por usuario de cada ruta (cabeceras `X-RateLimit-*` y `Retry-After` en el 429 `RATE_LIMITED`). Cada consulta a la IA y cada análisis de documento consumen la cuota mensual del plan de la cuenta (429 `PLAN_LIMIT_REACHED`).
**Errores**: `{ "error": { "code": "…", "message": "…" } }`. El `code` es estable; el `message` puede cambiar.'
contact:
name: Soporte Lexiel
url: https://lexiel.ai/contacto
email: hola@lexiel.ai
license:
name: Privado — solo para clientes autorizados
servers:
- url: https://api.lexiel.ai
description: Producción
- url: http://localhost:4966
description: Desarrollo local
security:
- bearerAuth: []
tags:
- name: Facturación
description: Facturas, presupuestos y registro de tiempos
paths:
/v1/invoices:
get:
tags:
- Facturación
summary: Listar facturas
x-required-scope: invoices:read
parameters:
- name: status
in: query
schema:
type: string
enum:
- draft
- sent
- paid
- overdue
- cancelled
- rectified
- refunded
- name: clientId
in: query
schema:
type: string
format: uuid
- name: page
in: query
schema:
type: integer
default: 1
- name: pageSize
in: query
schema:
type: integer
default: 20
responses:
'200':
description: Lista de facturas
content:
application/json:
schema:
type: object
properties:
items:
type: array
items:
$ref: '#/components/schemas/Invoice'
total:
type: integer
'401':
$ref: '#/components/responses/Unauthorized'
operationId: getV1Invoices
x-operation-id-source: derived
post:
tags:
- Facturación
summary: Crear factura
x-required-scope: invoices:write
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/InvoiceCreate'
responses:
'201':
description: Factura creada
content:
application/json:
schema:
$ref: '#/components/schemas/Invoice'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
operationId: postV1Invoices
x-operation-id-source: derived
components:
responses:
BadRequest:
description: Solicitud inválida — parámetros incorrectos o faltantes
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
Unauthorized:
description: 'No autorizado: falta la clave, no existe, está desactivada o caducada, o su usuario está inactivo (UNAUTHORIZED, MEMBER_INACTIVE)'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
schemas:
Invoice:
type: object
properties:
id:
type: string
format: uuid
number:
type: string
status:
type: string
enum:
- draft
- sent
- paid
- overdue
- cancelled
- rectified
- refunded
clientId:
type:
- string
- 'null'
format: uuid
subtotal:
type: number
tax:
type: number
total:
type: number
currency:
type: string
default: EUR
issueDate:
type: string
format: date
dueDate:
type:
- string
- 'null'
format: date
createdAt:
type: string
format: date-time
Error:
type: object
properties:
error:
type: object
properties:
code:
type: string
description: Código estable; el texto de `message` puede cambiar
message:
type: string
requiredScope:
type: string
description: 'Solo en API_KEY_SCOPE: el ámbito que falta'
InvoiceCreate:
type: object
required:
- clientId
- items
properties:
clientId:
type: string
format: uuid
issueDate:
type: string
format: date
dueDate:
type: string
format: date
notes:
type: string
items:
type: array
minItems: 1
items:
type: object
required:
- description
- quantity
- unitPrice
properties:
description:
type: string
quantity:
type: number
minimum: 0.01
unitPrice:
type: number
minimum: 0
taxRate:
type: number
default: 21
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: lx_… (clave de API) o JWT
description: 'Clave de API (`Authorization: Bearer lx_…`) creada en Ajustes > API, o el JWT de una sesión de Lexiel. Cada operación indica en `x-required-scope` el ámbito que necesita la clave.'