Lexiel Expedientes API

Gestión de expedientes judiciales y extrajudiciales

GitHub OpenAPI

Operations 5

GET /v1/cases Listar expedientes #
POST /v1/cases Crear expediente #
GET /v1/cases/{id} Obtener expediente #
PATCH /v1/cases/{id} Actualizar expediente #
DELETE /v1/cases/{id} Archivar o borrar definitivamente un expediente #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/lexiel-ai:lexiel-ai-expedientes-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

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.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

lexiel-ai-expedientes-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Lexiel Expedientes 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: Expedientes
  description: Gestión de expedientes judiciales y extrajudiciales
paths:
  /v1/cases:
    get:
      tags:
      - Expedientes
      summary: Listar expedientes
      x-required-scope: cases:read
      description: Expedientes visibles para el usuario dueño de la clave, del más reciente al más antiguo.
      parameters:
      - name: status
        in: query
        schema:
          type: string
          enum:
          - intake
          - active
          - on_hold
          - closed_won
          - closed_lost
          - archived
        description: Filtrar por estado
      - name: q
        in: query
        schema:
          type: string
        description: Búsqueda por título o referencia
      - name: limit
        in: query
        schema:
          type: integer
          default: 50
          maximum: 100
      - name: offset
        in: query
        schema:
          type: integer
          default: 0
      responses:
        '200':
          description: Lista de expedientes
          content:
            application/json:
              schema:
                type: object
                properties:
                  cases:
                    type: array
                    items:
                      $ref: '#/components/schemas/Case'
                  total:
                    type: integer
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
      operationId: getV1Cases
      x-operation-id-source: derived
    post:
      tags:
      - Expedientes
      summary: Crear expediente
      x-required-scope: cases:write
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CaseCreate'
      responses:
        '201':
          description: Expediente creado
          content:
            application/json:
              schema:
                type: object
                properties:
                  case:
                    $ref: '#/components/schemas/Case'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
      operationId: postV1Cases
      x-operation-id-source: derived
  /v1/cases/{id}:
    parameters:
    - name: id
      in: path
      required: true
      schema:
        type: string
        format: uuid
    get:
      tags:
      - Expedientes
      summary: Obtener expediente
      x-required-scope: cases:read
      description: Un expediente archivado se sigue pudiendo leer.
      responses:
        '200':
          description: Expediente
          content:
            application/json:
              schema:
                type: object
                properties:
                  case:
                    $ref: '#/components/schemas/Case'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      operationId: getV1CasesById
      x-operation-id-source: derived
    patch:
      tags:
      - Expedientes
      summary: Actualizar expediente
      x-required-scope: cases:write
      description: Para reabrir un expediente archivado, cambia su `status` a uno distinto de `archived`.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CaseUpdate'
      responses:
        '200':
          description: Expediente actualizado
          content:
            application/json:
              schema:
                type: object
                properties:
                  case:
                    $ref: '#/components/schemas/Case'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      operationId: patchV1CasesById
      x-operation-id-source: derived
    delete:
      tags:
      - Expedientes
      summary: Archivar o borrar definitivamente un expediente
      x-required-scope: cases:write
      description: 'Sin parámetros, ARCHIVA: el expediente pasa a `status: archived`, se sigue pudiendo leer (GET) y deja de aceptar conversaciones y mensajes nuevos (409 CASE_ARCHIVED). Sus documentos y conversaciones no se borran.


        Con `?permanent=true`, BORRA de forma definitiva el expediente y, en cascada, sus conversaciones con todos sus mensajes, sus documentos (con sus fragmentos indexados, versiones y ficheros), plazos, borradores y notas. Solo puede hacerlo quien creó el expediente o un propietario/administrador del despacho. No se puede deshacer. Si el expediente tiene registros que la ley obliga a conservar (facturas, presupuestos, tiempos o gastos; evidencias de firma o de consentimiento de grabación; reuniones o grabaciones), responde 409 CASE_HAS_RETAINED_RECORDS y no borra nada. El registro de auditoría del despacho se conserva siempre.'
      parameters:
      - name: permanent
        in: query
        required: false
        schema:
          type: string
          enum:
          - 'true'
        description: Borrado definitivo en cascada
      responses:
        '200':
          description: 'Archivado (`{"archived": true}`) o borrado definitivo con el recuento de lo eliminado'
          content:
            application/json:
              schema:
                oneOf:
                - type: object
                  properties:
                    archived:
                      type: boolean
                      enum:
                      - true
                - type: object
                  properties:
                    deleted:
                      type: boolean
                      enum:
                      - true
                    permanent:
                      type: boolean
                      enum:
                      - true
                    caseId:
                      type: string
                      format: uuid
                    removed:
                      type: object
                      properties:
                        conversations:
                          type: integer
                        messages:
                          type: integer
                        documents:
                          type: integer
                        documentChunks:
                          type: integer
                        documentVersions:
                          type: integer
                        deadlines:
                          type: integer
                        writingDrafts:
                          type: integer
                        criminalRecords:
                          type: integer
                        storageObjects:
                          type: integer
                    storageFailed:
                      type: integer
                      description: Ficheros que no se pudieron borrar del almacenamiento en este momento (sus filas ya no existen)
                    kept:
                      type: array
                      items:
                        type: string
                      description: 'Lo que se conserva por obligación legal: `audit_log`'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
      operationId: deleteV1CasesById
      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'
    RateLimited:
      description: RATE_LIMITED (límite de frecuencia; respeta la cabecera Retry-After) o PLAN_LIMIT_REACHED (cuota del plan agotada)
      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'
    Forbidden:
      description: 'API_KEY_SCOPE: la clave no tiene el ámbito que pide la operación (`error.requiredScope`) o el endpoint no está disponible con clave. FORBIDDEN: el usuario no puede hacer esa operación sobre ese recurso.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: Recurso no encontrado
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Conflict:
      description: 'CASE_ARCHIVED, CONVERSATION_ARCHIVED, CASE_HAS_RETAINED_RECORDS o DOCUMENT_IN_USE: el estado del recurso no permite la operación.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    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'
    Case:
      type: object
      properties:
        id:
          type: string
          format: uuid
        title:
          type: string
        caseNumber:
          type:
          - string
          - 'null'
        courtCaseNumber:
          type:
          - string
          - 'null'
        status:
          type: string
          enum:
          - intake
          - active
          - on_hold
          - closed_won
          - closed_lost
          - archived
        clientId:
          type:
          - string
          - 'null'
          format: uuid
        practiceArea:
          type:
          - string
          - 'null'
        jurisdiction:
          type:
          - string
          - 'null'
        factsSummary:
          type:
          - string
          - 'null'
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    CaseUpdate:
      type: object
      properties:
        title:
          type: string
          minLength: 1
          maxLength: 500
        caseNumber:
          type: string
          maxLength: 100
        courtCaseNumber:
          type: string
          maxLength: 100
        status:
          type: string
          enum:
          - intake
          - active
          - on_hold
          - closed_won
          - closed_lost
          - archived
          description: Un valor distinto de `archived` reabre un expediente archivado
        factsSummary:
          type: string
          maxLength: 50000
    CaseCreate:
      type: object
      required:
      - title
      properties:
        title:
          type: string
          minLength: 1
          maxLength: 500
        caseNumber:
          type: string
          maxLength: 100
          description: Referencia interna
        courtCaseNumber:
          type: string
          maxLength: 100
          description: Número de procedimiento judicial
        practiceArea:
          type: string
          enum:
          - civil
          - penal
          - laboral
          - mercantil
          - contencioso_administrativo
          - familia
          - propiedad_intelectual
          - fiscal
          - internacional
          - general
        jurisdiction:
          type: string
          enum:
          - civil
          - penal
          - contencioso_administrativo
          - social
          - mercantil
          - constitucional
          - militar
          - europeo
        role:
          type: string
          enum:
          - demandante
          - demandado
          - acusado
          - denunciante
          - recurrente
          - other
        factsSummary:
          type: string
          maxLength: 50000
          description: 'Hechos del asunto (se guardan en el expediente; el chat no los lee: el contexto de cada consulta va en su `content` y en los documentos del expediente)'
        clientId:
          type: string
          format: uuid
        parties:
          type: object
          properties:
            client:
              type: object
              required:
              - name
              properties:
                name:
                  type: string
                dni:
                  type: string
                address:
                  type: string
                phone:
                  type: string
                email:
                  type: string
                  format: email
            opposing:
              type: object
              required:
              - name
              properties:
                name:
                  type: string
                dni:
                  type: string
                lawyer:
                  type: string
            court:
              type: object
              required:
              - name
              properties:
                name:
                  type: string
                section:
                  type: string
                judge:
                  type: string
  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.'