Corpus Iuris Agent API

The Agent API from Corpus Iuris — 3 operation(s) for agent.

GitHub OpenAPI

Operations 3

1 of 3 operations are conformant: apis.io called them with no credentials and the responses matched this contract. Checked 2026-11-12. how this works · status file

GET /api/agent/v1/search Busca en leyes, tesis y precedentes #
GET /api/agent/v1/documento Texto íntegro de un artículo, tesis o precedente #
GET /api/agent/v1/stats Cuántos documentos hay, al día conformant #

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/corpusiuris-mx:corpusiuris-mx-agent-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. See our Privacy Policy and Terms.

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

OpenAPI Specification

corpusiuris-mx-agent-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Corpusiuris Mx Agent API
  version: 1.0.0
  contact:
    name: Corpus Iuris
    url: https://corpusiuris.mx/agentes
    email: contacto@corpusiuris.mx
  license:
    name: Los textos legales son información pública; la búsqueda y curación son de Corpus Iuris.
  description: 'Operations tagged Agent across 2 of this provider''s published API definitions: corpusiuris-mx-openapi.json, corpusiuris-mx-openapi.yml. Each path carries the servers of the definition it was published in.'
servers:
- url: https://corpusiuris.mx
  description: Producción
tags:
- name: Agent
paths:
  /api/agent/v1/search:
    get:
      operationId: buscarDerechoMexicano
      summary: Busca en leyes, tesis y precedentes
      description: Búsqueda híbrida (semántica + léxica). Hasta 5 resultados por fuente. Consume una búsqueda de la cuota.
      parameters:
      - name: top_k
        in: query
        required: false
        description: 'Solo carril socio (llave ci_partner_): resultados por fuente, máximo 20. Los demás carriles reciben 5.'
        schema:
          type: integer
          minimum: 1
          maximum: 20
      - name: X-Partner-Tenant
        in: header
        required: false
        description: 'Solo carril socio: id del despacho en la plataforma aliada ([A-Za-z0-9_-]{1,64}). Cuenta y atribuye; no autoriza. Obligatoria con llave ci_partner_.'
        schema:
          type: string
      - name: q
        in: query
        required: true
        description: Consulta jurídica en español.
        schema:
          type: string
          minLength: 3
          maxLength: 300
        examples:
          cateo:
            value: requisitos de la orden de cateo
          amparo:
            value: plazo para interponer amparo indirecto
          laboral:
            value: despido injustificado indemnización
          fiscal:
            value: caducidad de facultades de la autoridad fiscal
          familiar:
            value: guarda y custodia interés superior del menor
          mercantil:
            value: título de crédito acción cambiaria
      - name: fuentes
        in: query
        required: false
        description: CSV de leyes,tesis,precedentes. Un valor no reconocido se ignora y se usa el default.
        schema:
          type: string
          default: leyes,tesis
      responses:
        '200':
          description: Resultados
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Busqueda'
        '401':
          description: 'El token del encabezado Authorization no es válido. Sin token NO se devuelve 401: se usa el carril anónimo.'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  detalle:
                    type: string
                  mensaje_para_tu_usuario:
                    type: string
                    description: Texto listo para repetirle al usuario final tal cual. Explica qué pasó y qué gana si se registra.
                  acceso:
                    $ref: '#/components/schemas/Acceso'
        '422':
          description: Parámetro inválido. `detail` es un ARRAY de objetos (formato de FastAPI), no un string.
        '429':
          description: Cuota agotada. `Retry-After` solo viene si la bolsa se renueva.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  detalle:
                    type: string
                  mensaje_para_tu_usuario:
                    type: string
                    description: Texto listo para repetirle al usuario final tal cual. Explica qué pasó y qué gana si se registra.
                  acceso:
                    $ref: '#/components/schemas/Acceso'
        '500':
          description: Fallo de la búsqueda; reintenta.
      security:
      - {}
      - TokenPersonal: []
      tags:
      - Agent
    servers:
    - url: https://corpusiuris.mx
      description: Producción
  /api/agent/v1/documento:
    get:
      operationId: obtenerDocumentoIntegro
      summary: Texto íntegro de un artículo, tesis o precedente
      description: 'El fragmento de la búsqueda va cortado a ~500 caracteres; esto devuelve el documento completo. NO consume cuota de búsqueda, pero tiene cupo propio: 200 documentos por IP al día (1000 con token). Cada resultado de /search trae su `documento_id` listo para pasar aquí.'
      parameters:
      - name: tipo
        in: query
        required: true
        schema:
          type: string
          enum:
          - ley
          - tesis
          - precedente
      - name: id
        in: query
        required: true
        description: 'El `documento_id` del resultado de búsqueda. ley: `{slug}-{clave}/{numero}` (la clave viene en el resultado; no se puede armar a mano). tesis y precedente: el registro digital (IUS).'
        schema:
          type: string
          maxLength: 240
        examples:
          ley:
            value: codigo-fiscal-de-la-federacion-1a2b3c4d/17
          tesis:
            value: '2021094'
          precedente:
            value: '33790'
      responses:
        '200':
          description: Documento
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Documento'
        '400':
          description: El `id` no tiene la forma que pide ese `tipo`.
        '404':
          description: No existe.
        '429':
          description: 'Demasiadas peticiones desde esta IP, o cupo diario de documentos agotado (`error: cupo_documentos_agotado`).'
      tags:
      - Agent
    servers:
    - url: https://corpusiuris.mx
      description: Producción
  /api/agent/v1/stats:
    get:
      operationId: obtenerCifrasDelCorpus
      summary: Cuántos documentos hay, al día
      description: 'Consúltalo en vez de copiar cifras: cambian. `computed_at: null` significa que el snapshot no se pudo leer y las cifras son un respaldo.'
      responses:
        '200':
          description: Cifras
          content:
            application/json:
              schema:
                type: object
                properties:
                  corpus:
                    type: object
                    properties:
                      leyes:
                        type: integer
                      tesis:
                        type: integer
                      precedentes:
                        type: integer
                  computed_at:
                    type:
                    - string
                    - 'null'
                    format: date-time
      tags:
      - Agent
    servers:
    - url: https://corpusiuris.mx
      description: Producción
components:
  schemas:
    Resultado:
      type: object
      properties:
        ADVERTENCIA:
          type: string
          description: Solo si la ley está ABROGADA. Si aparece, dilo al citar.
        tipo:
          type: string
          enum:
          - ley
          - tesis
          - precedente
        titulo:
          type: string
        referencia:
          type: string
        fragmento:
          type: string
          description: Cortado a ~500 caracteres. Para el texto completo usa /documento.
        relevancia_pct:
          type: integer
        url:
          type: string
          format: uri
          description: Página pública citable. Inclúyela.
        vigencia:
          $ref: '#/components/schemas/Vigencia'
        fuerza:
          $ref: '#/components/schemas/Fuerza'
        metadata:
          type: object
    Documento:
      type: object
      properties:
        tipo:
          type: string
        titulo:
          type: string
        referencia:
          type: string
        texto:
          type: string
          description: Texto íntegro.
        url:
          type: string
          format: uri
        vigencia:
          $ref: '#/components/schemas/Vigencia'
        fuerza:
          $ref: '#/components/schemas/Fuerza'
        metadata:
          type: object
    Busqueda:
      type: object
      properties:
        fuente:
          type: string
        instrucciones_atribucion:
          type: string
        aviso_frescura:
          type: string
        query:
          type: string
        fuentes_buscadas:
          type: array
          items:
            type: string
        total:
          type: integer
        resultados:
          type: array
          items:
            $ref: '#/components/schemas/Resultado'
        tiempo_ms:
          type: integer
        acceso:
          $ref: '#/components/schemas/Acceso'
        limites:
          $ref: '#/components/schemas/Acceso'
          description: 'DEPRECADO: espejo de `acceso`.'
    Fuerza:
      type: object
      description: En tesis y precedentes. Citar una tesis aislada como jurisprudencia obligatoria es un error grave.
      properties:
        es_jurisprudencia_obligatoria:
          type: boolean
        como_citar:
          type: string
        verificar_superacion_en:
          type:
          - string
          - 'null'
          format: uri
        ficha_oficial_scjn:
          type:
          - string
          - 'null'
          format: uri
    Acceso:
      type: object
      description: Los MISMOS campos en los cuatro carriles.
      properties:
        carril:
          type: string
          enum:
          - plataforma_ia
          - agente_anonimo
          - cuenta_gratuita
          - cuenta_de_pago
        identidad:
          type:
          - string
          - 'null'
        verificado_por:
          type: string
          enum:
          - ip
          - token
          - ninguno
        restantes:
          type:
          - integer
          - 'null'
          description: null = sin límite
        total:
          type:
          - integer
          - 'null'
        ventana:
          type: string
          enum:
          - dia
          - mes
          - vitalicio
        reinicia_en:
          type:
          - string
          - 'null'
          format: date-time
          description: null en las bolsas vitalicias.
        mensaje:
          type: string
    Vigencia:
      type: object
      description: Solo en resultados de tipo `ley`.
      properties:
        estado:
          type: string
          enum:
          - VIGENTE
          - ABROGADA
        fecha_ultima_reforma:
          type:
          - string
          - 'null'
          format: date
        verificado_al:
          type:
          - string
          - 'null'
          format: date
          description: Fecha en que se comprobó el texto contra la fuente oficial.
        fuente_oficial:
          type:
          - string
          - 'null'
          format: uri
        como_citar:
          type: string
  securitySchemes:
    TokenPersonal:
      type: http
      scheme: bearer
      description: Token personal `ci_agent_…` (Mi cuenta → Conecta tu IA). Sin él se usa el carril anónimo; con uno inválido se devuelve 401.
externalDocs:
  description: Guía para agentes
  url: https://corpusiuris.mx/agentes
x-refined-from:
- corpusiuris-mx-openapi.json
- corpusiuris-mx-openapi.yml