RAGJur IA API

Recursos generativos fundamentados no índice

GitHub OpenAPI

Operations 4

POST /api/v1/verificar-citacao Anti-alucinação: verifica citações jurisprudenciais de um texto #
POST /api/v1/chat Chat jurídico com resposta fundamentada em decisões reais (RAG) #
POST /api/v1/chat-estrategia Alias de `/chat` #
POST /api/v1/gerar-peca Minuta de peça processual fundamentada em precedentes reais #

Specifications

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/ragjur-ai:ragjur-ai-ia-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

ragjur-ai-ia-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: RAGJur IA API
  version: 1.3.0
  summary: Busca jurisprudencial e jurimetria sobre 114 milhões de julgados de 90+ tribunais brasileiros.
  description: 'API REST da RAGJur (Beans Tech Inova Simples (I.S.), CNPJ 64.160.205/0001-17).


    - **Busca**: BM25 sobre ementas/inteiro teor com analisador jurídico pt-BR; modo híbrido com kNN (`multilingual-e5-large-instruct`, 1024d) + rerank.

    - **Jurimetria**: taxa de provimento por tema/turma/relator, evolução, divergência (χ²), mudança de entendimento (CUSUM), predição multi-fator, intervalos de Wilson, decaimento temporal.

    - **IA**: verificação anti-alucinação de citações, chat com fontes e geração de peças fundamentadas em precedentes reais.


    Todas as rotas exigem `x-api-key` (exceto `/health` e `/openapi.json`). Também aceitamos tokens OAuth 2.1 emitidos pelo servidor MCP (`https://mcp.ragjur.ai`) para integrações Claude/ChatGPT/Copilot — ver `securitySchemes.OAuth2`.


    Convenções: `fonte` identifica a base (`GET /filtros`); sem `fonte`/`tribunal` os endpoints jurimétricos usam `tst_jurisprudencia`. Respostas em JSON UTF-8; percentuais em 0–100.'
  termsOfService: https://ragjur.ai/termos
  contact:
    name: Suporte RAGJur
    email: suporte@ragjur.ai
    url: https://ragjur.ai/suporte
  license:
    name: Proprietária — ver Termos de Uso
    url: https://ragjur.ai/termos
  x-logo:
    url: https://ragjur.ai/logo-512.png
    altText: RAGJur
servers:
- url: https://api.ragjur.ai
  description: Produção
- url: https://api.ragjur.com.br
  description: Legado (redireciona 301 para api.ragjur.ai)
security:
- ApiKeyAuth: []
- OAuth2:
  - ragjur:read
tags:
- name: IA
  description: Recursos generativos fundamentados no índice
paths:
  /api/v1/verificar-citacao:
    post:
      tags:
      - IA
      operationId: verificarCitacao
      summary: 'Anti-alucinação: verifica citações jurisprudenciais de um texto'
      description: 'Extração DETERMINÍSTICA (regex: REsp, AREsp, EAREsp, AgInt, RR, HC, CNJ…) e conferência por campo contra o índice: existência do número, tribunal, relator, data de julgamento e data de publicação, cada um separadamente. Status INEGOCIAVEIS: `confirmado` só se existência + relator + datas conferem; qualquer campo divergente → `inconsistente` (campo nomeado no details, com o valor registrado no acervo); número inexistente → `nao_encontrada`; sem âncora/respaldo → `nao_verificada`. Nunca "plausivel". A análise de TESE é a única parte por IA (LLM), com confiança declarada; o veredito determinístico sobrepõe o LLM. Metadados trazem `data_julgamento` e `data_publicacao` DISTINTOS. `mode` aceita rapido/google/deep (mesmo pipeline determinístico). Texto truncado em 50.000 caracteres.'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - content
              - mode
              properties:
                content:
                  type: string
                  minLength: 20
                mode:
                  type: string
                  enum:
                  - rapido
                  - google
                  - deep
            example:
              content: Conforme decidiu o STJ no REsp 1.987.654/SP, rel. Min. Nancy Andrighi, o dano moral por negativação indevida é in re ipsa.
              mode: rapido
      responses:
        '200':
          description: Citações verificadas
          content:
            application/json:
              schema:
                type: object
                properties:
                  citations:
                    type: array
                    items:
                      type: object
                      properties:
                        text:
                          type: string
                        status:
                          type: string
                          enum:
                          - confirmado
                          - inconsistente
                          - nao_encontrada
                          - nao_verificada
                        details:
                          type: string
                          description: Determinístico — só valores do documento do acervo + valores citados
                        campos:
                          type: object
                          description: Conferência separada de cada campo (existência, tribunal, relator, datas)
                          additionalProperties: true
                        tese:
                          type: object
                          description: Análise semântica de tese por IA (LLM) — com ressalva de confiança
                          additionalProperties: true
                        doc:
                          type: object
                          description: Metadados do documento casado — data_julgamento e data_publicacao DISTINTOS
                          properties:
                            tribunal:
                              type: string
                            numero_processo:
                              type: string
                            relator:
                              type: string
                            orgao_julgador:
                              type: string
                            fonte:
                              type: string
                            tipo_doc:
                              type: string
                            data_julgamento:
                              type: string
                              description: data_julg_dt → data_julgamento → data_julgamento_norm
                            data_publicacao:
                              type: string
                            source_url:
                              type: string
                        source_url:
                          type: string
                      additionalProperties: true
                  summary:
                    type: object
                    properties:
                      total:
                        type: integer
                      confirmados:
                        type: integer
                      inconsistentes:
                        type: integer
                      nao_encontradas:
                        type: integer
                      nao_verificadas:
                        type: integer
                  mode:
                    type: string
                  truncado:
                    type: boolean
                  _meta:
                    type: object
                    description: Método de extração/verificação e regras de status
                    additionalProperties: true
              example:
                citations:
                - id: c1
                  text: EAREsp 676.608/RS, Rel. Min. Og Fernandes
                  type: julgado
                  categoria: julgado
                  status: confirmado
                  details: 'Confirmado na base RAGJur: STJ, EAREsp 676608, Rel. Og Fernandes; julgado em 21/10/2020; publicado em 30/03/2021'
                  doc:
                    tribunal: STJ
                    numero_processo: EAREsp 676608
                    relator: Og Fernandes
                    data_julgamento: '2020-10-21'
                    data_publicacao: '2021-03-30'
                summary:
                  total: 1
                  confirmados: 1
                  inconsistentes: 0
                  nao_encontradas: 0
                  nao_verificadas: 0
                mode: rapido
        '400':
          description: Parâmetro obrigatório ausente ou inválido
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Erro'
              example:
                error: Busca deve ter ao menos 3 caracteres
        '401':
          description: Sem `x-api-key` ou chave inválida
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Erro'
              example:
                error: Missing x-api-key header
        '403':
          description: Chave desativada
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Erro'
              example:
                error: API key is deactivated. Contact support.
        '429':
          description: Rate limit excedido (janela deslizante por chave). Ver `Retry-After`, `X-RateLimit-Limit`, `X-RateLimit-Remaining`.
          headers:
            Retry-After:
              schema:
                type: integer
              description: Segundos até a próxima janela
            X-RateLimit-Limit:
              schema:
                type: integer
            X-RateLimit-Remaining:
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Erro'
              example:
                error: Rate limit exceeded
        '500':
          description: Erro interno
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Erro'
              example:
                error: Erro interno
  /api/v1/chat:
    post:
      tags:
      - IA
      operationId: chatJuridico
      summary: Chat jurídico com resposta fundamentada em decisões reais (RAG)
      description: 'Recupera decisões do tema na `fonte` e responde em prosa citando-as. `historico` mantém o contexto da conversa. Alias: `POST /api/v1/chat-estrategia`.'
      requestBody:
        $ref: '#/components/requestBodies/ChatRequest'
      responses:
        '200':
          description: Resposta
          content:
            application/json:
              schema:
                type: object
                properties:
                  resposta:
                    type: string
        '400':
          description: Parâmetro obrigatório ausente ou inválido
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Erro'
              example:
                error: Busca deve ter ao menos 3 caracteres
        '401':
          description: Sem `x-api-key` ou chave inválida
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Erro'
              example:
                error: Missing x-api-key header
        '403':
          description: Chave desativada
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Erro'
              example:
                error: API key is deactivated. Contact support.
        '429':
          description: Rate limit excedido (janela deslizante por chave). Ver `Retry-After`, `X-RateLimit-Limit`, `X-RateLimit-Remaining`.
          headers:
            Retry-After:
              schema:
                type: integer
              description: Segundos até a próxima janela
            X-RateLimit-Limit:
              schema:
                type: integer
            X-RateLimit-Remaining:
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Erro'
              example:
                error: Rate limit exceeded
        '500':
          description: Erro interno
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Erro'
              example:
                error: Erro interno
        '502':
          description: Erro no Elasticsearch ou no modelo de IA
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Erro'
              example:
                error: Modelo de IA indisponível
  /api/v1/chat-estrategia:
    post:
      tags:
      - IA
      operationId: chatEstrategia
      summary: Alias de `/chat`
      requestBody:
        $ref: '#/components/requestBodies/ChatRequest'
      responses:
        '200':
          description: Resposta
          content:
            application/json:
              schema:
                type: object
                properties:
                  resposta:
                    type: string
        '400':
          description: Parâmetro obrigatório ausente ou inválido
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Erro'
              example:
                error: Busca deve ter ao menos 3 caracteres
        '401':
          description: Sem `x-api-key` ou chave inválida
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Erro'
              example:
                error: Missing x-api-key header
        '403':
          description: Chave desativada
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Erro'
              example:
                error: API key is deactivated. Contact support.
        '429':
          description: Rate limit excedido (janela deslizante por chave). Ver `Retry-After`, `X-RateLimit-Limit`, `X-RateLimit-Remaining`.
          headers:
            Retry-After:
              schema:
                type: integer
              description: Segundos até a próxima janela
            X-RateLimit-Limit:
              schema:
                type: integer
            X-RateLimit-Remaining:
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Erro'
              example:
                error: Rate limit exceeded
        '500':
          description: Erro interno
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Erro'
              example:
                error: Erro interno
        '502':
          description: Erro no Elasticsearch ou no modelo de IA
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Erro'
              example:
                error: Modelo de IA indisponível
  /api/v1/gerar-peca:
    post:
      tags:
      - IA
      operationId: gerarPeca
      summary: Minuta de peça processual fundamentada em precedentes reais
      description: Busca jurimetria e precedentes do tema/lado e gera a minuta com LLM (somente precedentes do índice). Latência 20–90 s.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - tipo
              - tema
              - fonte
              - fatos
              - lado
              properties:
                tipo:
                  type: string
                  enum:
                  - peticao_inicial
                  - contestacao
                  - recurso
                  - parecer
                  description: 'Tipo de peça: petição inicial, contestação, recurso ou parecer'
                tema:
                  type: string
                  description: 'Tema/tese jurídica principal (ex.: "dano moral negativação indevida")'
                fonte:
                  type: string
                  description: 'Tribunal de referência: sigla (TJSP, STJ) ou código de fonte (tjsp_cjsg, stj_integras)'
                turma:
                  type: string
                  description: 'Órgão julgador/câmara opcional (ex.: "3ª Turma", "14ª Câmara de Direito Privado")'
                fatos:
                  type: string
                  description: Resumo dos fatos do caso (quanto mais específico, melhor a fundamentação)
                lado:
                  type: string
                  enum:
                  - autor
                  - reu
                  description: 'Lado representado: autor ou réu'
                incluir_jurimetria:
                  type: boolean
                  default: true
                  description: Incluir painel jurimétrico (taxa de acolhimento, tendência) nos metadados da peça
            example:
              tipo: peticao_inicial
              tema: dano moral negativação indevida
              fonte: tjsp_cjsg
              fatos: Cliente teve o nome inscrito no SPC por dívida já quitada; contestou administrativamente sem resposta.
              lado: autor
      responses:
        '200':
          description: Peça gerada
          content:
            application/json:
              schema:
                type: object
                properties:
                  peca:
                    type: string
                    description: Texto da minuta (Markdown)
                  metadados:
                    type: object
                    properties:
                      tipo:
                        type: string
                      tema:
                        type: string
                      dados_jurimetricos:
                        type: object
                        properties:
                          total_decisoes:
                            type: integer
                          taxa_favoravel:
                            type: number
                          tendencia:
                            type: string
                      precedentes_utilizados:
                        type: array
                        items:
                          type: object
                          properties:
                            numero:
                              type: string
                            relator:
                              type: string
                            data:
                              type: string
                      argumentos_priorizados:
                        type: array
                        items:
                          type: string
        '400':
          description: Parâmetro obrigatório ausente ou inválido
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Erro'
              example:
                error: Busca deve ter ao menos 3 caracteres
        '401':
          description: Sem `x-api-key` ou chave inválida
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Erro'
              example:
                error: Missing x-api-key header
        '403':
          description: Chave desativada
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Erro'
              example:
                error: API key is deactivated. Contact support.
        '429':
          description: Rate limit excedido (janela deslizante por chave). Ver `Retry-After`, `X-RateLimit-Limit`, `X-RateLimit-Remaining`.
          headers:
            Retry-After:
              schema:
                type: integer
              description: Segundos até a próxima janela
            X-RateLimit-Limit:
              schema:
                type: integer
            X-RateLimit-Remaining:
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Erro'
              example:
                error: Rate limit exceeded
        '500':
          description: Erro interno
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Erro'
              example:
                error: Erro interno
        '502':
          description: Erro no Elasticsearch ou no modelo de IA
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Erro'
              example:
                error: Modelo de IA indisponível
components:
  requestBodies:
    ChatRequest:
      required: true
      content:
        application/json:
          schema:
            type: object
            required:
            - pergunta
            - fonte
            properties:
              pergunta:
                type: string
              fonte:
                type: string
              turma:
                type: string
              historico:
                type: array
                items:
                  type: object
                  properties:
                    role:
                      type: string
                      enum:
                      - user
                      - assistant
                    content:
                      type: string
          example:
            pergunta: Qual a tendência do STJ sobre dano moral por negativação indevida?
            fonte: stj_integras
  schemas:
    Erro:
      type: object
      required:
      - error
      properties:
        error:
          type: string
      additionalProperties: true
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: Chave `rj_…` criada no painel (https://app.ragjur.ai/painel/chaves). Nunca exponha em front-end.
    OAuth2:
      type: oauth2
      description: OAuth 2.1 (PKCE S256, DCR RFC 7591, metadata RFC 8414/9728) do servidor MCP. Escopo único `ragjur:read`.
      flows:
        authorizationCode:
          authorizationUrl: https://mcp.ragjur.ai/oauth/authorize
          tokenUrl: https://mcp.ragjur.ai/oauth/token
          refreshUrl: https://mcp.ragjur.ai/oauth/token
          scopes:
            ragjur:read: Busca jurisprudencial e jurimetria (somente leitura)
externalDocs:
  description: Documentação para desenvolvedores
  url: https://docs.ragjur.ai