> ## Documentation Index
> Fetch the complete documentation index at: https://docs.judit.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Consulta de Mandados de Prisão

> Pesquise mandados de prisão e recaptura nacionais (BNMP) por CPF, Nome ou RJI com a Judit API. Obtenha dados da ordem judicial, pena, leis infringidas e do indivíduo procurado.

export const EndpointBadges = ({auth = true, billing = "billable", flow = "sync", attachments = false, requiresVault = false}) => <div style={{
  marginTop: "-8px",
  marginBottom: "16px"
}}>
    {auth && <Badge color="gray">🔒 Requer api-key</Badge>}
    {billing === "billable" && <Badge color="yellow">💰 Cobrança por requisição</Badge>}
    {billing === "free" && <Badge color="green">✅ Grátis</Badge>}
    {billing === "on-demand" && <Badge color="purple">⚡ On-demand (preço diferenciado)</Badge>}
    {flow === "async" && <Badge color="blue">⏳ Assíncrono · webhook ou polling</Badge>}
    {flow === "sync" && <Badge color="green">⚡ Síncrono</Badge>}
    {attachments && <Badge color="purple">📎 Suporta with_attachments</Badge>}
    {requiresVault && <Badge color="red">🔑 Cofre de Credenciais</Badge>}
  </div>;

export const WarrantAnimation = () => <iframe sandbox="allow-scripts" scrolling="no" style={{
  width: '100%',
  height: '540px',
  border: 'none',
  borderRadius: '12px',
  display: 'block',
  margin: '20px 0'
}} srcDoc={`<!doctype html><html><head><meta charset="utf-8"><style>*{margin:0;padding:0;box-sizing:border-box}html,body{width:100%;height:100%;overflow:hidden;background:#090c0d}canvas{display:block;width:100%;height:100%}</style></head><body><canvas id="c"></canvas><script>(function(){
var A='#4FD1C5',J='#1FC16B',B='#EF4444',M='#7A8599';
var BG='#090c0d',TXT='#e5e7eb',NF='#111827',PT='#0a1020';
var TOTAL=12.0;
var XP={app:0.13,judit:0.50,bnmp:0.87};
var NW=88,NH=42;
var NODES=[{id:'app',label:'Sua App',col:A},{id:'judit',label:'Judit API',col:J},{id:'bnmp',label:'BNMP',col:B}];
var STEPS=[
  {fr:'app',to:'judit',label:'POST /requests',note:'{response_type:"warrant"}',col:A,ts:1.0,te:1.8,yp:0.29},
  {fr:'judit',to:'app',label:'202 {request_id}',note:'status: pending',col:J,ts:2.3,te:3.1,yp:0.39},
  {sep:true,label:'↻  Judit consulta o BNMP assincronamente',yp:0.49},
  {fr:'judit',to:'bnmp',label:'consulta BNMP',note:'por CPF / nome / RJI',col:B,ts:4.5,te:5.3,yp:0.58},
  {fr:'bnmp',to:'judit',label:'mandado encontrado',note:'',col:J,ts:5.8,te:6.6,yp:0.68},
  {fr:'app',to:'judit',label:'GET /responses',note:'polling · request_id=...',col:A,ts:7.1,te:7.9,yp:0.78},
  {fr:'judit',to:'app',label:'200 {warrant_data}',note:'',col:J,ts:8.4,te:9.2,yp:0.88}
];
var cv=document.getElementById('c');
function setup(){var dpr=Math.min(window.devicePixelRatio||1,2),r=cv.getBoundingClientRect(),W=r.width||window.innerWidth,H=r.height||window.innerHeight;cv.width=Math.max(1,W*dpr);cv.height=Math.max(1,H*dpr);var ctx=cv.getContext('2d');ctx.setTransform(dpr,0,0,dpr,0,0);return{ctx:ctx,w:W,h:H};}
function ease(t){return t<0.5?2*t*t:1-Math.pow(-2*t+2,2)/2;}
function rr(ctx,x,y,w,h,r){ctx.beginPath();ctx.moveTo(x+r,y);ctx.arcTo(x+w,y,x+w,y+h,r);ctx.arcTo(x+w,y+h,x,y+h,r);ctx.arcTo(x,y+h,x,y,r);ctx.arcTo(x,y,x+w,y,r);ctx.closePath();}
function gx(n,w){return n==='app'?w*XP.app:n==='judit'?w*XP.judit:w*XP.bnmp;}
function eg(fr,to,w){var fx=gx(fr,w),tx=gx(to,w),d=tx>fx?1:-1;return{x1:fx+d*NW/2,x2:tx-d*NW/2,d:d};}
function dPkt(ctx,x,y,lbl,col){var pw=Math.max(36,lbl.length*6+14),ph=20;ctx.save();ctx.shadowColor=col;ctx.shadowBlur=18;rr(ctx,x-pw/2,y-ph/2,pw,ph,5);ctx.fillStyle=col;ctx.fill();ctx.shadowBlur=0;ctx.fillStyle=PT;ctx.font='bold 9px monospace';ctx.textAlign='center';ctx.textBaseline='middle';ctx.fillText(lbl,x,y+0.5);ctx.restore();}
function draw(ctx,w,h,t){
  var ct=t%TOTAL,bx1=w*0.02,bx2=w*0.98;
  ctx.fillStyle=BG;ctx.fillRect(0,0,w,h);
  var nodeY=h*0.21;
  ctx.fillStyle=B;ctx.font='bold 12px Inter,system-ui,sans-serif';ctx.textAlign='center';ctx.textBaseline='middle';ctx.fillText('Consulta de Mandados de Prisão',w/2,h*0.04);
  ctx.fillStyle=M;ctx.font='10px Inter,system-ui,sans-serif';ctx.fillText('Judit consulta o BNMP e retorna mandados por CPF, nome ou RJI',w/2,h*0.09);
  for(var i=0;i<NODES.length;i++){var n=NODES[i],lx=gx(n.id,w);ctx.save();ctx.strokeStyle=n.col;ctx.globalAlpha=0.35;ctx.lineWidth=1;ctx.setLineDash([4,7]);ctx.beginPath();ctx.moveTo(lx,nodeY+NH/2);ctx.lineTo(lx,h*0.94);ctx.stroke();ctx.restore();}
  for(var si=0;si<STEPS.length;si++){var s=STEPS[si],sy=h*s.yp;if(s.sep){ctx.save();ctx.strokeStyle='rgba(255,255,255,0.28)';ctx.lineWidth=1;ctx.setLineDash([3,5]);ctx.beginPath();ctx.moveTo(bx1,sy);ctx.lineTo(bx2,sy);ctx.stroke();ctx.fillStyle='rgba(255,255,255,0.05)';rr(ctx,bx1,sy-8,s.label.length*6.2+14,16,3);ctx.fill();ctx.fillStyle=M;ctx.font='10px monospace';ctx.textAlign='left';ctx.textBaseline='middle';ctx.fillText(s.label,bx1+5,sy);ctx.restore();continue;}var e=eg(s.fr,s.to,w),x1=e.x1,x2=e.x2,d=e.d,clx=(x1+x2)/2;var state=ct<s.ts?'pre':ct>s.te?'done':'live',alpha=state==='pre'?0.10:state==='done'?0.55:1.0;ctx.save();ctx.globalAlpha=alpha;ctx.strokeStyle=s.col;ctx.lineWidth=1.5;ctx.setLineDash([]);ctx.beginPath();ctx.moveTo(x1,sy);ctx.lineTo(x2,sy);ctx.stroke();ctx.fillStyle=s.col;ctx.beginPath();ctx.moveTo(x2,sy);ctx.lineTo(x2-d*7,sy-4);ctx.lineTo(x2-d*7,sy+4);ctx.closePath();ctx.fill();ctx.fillStyle=TXT;ctx.font='bold 10px monospace';ctx.textAlign='center';ctx.textBaseline='bottom';ctx.fillText(s.label,clx,sy-4);if(s.note){ctx.fillStyle=M;ctx.font='9px monospace';ctx.fillText(s.note,clx,sy-16);}ctx.restore();if(state==='live'){var p=ease((ct-s.ts)/(s.te-s.ts));dPkt(ctx,x1+(x2-x1)*p,sy+14,s.label,s.col);}}
  for(var i=0;i<NODES.length;i++){var nd=NODES[i],px=gx(nd.id,w);ctx.save();ctx.shadowColor=nd.col;ctx.shadowBlur=14;rr(ctx,px-NW/2,nodeY-NH/2,NW,NH,8);ctx.fillStyle=NF;ctx.fill();ctx.shadowBlur=0;ctx.strokeStyle=nd.col;ctx.lineWidth=1.8;ctx.stroke();ctx.fillStyle=nd.col;ctx.font='bold 11px Inter,system-ui,sans-serif';ctx.textAlign='center';ctx.textBaseline='middle';ctx.fillText(nd.label,px,nodeY);ctx.restore();}
}
var dim,t0;
function loop(){var t=(performance.now()-t0)/1000;draw(dim.ctx,dim.w,dim.h,t);requestAnimationFrame(loop);}
window.addEventListener('load',function(){dim=setup();t0=performance.now();loop();});
window.addEventListener('resize',function(){dim=setup();});
})()\x3c/script></body></html>`} />;

A **Consulta de Mandados de Prisão** integra com o Banco Nacional de Mandados de Prisão (BNMP 2.0) por CPF, Nome ou RJI e devolve, no padrão JSON da Judit, a ordem judicial, a pena calculada, as leis infringidas e os dados completos do indivíduo procurado. Cobre mandados preventivos, temporários, definitivos e mandados de recaptura.

> 🤖 **Fluxo assíncrono.** Mesma rota da consulta processual: `POST https://requests.production.judit.io/requests` com `response_type: "warrant"`. Para baixar o anexo (PDF do mandado), use `with_attachments: true`.

<WarrantAnimation />

<EndpointBadges auth billing="billable" flow="async" attachments />

## Quando usar

<CardGroup cols={2}>
  <Card title="Compliance / KYC reforçado" icon="shield-halved">
    Identifique mandados ativos contra a contraparte durante o onboarding ou revisão periódica.
  </Card>

  <Card title="Recursos Humanos" icon="user-check">
    Avaliação de antecedentes em processos seletivos para cargos sensíveis ou de confiança.
  </Card>

  <Card title="Investigação privada" icon="magnifying-glass">
    Localização e perfil judicial de indivíduos com fundamentação legal pública.
  </Card>

  <Card title="Defensoria pública" icon="scale-balanced">
    Verificação de ordens em aberto antes de audiências, com recuperação automática do PDF do mandado.
  </Card>
</CardGroup>

## Passo 1: Criar a Requisição (POST)

`POST https://requests.production.judit.io/requests`

### Exemplos por tipo de busca

<CodeGroup>
  ```json Por CPF theme={null}
  {
      "search": {
          "search_type": "cpf",
          "search_key": "999.999.999-99",
          "response_type": "warrant"
      },
      "with_attachments": false
  }
  ```

  ```json Por CPF + anexo PDF theme={null}
  {
      "search": {
          "search_type": "cpf",
          "search_key": "999.999.999-99",
          "response_type": "warrant"
      },
      "with_attachments": true
  }
  ```

  ```json Por Nome theme={null}
  {
      "search": {
          "search_type": "name",
          "search_key": "João Silva",
          "response_type": "warrant"
      },
      "with_attachments": false
  }
  ```

  ```json Por RJI (BNMP) theme={null}
  {
      "search": {
          "search_type": "rji",
          "search_key": "00000000000000000000",
          "response_type": "warrant"
      },
      "with_attachments": false
  }
  ```
</CodeGroup>

<Warning>
  `response_type` deve ser sempre **`"warrant"`**. `search_type` aceita `"cpf"`, `"name"` ou `"rji"` (numeração atribuída pelo BNMP 2.0 à pessoa).
</Warning>

### Parâmetros do Payload

| Parâmetro              | Tipo    | Obrigatório | Descrição                                                            |
| :--------------------- | :------ | :---------- | :------------------------------------------------------------------- |
| `search.search_type`   | string  | **Sim**     | `"cpf"`, `"name"` ou `"rji"`.                                        |
| `search.search_key`    | string  | **Sim**     | CPF, nome completo ou número RJI a buscar.                           |
| `search.response_type` | string  | **Sim**     | Sempre `"warrant"`.                                                  |
| `with_attachments`     | boolean | Não         | Se `true`, baixamos o PDF do mandado emitido.                        |
| `callback_url`         | string  | Não         | URL HTTPS para receber a resposta via [Webhook](/webhook/callbacks). |

### Exemplo de Requisição (POST)

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST 'https://requests.production.judit.io/requests' \
    --header 'api-key: '"$JUDIT_API_KEY" \
    --header 'Content-Type: application/json' \
    --data '{
      "search": {
        "search_type": "cpf",
        "search_key": "999.999.999-99",
        "response_type": "warrant"
      },
      "with_attachments": true
    }'
  ```

  ```javascript Node.js theme={null}
  const res = await fetch("https://requests.production.judit.io/requests", {
    method: "POST",
    headers: {
      "api-key": process.env.JUDIT_API_KEY,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      search: {
        search_type: "cpf",
        search_key: "999.999.999-99",
        response_type: "warrant",
      },
      with_attachments: true,
    }),
  });
  console.log(await res.json());
  ```

  ```php PHP theme={null}
  <?php
  $ch = curl_init('https://requests.production.judit.io/requests');
  curl_setopt_array($ch, [
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_POST => true,
      CURLOPT_HTTPHEADER => [
          'api-key: ' . getenv('JUDIT_API_KEY'),
          'Content-Type: application/json',
      ],
      CURLOPT_POSTFIELDS => json_encode([
          'search' => [
              'search_type'   => 'cpf',
              'search_key'    => '999.999.999-99',
              'response_type' => 'warrant',
          ],
          'with_attachments' => true,
      ]),
  ]);
  echo curl_exec($ch);
  ```

  ```python Python theme={null}
  import os, requests

  resp = requests.post(
      "https://requests.production.judit.io/requests",
      headers={
          "api-key": os.environ["JUDIT_API_KEY"],
          "Content-Type": "application/json",
      },
      json={
          "search": {
              "search_type": "cpf",
              "search_key": "999.999.999-99",
              "response_type": "warrant",
          },
          "with_attachments": True,
      },
      timeout=15,
  )
  resp.raise_for_status()
  print(resp.json())
  ```

  ```go Go theme={null}
  package main

  import (
      "bytes"
      "encoding/json"
      "io"
      "net/http"
      "os"
  )

  func main() {
      body, _ := json.Marshal(map[string]any{
          "search": map[string]string{
              "search_type":   "cpf",
              "search_key":    "999.999.999-99",
              "response_type": "warrant",
          },
          "with_attachments": true,
      })
      req, _ := http.NewRequest("POST",
          "https://requests.production.judit.io/requests",
          bytes.NewReader(body))
      req.Header.Set("api-key", os.Getenv("JUDIT_API_KEY"))
      req.Header.Set("Content-Type", "application/json")
      res, _ := http.DefaultClient.Do(req)
      defer res.Body.Close()
      out, _ := io.ReadAll(res.Body)
      println(string(out))
  }
  ```
</CodeGroup>

### Resposta da criação

```json theme={null}
{
    "request_id": "87d9f7bf-0071-41ee-a721-e6e1b4082bc9",
    "search": {
        "search_type": "cpf",
        "search_key": "999.999.999-99",
        "response_type": "warrant"
    },
    "with_attachments": true,
    "status": "pending",
    "created_at": "2024-03-14T07:35:14.272Z"
}
```

## Passo 2: Buscar a resposta

A consulta é assíncrona — você pode aguardar pelo [Webhook](/webhook/callbacks) ou consultar via `GET /responses?request_id={request_id}`.

<CodeGroup>
  ```bash cURL theme={null}
  curl --location 'https://requests.production.judit.io/responses?request_id=<REQUEST_ID>' \
    --header 'api-key: '"$JUDIT_API_KEY"
  ```

  ```python Python theme={null}
  resp = requests.get(
      f"https://requests.production.judit.io/responses?request_id={request_id}",
      headers={"api-key": os.environ["JUDIT_API_KEY"]},
  )
  print(resp.json())
  ```
</CodeGroup>

### Estrutura da resposta

| Campo                            | Descrição                                                                     |
| :------------------------------- | :---------------------------------------------------------------------------- |
| `warrant_type`                   | Tipo do mandado (`warrant_of_arrest`, `recapture`, etc.).                     |
| `arrest_type`                    | Modalidade da prisão (`preventive`, `temporary`, `definitive`).               |
| `law_type`                       | Lei e artigos infringidos.                                                    |
| `issue_date` / `expiration_date` | Datas de emissão e validade do mandado.                                       |
| `status`                         | Situação do mandado — ver tabela abaixo.                                      |
| `duration_years/months/days`     | Pena calculada.                                                               |
| `regime`                         | Regime de cumprimento (`Aberto`, `Semiaberto`, `Fechado`).                    |
| `recapture`                      | `true` se for mandado de recaptura.                                           |
| `entity`                         | Dados completos da pessoa procurada (segue [Schema Entity](/schemas/entity)). |
| `judgementSummary`               | Texto da sentença/despacho que originou o mandado.                            |

### Valores possíveis para `status`

| Status                 | Comportamento |
| :--------------------- | :------------ |
| Pendente de Cumpriment |               |
