OpenMercantil Legal API

Spanish mercantile-law layer (derecho mercantil): legislation corpus + article texts + act→norm bridge. Distributes the consolidated BOE legal corpus structured by OpenMercantil so LLMs and agents can cite it as a source. License: consolidated text from the BOE, reused under Ley 37/2007 (re-use of public sector information); the official version is always boe.es. Informational only — NOT legal advice. Court judgments are NOT exposed here (CENDOJ is kept as a citation-index only, per CGPJ…

OpenAPI Specification

openmercantil-legal-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: OpenMercantil Legal API
  version: 1.9.3
  summary: Versioned public-read, browser-account, billing, support and provider-callback contracts.
  description: 'Public JSON API for Spanish company information derived from BORME and other public sources.
    OpenMercantil is an independent informational service; it is NOT the BOE, BORME or Registro Mercantil
    and does NOT replace official certificates or registry extracts.


    **Rate limits.** Free: 60 req/min y 200 req/día por IP. Planes superiores (Profesional 5.000 req/día,
    MAX 50.000 req/día, Enterprise 500.000+ req/día) según cuenta y API key. Cabeceras `X-RateLimit-Limit`,
    `X-RateLimit-Remaining`, `X-RateLimit-Reset`, `X-OpenMercantil-Plan`, `Retry-After`.


    **License and attribution.** Source-specific metadata in each response and the active versioned source
    catalog prevails. OpenMercantil does not relicense upstream content under a blanket license. Unknown,
    review and restricted datasets are omitted or return `503 legal_layer_unavailable`. BOE/BORME material
    is re-used under Ley 37/2007 and its official version remains boe.es. Court judgments are not exposed;
    CENDOJ remains citation-index only under CGPJ Reglamento 3/2010.


    **Machine-readable catalog (DCAT-AP-ES):** https://openmercantil.es/catalog.rdf'
  termsOfService: https://openmercantil.es/terminos-de-uso
  contact:
    name: OpenMercantil
    url: https://openmercantil.es/soporte
    email: social@openmercantil.es
  license:
    name: Source-specific upstream terms; see response catalog metadata
    url: https://openmercantil.es/terminos-de-uso
  x-publisher:
    name: OpenMercantil
    url: https://openmercantil.es/
    email: social@openmercantil.es
  x-spatial: http://publications.europa.eu/resource/authority/country/ESP
  x-temporal: 2009-01-01/..
  x-language: es
  x-dcat-catalog: https://openmercantil.es/catalog.rdf
  x-rate-limit:
    free:
      per_min: 60
      per_day: 200
      kind: anonymous-ip
    profesional:
      per_min: 120
      per_day: 5000
      kind: api-key
    max:
      per_min: 600
      per_day: 50000
      kind: api-key
    enterprise:
      per_min: 1200
      per_day: 500000
      kind: contract
  x-methodology: https://openmercantil.es/metodologia
  x-sources: https://openmercantil.es/fuentes
  x-corrections: https://openmercantil.es/correcciones
  x-contract-status: Public read, browser-account and provider-callback surfaces are explicitly separated
    in this contract. Operator/admin routes are excluded. The public MCP consumes only the allowlisted
    GET read plane.
  x-account-segment-contract:
    projection: company_public_v2 immutable corporate sidecar
    synchronous_row_cap: 500
    bounded_count_cap: 50001
    count_semantics: The segment run response count is the number of rows returned, never a global total.
      Dataset preview uses total_is_lower_bound=true and total_lower_bound when the bounded count reaches
      50001.
    related_web_dataset_surface:
      preview_path: /mi-cuenta/datasets/preview
      export_path: /mi-cuenta/datasets/export.csv
      synchronous_export_max_rows: 500
      overflow_status: 503
      overflow_error: async_export_required
  x-company-identity-contract:
    version: '1.0'
    projection: company_public_v2 immutable generation-bound corporate sidecar
    applies_to: Every /api/v1/company/{slug}*, /api/v1/empresa/{slug}* and /api/v1/grafo/{slug} read before
      any report, cache, graph or dataset lookup. /api/v1/companies/compare resolves both requested subjects
      in one bounded company_public_v2 batch before either row is exposed; MCP company tools inherit these
      preflights through REST.
    resolution:
      published: canonical corporate slug admitted
      safe_alias: internally canonicalized and Content-Location emitted
      withheld: neutral 404; includes absent, personal and ambiguous/quarantined identities
      unavailable: 503 with no-store; clients must not infer absence
    search: Exact corporate CIF, exact canonical/safe-alias slug, or bounded name_prefix2 pool scored
      in application code. DNI/NIE and ambiguous CIFs return zero items.
    public_company_count: company_public_projection_state.row_count
servers:
- url: https://openmercantil.es
  description: Production
tags:
- name: Legal
  description: 'Spanish mercantile-law layer (derecho mercantil): legislation corpus + article texts +
    act→norm bridge. Distributes the consolidated BOE legal corpus structured by OpenMercantil so LLMs
    and agents can cite it as a source. License: consolidated text from the BOE, reused under Ley 37/2007
    (re-use of public sector information); the official version is always boe.es. Informational only —
    NOT legal advice. Court judgments are NOT exposed here (CENDOJ is kept as a citation-index only, per
    CGPJ Reglamento 3/2010); this layer distributes legislation + the act↔norm index.'
paths:
  /api/v1/empresa/{slug}/informe-legal:
    post:
      operationId: createCompanyLegalReport
      tags:
      - Legal
      - Companies
      - User
      summary: Create the authenticated user's redacted corporate legal report
      description: Account and credit-entitlement surface for a legal entity only. The server owns beta/pricing
        policy and a daily idempotency key scoped to user, company and UTC date; clients cannot choose
        price or entitlement. Every report is recursively PII-redacted before egress. Documentary events
        and citations do not prove wrongdoing, solvency, current status, identity of a natural person
        or completeness, and this informational report is not legal advice or an official certificate.
        Unknown or unauthorized source policy, natural-person subjects and missing helpers fail closed.
        The JSON body is capped at 32 KiB and accepts only the CSRF fallback.
      x-plane: account-paid-egress
      x-entitlement: legal_report (server-owned credits/beta policy)
      x-source-policy: legal_report_v1; fail closed until a versioned public decision authorizes every
        included source
      x-activation-status: policy-closed
      x-idempotency-key: 'server: legal_report:{user_id}:{company_slug}:{UTC-date}'
      x-max-body-bytes: 32768
      x-rate-limit: API plan policy plus a per-user action budget of 10 attempts per 15 minutes and 50
        per day
      x-privacy: Corporate subjects only; recursive PII redaction before serialization
      x-mcp-excluded: true
      security:
      - cookieAuth: []
      parameters:
      - name: slug
        in: path
        required: true
        schema:
          type: string
          pattern: ^[a-z0-9-]+$
      - $ref: '#/components/parameters/CsrfHeader'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LegalReportRequest'
      responses:
        '200':
          description: Redacted documentary corporate report and server-owned charging result
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LegalReportResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          description: Insufficient credits or the idempotent charge could not be completed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LegalReportPaymentRequiredError'
        '403':
          description: Invalid or missing CSRF token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Corporate subject not found or the slug is classified as a natural-person subject
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: not_found
        '413':
          description: Request body exceeds 32 KiB
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RequestBodyTooLargeError'
              example:
                error: request_body_too_large
                max_bytes: 32768
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '503':
          description: Action-budget storage, legal source policy, report helper, account schema or credit
            ledger unavailable; generation fails closed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
  /api/v1/legal/norms:
    get:
      security:
      - {}
      - apiKey: []
      - bearerAuth: []
      x-api-credential-scope: legal:read
      operationId: getLegalNorms
      tags:
      - Legal
      summary: Index of core Spanish mercantile-law norms
      description: 'Return the catalog of core Spanish mercantile-law norms (codes, laws, royal-decree-legislatives,
        regulations) structured by OpenMercantil. Each item links to its HTML page (`/ley/{slug}`) and
        its norm-detail API (`/api/v1/legal/norm/{slug}`). LICENSE: consolidated text from the BOE, re-used
        under Ley 37/2007; the official, authentic version is always boe.es. Informational only — NOT
        legal advice. Cached 24h. Returns 503 if the legal catalog is not deployed yet.'
      x-rate-limit: free 60/min · 200/day
      x-license: BOE — Ley 37/2007 (re-use of public sector information)
      responses:
        '200':
          headers:
            X-Data-Sources:
              $ref: '#/components/headers/XDataSources'
            X-Source-Catalog-Version:
              $ref: '#/components/headers/XSourceCatalogVersion'
            X-Attribution-Required:
              $ref: '#/components/headers/XAttributionRequired'
          description: Norm index with license/attribution/disclaimer envelope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LegalNormsIndexResponse'
              example:
                layer: derecho-mercantil
                count: 48
                norms:
                - slug: ley-de-sociedades-de-capital
                  title: Ley de Sociedades de Capital (texto refundido, RDLeg 1/2010)
                  short_name: LSC
                  norm_type: real_decreto_legislativo
                  norm_type_label: Real Decreto Legislativo
                  in_force: true
                  url: https://openmercantil.es/ley/ley-de-sociedades-de-capital
                  api_url: https://openmercantil.es/api/v1/legal/norm/ley-de-sociedades-de-capital
                license: BOE — Ley 37/2007 (reutilización de la información del sector público)
                license_url: https://www.boe.es/informacion/aviso_legal/index.php
                attribution: Texto consolidado del Boletín Oficial del Estado (BOE), estructurado por
                  OpenMercantil. La versión oficial y auténtica es la publicada en boe.es.
                disclaimer: Contenido meramente informativo. No constituye asesoramiento jurídico ni sustituye
                  al texto oficial consolidado del BOE.
                docs: https://openmercantil.es/leyes
                generated_at: '2026-06-04T00:00:00+00:00'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '503':
          $ref: '#/components/responses/LegalLayerUnavailable'
  /api/v1/legal/norm:
    get:
      operationId: getLegacyLegalNorms
      tags:
      - Legal
      summary: Index mercantile-law norms through the singular legacy alias
      description: Deprecated alias of `GET /api/v1/legal/norms`. It returns the same BOE-attributed informational
        catalog and is not the norm-detail route; norm detail requires `/api/v1/legal/norm/{slug}`.
      deprecated: true
      x-replaced-by: /api/v1/legal/norms
      x-rate-limit: free 60/min · 200/day
      x-license: BOE — Ley 37/2007 (re-use of public sector information)
      responses:
        '200':
          description: Norm index with license, attribution and disclaimer envelope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LegalNormsIndexResponse'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '503':
          $ref: '#/components/responses/LegalLayerUnavailable'
  /api/v1/legal/norm/{slug}:
    get:
      security:
      - {}
      - apiKey: []
      - bearerAuth: []
      x-api-credential-scope: legal:read
      operationId: getLegalNormBySlug
      tags:
      - Legal
      summary: Detail of a single mercantile-law norm (with act↔norm bridge)
      description: 'Return one norm''s BOE/ELI identification, its key articles (each with canonical URL
        + a flag for seeded consolidated text), the BORME act types it governs (the law→data bridge) and
        a single AI-citable atomic fact (`citable_fact`). LICENSE: consolidated text from the BOE, re-used
        under Ley 37/2007; the official version is boe.es. Informational only — NOT legal advice. Cached
        24h.'
      x-rate-limit: free 60/min · 200/day
      x-license: BOE — Ley 37/2007 (re-use of public sector information)
      parameters:
      - name: slug
        in: path
        required: true
        schema:
          type: string
          pattern: ^[a-z0-9\-]+$
          example: ley-de-sociedades-de-capital
        description: Norm slug as listed by /api/v1/legal/norms.
      responses:
        '200':
          headers:
            X-Data-Sources:
              $ref: '#/components/headers/XDataSources'
            X-Source-Catalog-Version:
              $ref: '#/components/headers/XSourceCatalogVersion'
            X-Attribution-Required:
              $ref: '#/components/headers/XAttributionRequired'
          description: Norm detail with key articles, regulated acts and a citable fact
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LegalNormResponse'
              example:
                norm:
                  slug: ley-de-sociedades-de-capital
                  title: Ley de Sociedades de Capital (texto refundido, RDLeg 1/2010)
                  short_name: LSC
                  norm_type: real_decreto_legislativo
                  norm_type_label: Real Decreto Legislativo
                  boe_id: BOE-A-2010-10544
                  eli: https://www.boe.es/eli/es/rdlg/2010/07/02/1
                  official_url: https://www.boe.es/buscar/act.php?id=BOE-A-2010-10544
                  in_force: true
                  repealed_by: null
                  summary: 'Norma central del derecho societario español: regula la sociedad anónima (SA),
                    la limitada (SL/SLU) y la comanditaria por acciones.'
                  date_published: '2010-07-02'
                  date_modified: '2026-06-04'
                  url: https://openmercantil.es/ley/ley-de-sociedades-de-capital
                key_articles:
                - article_num: '318'
                  label: El acuerdo de reducción del capital social
                  rule: la reducción del capital social habrá de acordarse por la junta general con los
                    requisitos de la modificación de estatutos
                  has_text: true
                  url: https://openmercantil.es/ley/ley-de-sociedades-de-capital/articulo/318
                  api_url: https://openmercantil.es/api/v1/legal/article/ley-de-sociedades-de-capital/318
                regulated_acts:
                - act_type: ampliacion-capital
                  label: Ampliación de capital
                  articles: LSC arts. 295-316
                  microtext: El aumento de capital social está regulado en los arts. 295-316 LSC.
                  url: https://openmercantil.es/ley/ley-de-sociedades-de-capital/empresas
                citable_fact:
                  statement: La reducción del capital social de una SA o SL debe acordarse por la junta
                    general con los requisitos de la modificación de estatutos (art. 318 LSC).
                  source: BOE — texto consolidado (Ley 37/2007)
                  source_url: https://www.boe.es/buscar/act.php?id=BOE-A-2010-10544
                  date: '2010-07-02'
                  verify_url: https://openmercantil.es/ley/ley-de-sociedades-de-capital/articulo/318
                license: BOE — Ley 37/2007 (reutilización de la información del sector público)
                license_url: https://www.boe.es/informacion/aviso_legal/index.php
                attribution: Texto consolidado del Boletín Oficial del Estado (BOE), estructurado por
                  OpenMercantil. La versión oficial y auténtica es la publicada en boe.es.
                disclaimer: Contenido meramente informativo. No constituye asesoramiento jurídico ni sustituye
                  al texto oficial consolidado del BOE.
                generated_at: '2026-06-04T00:00:00+00:00'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '503':
          $ref: '#/components/responses/LegalLayerUnavailable'
  /api/v1/legal/article/{norm}/{n}:
    get:
      security:
      - {}
      - apiKey: []
      - bearerAuth: []
      x-api-credential-scope: legal:read
      operationId: getLegalArticleByNormByN
      tags:
      - Legal
      summary: Consolidated text of a single article
      description: Return the consolidated text (`body_html`) of one article of a norm, plus its ELI anchor,
        version date and the minimal context of the parent norm. The text comes from the consolidated
        BOE and is re-used under Ley 37/2007 — the official version is boe.es. Informational only — NOT
        legal advice. Cached 24h. The article number `{n}` accepts digits plus a bis/ter suffix joined
        by a hyphen (e.g. `160-bis`).
      x-rate-limit: free 60/min · 200/day
      x-license: BOE — Ley 37/2007 (re-use of public sector information)
      parameters:
      - name: norm
        in: path
        required: true
        schema:
          type: string
          pattern: ^[a-z0-9\-]+$
          example: ley-de-sociedades-de-capital
        description: Norm slug.
      - name: n
        in: path
        required: true
        schema:
          type: string
          pattern: ^[0-9a-z\-\.]+$
          example: '318'
        description: Article number (digits, optionally with a bis/ter suffix joined by a hyphen).
      responses:
        '200':
          headers:
            X-Data-Sources:
              $ref: '#/components/headers/XDataSources'
            X-Source-Catalog-Version:
              $ref: '#/components/headers/XSourceCatalogVersion'
            X-Attribution-Required:
              $ref: '#/components/headers/XAttributionRequired'
          description: Consolidated article text
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LegalArticleResponse'
              example:
                norm:
                  slug: ley-de-sociedades-de-capital
                  title: Ley de Sociedades de Capital (texto refundido, RDLeg 1/2010)
                  short_name: LSC
                  official_url: https://www.boe.es/buscar/act.php?id=BOE-A-2010-10544
                article_num: '318'
                title: Artículo 318. El acuerdo de reducción del capital social.
                body_html: <p>1. La reducción del capital social habrá de acordarse por la junta general
                  con los requisitos de la modificación de estatutos.</p>
                eli_anchor: https://www.boe.es/eli/es/rdlg/2010/07/02/1/con#a318
                version_date: '2021-01-01'
                url: https://openmercantil.es/ley/ley-de-sociedades-de-capital/articulo/318
                license: BOE — Ley 37/2007 (reutilización de la información del sector público)
                license_url: https://www.boe.es/informacion/aviso_legal/index.php
                attribution: Texto consolidado del Boletín Oficial del Estado (BOE), estructurado por
                  OpenMercantil. La versión oficial y auténtica es la publicada en boe.es.
                disclaimer: Contenido meramente informativo. No constituye asesoramiento jurídico ni sustituye
                  al texto oficial consolidado del BOE.
                generated_at: '2026-06-04T00:00:00+00:00'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '503':
          $ref: '#/components/responses/LegalLayerUnavailable'
  /api/v1/legal/act-map:
    get:
      security:
      - {}
      - apiKey: []
      - bearerAuth: []
      x-api-credential-scope: legal:read
      operationId: getLegalActMap
      tags:
      - Legal
      summary: BORME act type → governing norm bridge (full or single)
      description: 'Return the bridge mapping each BORME act type (constitución, nombramiento, ampliación
        de capital, disolución, concurso, …) to the norm and articles that govern it — the law↔data connection
        that lets an LLM answer ''which law governs this registry act''. Without `{acto}` returns the
        full map; with `/act-map/{acto}` returns a single mapping. License: BOE / Ley 37/2007. Informational
        only — NOT legal advice. Cached 24h.'
      x-rate-limit: free 60/min · 200/day
      x-license: BOE — Ley 37/2007 (re-use of public sector information)
      responses:
        '200':
          headers:
            X-Data-Sources:
              $ref: '#/components/headers/XDataSources'
            X-Source-Catalog-Version:
              $ref: '#/components/headers/XSourceCatalogVersion'
            X-Attribution-Required:
              $ref: '#/components/headers/XAttributionRequired'
          description: Full act→norm map with license envelope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LegalActMapResponse'
              example:
                layer: puente-acto-norma
                count: 22
                act_map:
                - act_type: ampliacion-capital
                  norm_slug: ley-de-sociedades-de-capital
                  norm_api_url: https://openmercantil.es/api/v1/legal/norm/ley-de-sociedades-de-capital
                  articles: LSC arts. 295-316
                  microtext: El aumento de capital social está regulado en los arts. 295-316 LSC.
                  concept_slug: null
                license: BOE — Ley 37/2007 (reutilización de la información del sector público)
                license_url: https://www.boe.es/informacion/aviso_legal/index.php
                attribution: Texto consolidado del Boletín Oficial del Estado (BOE), estructurado por
                  OpenMercantil. La versión oficial y auténtica es la publicada en boe.es.
                disclaimer: Contenido meramente informativo. No constituye asesoramiento jurídico ni sustituye
                  al texto oficial consolidado del BOE.
                generated_at: '2026-06-04T00:00:00+00:00'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '503':
          $ref: '#/components/responses/LegalLayerUnavailable'
  /api/v1/legal/act-map/{acto}:
    get:
      security:
      - {}
      - apiKey: []
      - bearerAuth: []
      x-api-credential-scope: legal:read
      operationId: getLegalActMapByActo
      tags:
      - Legal
      summary: Governing norm for a single BORME act type
      description: 'Return the norm + articles that govern a single BORME act type. License: BOE / Ley
        37/2007. Informational only — NOT legal advice.'
      x-rate-limit: free 60/min · 200/day
      x-license: BOE — Ley 37/2007 (re-use of public sector information)
      parameters:
      - name: acto
        in: path
        required: true
        schema:
          type: string
          pattern: ^[a-z0-9\-]+$
          example: ampliacion-capital
        description: BORME act type slug (as listed in the full act-map).
      responses:
        '200':
          headers:
            X-Data-Sources:
              $ref: '#/components/headers/XDataSources'
            X-Source-Catalog-Version:
              $ref: '#/components/headers/XSourceCatalogVersion'
            X-Attribution-Required:
              $ref: '#/components/headers/XAttributionRequired'
          description: Single act→norm mapping
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LegalActMapEntry'
              example:
                act_type: ampliacion-capital
                norm_slug: ley-de-sociedades-de-capital
                norm_api_url: https://openmercantil.es/api/v1/legal/norm/ley-de-sociedades-de-capital
                articles: LSC arts. 295-316
                microtext: El aumento de capital social está regulado en los arts. 295-316 LSC.
                concept_slug: null
                license: BOE — Ley 37/2007 (reutilización de la información del sector público)
                license_url: https://www.boe.es/informacion/aviso_legal/index.php
                attribution: Texto consolidado del Boletín Oficial del Estado (BOE), estructurado por
                  OpenMercantil. La versión oficial y auténtica es la publicada en boe.es.
                disclaimer: Contenido meramente informativo. No constituye asesoramiento jurídico ni sustituye
                  al texto oficial consolidado del BOE.
                generated_at: '2026-06-04T00:00:00+00:00'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '503':
          $ref: '#/components/responses/LegalLayerUnavailable'
components:
  headers:
    NoStoreCacheControl:
      description: Error responses must not be stored.
      schema:
        type: string
        const: no-store
    XAttributionRequired:
      description: Optional. When present, comma-separated public source aliases whose attribution terms
        must accompany reuse.
      schema:
        type: string
        minLength: 1
        pattern: ^[a-z0-9][a-z0-9_.-]*(,[a-z0-9][a-z0-9_.-]*)*$
      example: placsp
    XDataSources:
      description: Comma-separated aliases from the active public source catalog that contributed to the
        response. Omitted only when a valid exact filter returns an empty representation with zero contributing
        sources.
      schema:
        type: string
        minLength: 1
        pattern: ^[a-z0-9][a-z0-9_.-]*(,[a-z0-9][a-z0-9_.-]*)*$
      example: borme,placsp
    XSourceCatalogVersion:
      description: Mandatory on every successful public GET. Exact version of the legal source catalog
        used to authorize the response.
      schema:
        type: string
        minLength: 1
      example: 2026-07-12.2
  parameters:
    CsrfHeader:
      name: X-CSRF-Token
      in: header
      required: true
      description: Fresh token returned by GET /api/v1/user/me for this authenticated session.
      schema:
        type: string
        minLength: 32
        maxLength: 256
  responses:
    BadRequest:
      description: Invalid request
      headers:
        Cache-Control:
          $ref: '#/components/headers/NoStoreCacheControl'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    LegalLayerUnavailable:
      description: 'Controlled fail-closed denial: the required dataset or legal layer is absent, invalid,
        unsupported or not authorized for this public surface.'
      headers:
        Cache-Control:
          $ref: '#/components/headers/NoStoreCacheControl'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: legal_layer_unavailable
            detail: Este dataset no esta habilitado para redistribucion publica por la politica de fuentes
              activa.
            source_catalog_version: 2026-07-12.2
    NotFound:
      description: Resource not found
      headers:
        Cache-Control:
          $ref: '#/components/headers/NoStoreCacheControl'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    TooManyRequests:
      description: Rate limit exceeded
      headers:
        Retry-After:
          description: Seconds to wait before retrying.
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: Authentication required (no active session)
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  schemas:
    ErrorResponse:
      type: object
      description: Closed compatibility envelope for public/account errors. Route-specific schemas narrow
        these fields further where required.
      required:
      - error
      properties:
        error:
          type: string
          minLength: 1
        message:
          type: string
        detail:
          type: string
        code:
          type: string
        status:
          type:
          - integer
          - string
        projection:
          type: string
        reason:
          type: string
        source_catalog_version:
          type: string
        allowed_parameters:
          type: array
          uniqueItems: true
          items:
            type: string
        slug:
          type: string
        key:
          type: string
        maximum:
          type: integer
          minimum: 1
        parameter:
          type: string
        fields:
          type: array
          items:
            type: string
        max_bytes:
          type: integer
          minimum: 1
        allowed:
          type: array
          items:
            $ref: '#/components/schemas/JsonValue'
        valid:
          type: array
          items:
            $ref: '#/components/schemas/JsonValue'
        date:
          type: string
        login_url:
          type: string
        plan:
          type: string
        limited_by:
          type: string
          enum:
          - minute
          - day
        daily_limit:
          type: integer
          minimum: 1
        reset_at:
          type: integer
          minimum: 1
        reset_at_human:
          type: string
          format: date-time
        retry_after_s:
          type: integer
          minimum: 1
        retry_after:
          type: integer
          minimum: 1
        upgrade:
          type: string
          format: uri
        upgrade_url:
          type: string
        action:
          type: string
        limit:
          type: integer
          minimum: 0
        remaining:
          type: integer
          minimum: 0
        needed:
          type: integer
          minimum: 0
        shortfall:
          type: integer
          minimum: 0
        ok:
          type: boolean
        _alias_of:
          type: string
      additionalProperties: false
    JsonValue:
      description: A JSON value used only inside explicitly documented extension maps.
      oneOf:
      - type:
        - string
        - number
        - boolean
        - 'null'
      - type: array
        items:
          $ref: '#/components/schemas/JsonValue'
      - type: object
        additionalProperties:
          $ref: '#/components/schemas/JsonValue'
    LegalActMapEntry:
      allOf:
      - type: object
        properties:
          act_type:
            type: string
            example: ampliacion-capital
          norm_slug:
            type: string
          norm_api_url:
            type:
            - string
            - 'null'
            format: uri
          articles:
            type: string
          microtext:
            type: string
          concept_slug:
            type:
            - string
            - 'null'
      - $ref: '#/components/schemas/LegalLicenseFields'
    LegalActMapResponse:
      allOf:
      - type: object
        required:
        - layer
        - count
        - act_map
        properties:
          layer:
      

# --- truncated at 32 KB (44 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/openmercantil/refs/heads/main/openapi/openmercantil-legal-api-openapi.yml