## Tribunal / TJBA / Certidão do 1º Grau
Gera a certidão de primeiro grau no tribunal da justiça do estado da Bahia


### Site URL
- https://portalcertidoes.tjba.jus.br/#/primeirograu

### Request
POST endpoint: `https://api.infosimples.com/api/v2/consultas/tribunal/tjba/primeiro-grau`



| Parameter           | Description                                                                                                                                                                                                                                                                                                                                                            |
| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| token*              | The token that will authenticate and authorize the request.                                                                                                                                                                                                                                                                                                            |
| nome**              | Name of the person to be queried.                                                                                                                                                                                                                                                                                                                                      |
| naturalidade**      | Naturalidade                                                                                                                                                                                                                                                                                                                                                           |
| cpf**               | CPF of the individual to be queried.                                                                                                                                                                                                                                                                                                                                   |
| rg**                | Rg                                                                                                                                                                                                                                                                                                                                                                     |
| orgao_expedidor**   | Orgao_expedidor                                                                                                                                                                                                                                                                                                                                                        |
| estado_civil**      | Deve ser informado um dos valores a seguir: <br><ul><li><strong>1</strong> para Casado</li><li><strong>2</strong> para Divorciado</li><li><strong>3</strong> para Separado Judicialmente</li><li><strong>4</strong> para Solteiro</li><li><strong>5</strong> para União Estável</li><li><strong>6</strong> para Viúvo</li><li><strong>7</strong> para Outros</li></ul> |
| endereco**          | Endereco                                                                                                                                                                                                                                                                                                                                                               |
| filiacao_1**        | Filiacao_1                                                                                                                                                                                                                                                                                                                                                             |
| razao_social**      | Razao_social                                                                                                                                                                                                                                                                                                                                                           |
| cnpj**              | CNPJ of the company to be queried.                                                                                                                                                                                                                                                                                                                                     |
| tipo_certidao**     | Deve ser informado um dos valores a seguir: <br><ul><li><strong>1</strong> para Certidão Cível</li><li><strong>2</strong> para Certidão Criminal e Exec. Penal</li><li><strong>3</strong> para Certidão Inventário</li><li><strong>4</strong> para Certidão Recup. Judicial, Falência, Concordata (CNPJ)</li></ul>                                                     |
| tipo_participacao** | Deve ser informado um dos valores a seguir: <br><ul><li><strong>1</strong> para Passiva</li><li><strong>2</strong> para Ativa</li><li><strong>3</strong> para Ambas</li></ul>                                                                                                                                                                                          |

> * Required parameter.

> ** Optional parameter. Sometimes it is necessary to set at least one of the optional parameters for the service to work properly.


### Response examples (OK)
```json
{
  "code": 200,
  "code_message": "A requisição foi processada com sucesso.",
  "errors": [],
  "header": {
    "api_version": "v2",
    "product": "Consultas",
    "service": "tribunal/tjba/primeiro-grau",
    "parameters": {
      "cnpj": "12.345.678/9012-34",
      "endereco": "Avenida Paulista, 807. São Paulo. SP. Brasil.",
      "razao_social": "Exemplo de Razão Social",
      "tipo_certidao": "4",
      "tipo_participacao": "3"
    },
    "client_name": "Minha Empresa",
    "token_name": "Token de Produção",
    "billable": true,
    "price": "0.2",
    "requested_at": "2022-09-23T18:51:38.000-03:00",
    "elapsed_time_in_milliseconds": 215,
    "remote_ip": "111.111.111.111",
    "signature": "U2FsdGVkX1/LnL0LaE3u8GhrvdC4qeEyGaZCE8gKh8J5Ssw1AW1cbTo7xq32xfVXbLlZ/BL0BPFGPuFyCx+JlA=="
  },
  "data_count": 1,
  "data": [
    {
      "cnpj": "12.345.678/9012-34",
      "cpf": "123.456.789-01",
      "data_criacao": "11/11/1111",
      "endereco": "Avenida Paulista, 807. São Paulo. SP. Brasil.",
      "estado_civil": "Solteiro",
      "filiacao_1": "Exemplo de Nome",
      "nada_consta": true,
      "naturalidade": "Brasileiro",
      "nome": "Exemplo de Nome",
      "numero_certidao": "1234567",
      "orgao_expedidor_rg": "SSP",
      "processos": [
        {
          "comarca": "Exemplo de Texto",
          "unidade": "Exemplo de Texto",
          "numero_processo": "00000000000000000000",
          "acao": "Procedimento Comum Cível",
          "assunto": "Renovação de Matrícula - Inadimplência",
          "distribuicao": "28/01/2024"
        },
        {
          "comarca": "Exemplo de Texto",
          "unidade": "Exemplo de Texto",
          "numero_processo": "00000000000000000000",
          "acao": "Execução de Título Extrajudicial",
          "assunto": "Pagamento",
          "distribuicao": "03/04/2275"
        }
      ],
      "razao_social": "Exemplo de Razão Social",
      "rg": "11.111.111-1",
      "total_processos": 0,
      "site_receipt": "https://www.exemplo.com/exemplo-de-url"
    }
  ],
  "site_receipts": [
    "https://www.exemplo.com/exemplo-de-url"
  ]
}
```


### Preview file

The preview file (`site_receipts`) in the response JSON may be **synthesized by Infosimples** using data from the source (website/app) that processed the automation if the file generated by the source is not suitable for viewing.

### Code snippets


#### Python
```python
# Tested with: Python 3.10.19, Python 3.14.0
import requests

url = 'https://api.infosimples.com/api/v2/consultas/tribunal/tjba/primeiro-grau'
args = {
  "nome":              "VALUE_OF_PARAMETER_NOME",
  "naturalidade":      "VALUE_OF_PARAMETER_NATURALIDADE",
  "cpf":               "VALUE_OF_PARAMETER_CPF",
  "rg":                "VALUE_OF_PARAMETER_RG",
  "orgao_expedidor":   "VALUE_OF_PARAMETER_ORGAO_EXPEDIDOR",
  "estado_civil":      "VALUE_OF_PARAMETER_ESTADO_CIVIL",
  "endereco":          "VALUE_OF_PARAMETER_ENDERECO",
  "filiacao_1":        "VALUE_OF_PARAMETER_FILIACAO_1",
  "razao_social":      "VALUE_OF_PARAMETER_RAZAO_SOCIAL",
  "cnpj":              "VALUE_OF_PARAMETER_CNPJ",
  "tipo_certidao":     "VALUE_OF_PARAMETER_TIPO_CERTIDAO",
  "tipo_participacao": "VALUE_OF_PARAMETER_TIPO_PARTICIPACAO",
  "token":             "WRITE_YOUR_TOKEN_HERE",
  "timeout":           "300"
}

response = requests.post(url, args)
response_json = response.json()
response.close()

if response_json['code'] == 200:
  print("Retorno com sucesso: ", response_json['data'])
elif response_json['code'] in range(600, 799):
  mensagem = "Resultado sem sucesso. Leia para saber mais: \n"
  mensagem += "Código: {} ({})\n".format(response_json['code'], response_json['code_message'])
  mensagem += "; ".join(response_json['errors'])
  print(mensagem)

print("Cabeçalho da consulta: ", response_json['header'])
print("URLs com arquivos de visualização (HTML/PDF): ", response_json['site_receipts'])
```


## We are here to help
Do you still need to figure something out? Reach us at [suporte@infosimples.com.br](mailto:suporte@infosimples.com.br) and our highly qualified support team will be happy to help.
