## SEFAZ / PI / IPVA
Pesquisa dados de Imposto sobre Propriedades de Veículos Automotores (IPVA).


### Site URL
- http://webas.sefaz.pi.gov.br/darweb/faces/views/ipva/ipva.xhtml

### Request
POST endpoint: `https://api.infosimples.com/api/v2/consultas/sefaz/pi/ipva`



| Parameter   | Description                                                                                                                                                |
| ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| token*      | The token that will authenticate and authorize the request.                                                                                                |
| cpf**       | CPF of the individual to be queried.                                                                                                                       |
| cnpj**      | CNPJ of the company to be queried.                                                                                                                         |
| renavam**   | RENAVAM of the vehicle to be queried.                                                                                                                      |
| chassi**    | Chassis number of the vehicle to be queried.                                                                                                               |
| tipo_cotas* | Use o valor <strong>unica</strong> para fazer a consulta com cota única. Use o valor <strong>parcelas</strong> para fazer a consulta com cotas parceladas. |

> * 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",
    "service": "sefaz/pi/ipva",
    "parameters": {
      "cpf": "11111111111",
      "renavam": "11111111111",
      "tipo_cotas": "unica"
    },
    "client_name": "Minha Empresa",
    "token_name": "Token de Produção",
    "billable": true,
    "price": "0.2",
    "requested_at": "2021-08-18T15:51:45.000-03:00",
    "elapsed_time_in_milliseconds": 353,
    "remote_ip": "111.111.111.111",
    "signature": "U2FsdGVkX1/cTPC2R7kRiIOKl2cR6ugYTLXPd0s4yovJ5LnVroa5LyeFTJBWrIuQyk/S7zl79KWxwrWAau6sSg=="
  },
  "data_count": 1,
  "data": [
    {
      "ano_modelo": "2008",
      "cep": "01311-300",
      "codigo_receita": "",
      "cor": "PRETA",
      "cpf_cnpj": "11111111111",
      "endereco": "Avenida Paulista",
      "ipva": [
        {
          "parcela": "Unica",
          "periodo": "2019",
          "data_vencimento": "11/11/1111",
          "valor_principal": "483,83",
          "multa": "96,76",
          "juros": "29,68",
          "atualizacao": "0,00",
          "total": "610,27",
          "normalizado_valor_principal": 483.83,
          "normalizado_multa": 96.76,
          "normalizado_juros": 29.68,
          "normalizado_atualizacao": 0.0,
          "normalizado_total": 610.27
        },
        {
          "parcela": "Unica",
          "periodo": "2020",
          "data_vencimento": "11/11/1111",
          "valor_principal": "467,05",
          "multa": "93,42",
          "juros": "16,86",
          "atualizacao": "0,00",
          "total": "577,33",
          "normalizado_valor_principal": 467.05,
          "normalizado_multa": 93.42,
          "normalizado_juros": 16.86,
          "normalizado_atualizacao": 0.0,
          "normalizado_total": 577.33
        },
        {
          "parcela": "Unica",
          "periodo": "2021",
          "data_vencimento": "11/11/1111",
          "valor_principal": "459,83",
          "multa": "34,39",
          "juros": "3,61",
          "atualizacao": "0,00",
          "total": "497,83",
          "normalizado_valor_principal": 459.83,
          "normalizado_multa": 34.39,
          "normalizado_juros": 3.61,
          "normalizado_atualizacao": 0.0,
          "normalizado_total": 497.83
        }
      ],
      "marca_modelo": "Nome de Exemplo",
      "municipio": "São Paulo",
      "nome_razao_social": "Nome de Exemplo",
      "renavam": "- 111111111",
      "uf": "SP",
      "site_receipt": null
    }
  ],
  "site_receipts": []
}
```


### Preview file

The preview file (`site_receipts`) in the response JSON is **generated by the source (website/app)** that processed the automation.

### Code snippets


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

url = 'https://api.infosimples.com/api/v2/consultas/sefaz/pi/ipva'
args = {
  "cpf":        "VALUE_OF_PARAMETER_CPF",
  "cnpj":       "VALUE_OF_PARAMETER_CNPJ",
  "renavam":    "VALUE_OF_PARAMETER_RENAVAM",
  "chassi":     "VALUE_OF_PARAMETER_CHASSI",
  "tipo_cotas": "VALUE_OF_PARAMETER_TIPO_COTAS",
  "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.
