OKF Index X402 API

The X402 API from OKF Index — 1 operation(s) for x402.

GitHub OpenAPI

Operations 1

GET /api/x402/legislation Searches Brazilian federal laws for an agent, paid per call: up to 20 items… #

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/okfindex-com:okfindex-com-x402-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

okfindex-com-x402-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: OKF Index X402 API
  version: cb36b312
  description: 'The search index of Open Knowledge Format bundles. Index: GET /api/.'
servers:
- url: https://okfindex.com
tags:
- name: X402
paths:
  /api/x402/legislation:
    get:
      operationId: get_api_x402_legislation
      summary: 'Searches Brazilian federal laws for an agent, paid per call: up to 20 items…'
      description: 'The search of `GET /api/legislation/search`, sold per call to agents, with no account and no allowance before. A request without payment gets the 402 with the price; a paid one gets the items in the same response, with the payment in `cobranca`. Send at least one of `q`, `type`, `year` or `authority`. A refused search and an unavailable corpus are not charged. 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, next, cobranca{via,preco_usd,repetido,saldo_usd?} }'
      x-price-usd: 0.01
      x-agent-value:
        when: Where can I search the indexed Brazilian federal laws?
        result: Up to 20 items with source links, text availability, provenance and a continuation cursor.
        replaces: Downloading the covered corpus, building a text index and normalizing search results.
        free: Use GET /api/legislation/search first when its current access covers the task. Inspect source links and text versions.
        paid: The x402 route sells this search per call through x402 or credit without an account. It does not buy legal review or a private-base subscription.
        limits: Coverage is federal. A source's revoked flag does not verify current law. An unavailable corpus is not an empty result.
        alternative: You know the law and can read it at the official source, or need state, municipal or verified current legislation.
      x-payment-info:
        price:
          mode: fixed
          currency: USD
          amount: '0.01'
        protocols:
        - x402: {}
      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.
        example: 10406/2002
      - 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.
      - name: authorization
        in: header
        required: false
        schema:
          type: string
        description: '`Bearer mmk_…` (API key) or `Bearer mmo_…` (OAuth): the paid call uses the account balance without another header. Without an account, use prepaid credit from `POST /api/credito` as `Bearer cred_…`.'
      - name: x-api-key
        in: header
        required: false
        schema:
          type: string
        description: The mmk_… API key for this product. It identifies the account and authorizes its balance for the paid call.
      - name: payment-signature
        in: header
        required: false
        schema:
          type: string
        description: 'The signed x402 payment proof (base64): `PAYMENT-SIGNATURE` (v2) or `X-PAYMENT` (v1).'
      - name: x-wallet-token
        in: header
        required: false
        schema:
          type: string
        description: To recover an x402 response within 24 hours, repeat the same request and payment proof. Send the payer wallet's `mmw_…` credential here, issued through `/api/auth/wallet/agent/start` and `/api/auth/wallet/agent/token`. There is no new charge.
      responses:
        '200':
          description: '{ items, next, cobranca{via,preco_usd,repetido,saldo_usd?} }'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BuscaDeLeisAvulsa'
        '400':
          description: Paid without a filter (`missing_input`, with `example`), or an invalid query. Not charged.
        '401':
          description: API key refused (`invalid_api_key`), OAuth token refused (`invalid_token`), credit refused (`credito_invalido`), test credit outside dev (`credito_simulado`), or recovery without wallet authentication (`wallet_proof_required`). The first x402 purchase needs no account.
        '402':
          description: 'No payment: `accepts` (x402, USDC on Base) with the price of this call, at least US$ 0.01; `credito.preco_desta_chamada`, the lower price with prepaid credit; and `pacotes` (the credit top-ups and how many calls each one pays). Credit without balance answers `saldo_insuficiente`.'
        '409':
          description: Payment is in progress, the request differs from the original, or the amount was recovered as balance. Do not sign another authorization to retry the purchase.
        '410':
          description: The 24-hour response recovery period ended. The financial record remains; the same proof cannot cause another charge.
        '429':
          description: Reader busy. Retry after the stated delay. Not charged.
        '503':
          description: The corpus is unavailable. Do not treat this as no results. Not charged.
      tags:
      - X402
components:
  schemas:
    BuscaDeLeisAvulsa:
      type: object
      properties:
        items:
          type: array
          items:
            type: object
          description: 'Up to 20 laws, as in `GET /api/legislation/search`: {id,title,description,type,year,number,authority,country,jurisdiction,uf,provider,source_url,lexml_url,downloaded_at,text_version,revoked,missing_text,sha256,api,url,okf_url}.'
        next:
          type: string
          description: URL of the next page on `GET /api/legislation/search` (with `after`); `null` at the end.
          nullable: true
        cobranca:
          allOf:
          - $ref: '#/components/schemas/CobrancaDaChamada'
          description: How this call was paid.
      required:
      - items
      - next
      - cobranca
      description: The result of one paid legislation search.
    CobrancaDaChamada:
      type: object
      properties:
        via:
          type: string
          description: '`x402`, `credito` or the marketplace that already charged the call.'
        preco_usd:
          type: string
          description: 'The price charged for this call in US dollars, such as `0.01`: at least US$ 0.01 with single x402 payment; the unit price with credit.'
        repetido:
          type: boolean
          description: '`true` when the credit had already paid this request (the same `Idempotency-Key`): nothing was charged again.'
        saldo_usd:
          type: string
          description: The credit balance after the call, such as `$0.99`; includes payment from the account balance.
      required:
      - via
      - preco_usd
      - repetido
      description: The payment of a single call.
  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