OKF Index Legislation API
The Legislation API from OKF Index — 11 operation(s) for legislation.
The Legislation API from OKF Index — 11 operation(s) for legislation.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
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.curl "https://apis.io/api/v1/apis/okfindex-com:okfindex-com-legislation-api"
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.
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: 3.2.0
info:
title: OKF Index Legislation API
version: cb36b312
description: 'The search index of Open Knowledge Format bundles. Index: GET /api/.'
servers:
- url: https://okfindex.com
tags:
- name: Legislation
paths:
/api/legislation:
get:
operationId: legislation_status
summary: Coverage, source commit and synchronization status
description: 'Returns: {ok,total,official_total,official_checked_at,official_error,source_commit,checked_at,changed_at,error,scope,source_url,seed_url,currency_verified:false,facets:{types,years,authorities:[{value,total}]},search,okf_url}. Dates are UTC. Facets describe the complete collection. official_total counts documents collected directly from Congress. The initial snapshot remains available during the bounded refresh. ok=false reports stale or failed synchronization.'
responses:
'200':
description: '{ok,total,official_total,official_checked_at,official_error,source_commit,checked_at,changed_at,error,scope,source_url,seed_url,currency_verified:false,facets:{types,years,authorities:[{value,total}]},search,okf_url}. Dates are UTC. Facets describe the complete collection. official_total counts documents collected directly from Congress. The initial snapshot remains available during the bounded refresh. ok=false reports stale or failed synchronization.'
'400':
description: Invalid query or part.
'404':
description: Document or part not found.
'429':
description: Reader busy. Retry after the stated delay.
'503':
description: The corpus is unavailable. Do not treat this as no results.
tags:
- Legislation
/api/legislation/search:
get:
operationId: search_legislation
summary: Search Brazilian federal legal texts
description: 'Full-text search covers title, description and body. Number/year uses an exact indexed lookup. Source metadata is not a verification of legal currency. No state or municipal laws in this collection.
Returns: {items:[{id,title,description,type,year,number,authority,country:''BR'',jurisdiction:''federal'',uf:null,provider,source_url,lexml_url,downloaded_at,text_version,revoked,missing_text,sha256,api,url,okf_url}],next}. Up to 20 items; follow next until null. authority=unknown means the source did not identify an issuing body. UF does not apply to this federal jurisdiction.'
parameters:
- name: q
in: query
required: false
schema:
type: string
description: Number/year, such as 10406/2002, or words. At most 160 characters. LGPD, CDC and Código Civil aliases are supported.
- name: type
in: query
required: false
schema:
type: string
description: constituicao, leis-ordinarias, leis-complementares, leis-delegadas or decretos-lei.
- name: year
in: query
required: false
schema:
type: integer
description: Year, from 1800 to 2099.
- name: authority
in: query
required: false
schema:
type: string
description: 'Issuing body declared by the source: congresso-nacional, presidencia-da-republica or unknown. The provider is separate.'
- name: after
in: query
required: false
schema:
type: string
description: Cursor from next. Do not generate a cursor.
responses:
'200':
description: '{items:[{id,title,description,type,year,number,authority,country:''BR'',jurisdiction:''federal'',uf:null,provider,source_url,lexml_url,downloaded_at,text_version,revoked,missing_text,sha256,api,url,okf_url}],next}. Up to 20 items; follow next until null. authority=unknown means the source did not identify an issuing body. UF does not apply to this federal jurisdiction.'
'400':
description: Invalid query or part.
'404':
description: Document or part not found.
'429':
description: Reader busy. Retry after the stated delay.
'503':
description: The corpus is unavailable. Do not treat this as no results.
tags:
- Legislation
/api/legislation/{id}:
get:
operationId: get_legislation
summary: Read a law, its provenance and first text part
description: 'Returns: Search item fields plus {metadata,source_commit,repository_url,original_url,parts,part:1,markdown}. Official-source records have null source_commit and repository_url. original_url downloads the complete Markdown conversion. Relevant source metadata and original evidence are preserved. revoked:false does not prove that the law is in force.'
parameters:
- name: id
in: path
required: true
schema:
type: string
description: Stable 24-character hexadecimal law ID from search results.
responses:
'200':
description: Search item fields plus {metadata,source_commit,repository_url,original_url,parts,part:1,markdown}. Official-source records have null source_commit and repository_url. original_url downloads the complete Markdown conversion. Relevant source metadata and original evidence are preserved. revoked:false does not prove that the law is in force.
'400':
description: Invalid query or part.
'404':
description: Document or part not found.
'429':
description: Reader busy. Retry after the stated delay.
'503':
description: The corpus is unavailable. Do not treat this as no results.
tags:
- Legislation
/api/legislation/{id}/parts/{part}:
get:
operationId: get_legislation_part
summary: Read one bounded text part
description: 'Returns: {id,part,parts,markdown,sha256}. Parts are continuous source text. Join markdown values in order to reconstruct the body.'
parameters:
- name: id
in: path
required: true
schema:
type: string
description: Stable 24-character hexadecimal law ID from search results.
- name: part
in: path
required: true
schema:
type: integer
description: Text part, from 1 to the document's parts value.
responses:
'200':
description: '{id,part,parts,markdown,sha256}. Parts are continuous source text. Join markdown values in order to reconstruct the body.'
'400':
description: Invalid query or part.
'404':
description: Document or part not found.
'429':
description: Reader busy. Retry after the stated delay.
'503':
description: The corpus is unavailable. Do not treat this as no results.
tags:
- Legislation
/api/legislation/index.md:
get:
operationId: get_api_legislation_index_md
summary: Root OKF index, organized by law type and year
description: 'Returns: UTF-8 text/markdown.'
responses:
'200':
description: UTF-8 text/markdown.
'400':
description: Invalid query or part.
'404':
description: Document or part not found.
'429':
description: Reader busy. Retry after the stated delay.
'503':
description: The corpus is unavailable. Do not treat this as no results.
tags:
- Legislation
/api/legislation/types/{type}/index.md:
get:
operationId: get_api_legislation_types_by_type_index_md
summary: OKF index of years for one law type
description: 'Returns: UTF-8 text/markdown.'
parameters:
- name: type
in: path
required: true
schema:
type: string
description: constituicao, leis-ordinarias, leis-complementares, leis-delegadas or decretos-lei.
responses:
'200':
description: UTF-8 text/markdown.
'400':
description: Invalid query or part.
'404':
description: Document or part not found.
'429':
description: Reader busy. Retry after the stated delay.
'503':
description: The corpus is unavailable. Do not treat this as no results.
tags:
- Legislation
/api/legislation/types/{type}/{year}/index.md:
get:
operationId: get_api_legislation_types_by_type_by_year_index_md
summary: OKF index of laws for one year. Follow Next page
description: 'Returns: UTF-8 text/markdown.'
parameters:
- name: type
in: path
required: true
schema:
type: string
description: constituicao, leis-ordinarias, leis-complementares, leis-delegadas or decretos-lei.
- name: year
in: path
required: true
schema:
type: integer
description: Year, from 1800 to 2099.
- name: after
in: query
required: false
schema:
type: string
description: Cursor from next. Do not generate a cursor.
responses:
'200':
description: UTF-8 text/markdown.
'400':
description: Invalid query or part.
'404':
description: Document or part not found.
'429':
description: Reader busy. Retry after the stated delay.
'503':
description: The corpus is unavailable. Do not treat this as no results.
tags:
- Legislation
/api/legislation/{id}/index.md:
get:
operationId: get_api_legislation_by_id_index_md
summary: OKF index of all parts of one law
description: 'Returns: UTF-8 text/markdown.'
parameters:
- name: id
in: path
required: true
schema:
type: string
description: Stable 24-character hexadecimal law ID from search results.
responses:
'200':
description: UTF-8 text/markdown.
'400':
description: Invalid query or part.
'404':
description: Document or part not found.
'429':
description: Reader busy. Retry after the stated delay.
'503':
description: The corpus is unavailable. Do not treat this as no results.
tags:
- Legislation
/api/legislation/{id}/original.md:
get:
operationId: get_api_legislation_by_id_original_md
summary: Complete stored Markdown, up to 10 MiB; official records contain a text…
description: 'Returns: UTF-8 text/markdown.'
parameters:
- name: id
in: path
required: true
schema:
type: string
description: Stable 24-character hexadecimal law ID from search results.
responses:
'200':
description: UTF-8 text/markdown.
'400':
description: Invalid query or part.
'404':
description: Document or part not found.
'429':
description: Reader busy. Retry after the stated delay.
'503':
description: The corpus is unavailable. Do not treat this as no results.
tags:
- Legislation
/api/legislation/{id}/parts/{part}.md:
get:
operationId: get_api_legislation_by_id_parts_by_part_md
summary: OKF Reference with provenance and original metadata
description: 'Returns: UTF-8 text/markdown.'
parameters:
- name: id
in: path
required: true
schema:
type: string
description: Stable 24-character hexadecimal law ID from search results.
- name: part
in: path
required: true
schema:
type: integer
description: Text part, from 1 to the document's parts value.
responses:
'200':
description: UTF-8 text/markdown.
'400':
description: Invalid query or part.
'404':
description: Document or part not found.
'429':
description: Reader busy. Retry after the stated delay.
'503':
description: The corpus is unavailable. Do not treat this as no results.
tags:
- Legislation
/legislation/{id}:
get:
operationId: get_legislation_by_id
summary: Search or read federal legal texts in the browser
description: 'HTML page. Omit the ID for search. Use /pt/legislation for Portuguese. Read machine data through /api/legislation.
Returns: HTML with search results, source links, and the text reader.'
parameters:
- name: id
in: path
required: true
schema:
type: string
description: Optional law ID from search.
- name: q
in: query
required: false
schema:
type: string
description: Search term, up to 160 characters.
- name: after
in: query
required: false
schema:
type: string
description: Search cursor preserved when returning from a document.
- name: part
in: query
required: false
schema:
type: integer
description: Document part, starting at 1.
responses:
'200':
description: HTML with search results, source links, and the text reader.
'400':
description: Invalid part.
'404':
description: Document or part missing.
'503':
description: Corpus unavailable.
tags:
- Legislation
components:
securitySchemes:
globalAccount:
type: apiKey
in: cookie
name: __Host-mm-auth
description: Global session in the product's HttpOnly cookie; writes require exact Origin and X-CSRF-Token.
contaChaveApi:
type: http
scheme: bearer
bearerFormat: mmk_…
description: 'Account API key: `Authorization: Bearer mmk_…` or `X-Api-Key: mmk_…`. Created on the account page (API keys), valid only in the product where it was created; it acts as the account (or the organization that owns it).'
carteiraAgente:
type: http
scheme: bearer
bearerFormat: mmw_…
description: 'Wallet credential of an agent without an account (`Authorization: Bearer mmw_…`, 30 days, this product only): POST /api/auth/wallet/agent/start, check that the domain and URI of the message are the host and origin that you called, sign the message with the wallet, POST /api/auth/wallet/agent/token. The owner is `x402:<address>`.'
externalDocs:
url: https://payapi.market/api/okf-index
description: PayAPI Market
x-service-info:
categories:
- knowledge
- search
- ai-agents
docs:
homepage: https://okfindex.com/
apiReference: https://okfindex.com/developers
llms: https://okfindex.com/llms.txt
pricing: https://okfindex.com/api/pricing
billing: https://okfindex.com/api/billing