## DETRAN / SP / Emissão de CRLV-e
Emite o CRLV-e no Detran de São Paulo (SP).


### Site URL
- https://www.detran.sp.gov.br/wps/portal/portaldetran/cidadao/home

### Request
POST endpoint: `https://api.infosimples.com/api/v2/consultas/detran/sp/crlve`



| Parameter    | Description                                                 |
| ------------ | ----------------------------------------------------------- |
| token*       | The token that will authenticate and authorize the request. |
| login_cpf**  | CPF para fazer login via GOV.BR.                            |
| login_cnpj** | CNPJ para fazer login diretamente no site do DETRAN SP.     |
| login_senha* | Senha para fazer login.                                     |
| placa*       | License plate of the vehicle to be queried.                 |
| renavam*     | RENAVAM of the vehicle to be queried.                       |

> * 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",
    "api_version_full": "2.2.24-20250123092915",
    "product": "Consultas",
    "service": "detran/sp/crlve",
    "parameters": {
      "login_cnpj_md5": "e379c59a3573be16480533ae3f53ea1b",
      "login_senha_md5": "e379c59a3573be16480533ae3f53ea1b",
      "placa": "AAA1111",
      "renavam": "1111111111"
    },
    "client_name": "Minha Empresa",
    "token_name": "Token de Produção",
    "billable": true,
    "price": "0.24",
    "requested_at": "2025-01-24T12:12:05.000-03:00",
    "elapsed_time_in_milliseconds": 332,
    "remote_ip": "111.111.111.111",
    "signature": "U2FsdGVkX18ABXj/UcPwrhWtyylOU5+B2Q+UcAT+iFaIE/3kZK2++1w0+Mm69pG+9L7c5wDslgCamIorsFtFIQ=="
  },
  "data_count": 1,
  "data": [
    {
      "emissao_com_sucesso": true,
      "ocr": [
        {
          "campos": {
            "renavam": {
              "tipo": "texto",
              "titulo": "CÓDIGO RENAVAM",
              "score": 1.0,
              "valor": "11111111111"
            },
            "placa": {
              "tipo": "texto",
              "titulo": "PLACA",
              "score": 1.0,
              "valor": "AAA1A11"
            },
            "ano_exercicio": {
              "tipo": "texto",
              "titulo": "EXERCÍCIO",
              "score": 1.0,
              "valor": "1111"
            },
            "ano_fabricacao": {
              "tipo": "texto",
              "titulo": "ANO FABRICAÇÃO",
              "score": 1.0,
              "valor": "1111"
            },
            "ano_modelo": {
              "tipo": "texto",
              "titulo": "ANO MODELO",
              "score": 1.0,
              "valor": "1111"
            },
            "crv": {
              "tipo": "texto",
              "titulo": "NÚMERO DO CRV",
              "score": 1.0,
              "valor": "111111111111"
            },
            "cla": {
              "tipo": "texto",
              "titulo": "CÓDIGO DE SEGURANÇA DO CLA",
              "score": 1.0,
              "valor": "11111111111"
            },
            "cat": {
              "tipo": "texto",
              "titulo": "CAT",
              "score": 1.0,
              "valor": "***"
            },
            "marca_modelo_versao": {
              "tipo": "texto",
              "titulo": "MARCA / MODELO / VERSÃO",
              "score": 1.0,
              "valor": "Exemplo de Marca /Exemplo de Modelo Exemplo de Versão"
            },
            "especie_tipo": {
              "tipo": "texto",
              "titulo": "ESPÉCIE / TIPO",
              "score": 1.0,
              "valor": "Exemplo de Especie Exemplo de Tipo"
            },
            "placa_anterior_uf": {
              "tipo": "texto",
              "titulo": "PLACA ANTERIOR / UF",
              "score": 1.0,
              "valor": "Exemplo de Placa anterior /Exemplo de UF"
            },
            "chassi": {
              "tipo": "texto",
              "titulo": "CHASSI",
              "score": 1.0,
              "valor": "1AAAA11AAAA111111"
            },
            "cor_predominante": {
              "tipo": "texto",
              "titulo": "COR PREDOMINANTE",
              "score": 1.0,
              "valor": "PRATA"
            },
            "combustivel": {
              "tipo": "texto",
              "titulo": "COMBUSTÍVEL",
              "score": 1.0,
              "valor": "ALCOOL/GASOLINA"
            },
            "qr_code": {
              "tipo": "imagem",
              "titulo": "QR Code",
              "score": "1.0",
              "valor_base64": "imagem_codificada_em_base64"
            }
          },
          "image_base64": "imagem_codificada_em_base64",
          "keypoints": [],
          "tipo": "superior_esquerdo"
        },
        {
          "campos": {
            "categoria": {
              "tipo": "texto",
              "titulo": "CATEGORIA",
              "score": 1.0,
              "valor": "Exemplo de categoria"
            },
            "capacidade": {
              "tipo": "texto",
              "titulo": "CAPACIDADE",
              "score": 1.0,
              "valor": "*.*"
            },
            "potencia_cilindrada": {
              "tipo": "texto",
              "titulo": "POTÊNCIA/CILINDRADA",
              "score": 1.0,
              "valor": "Exemplo de potência/Exemplo de cilindrada"
            },
            "peso_bruto_total": {
              "tipo": "texto",
              "titulo": "PESO BRUTO TOTAL",
              "score": 1.0,
              "valor": "1.11"
            },
            "motor": {
              "tipo": "texto",
              "titulo": "MOTOR",
              "score": 1.0,
              "valor": "A1AAAA111111"
            },
            "cmt": {
              "tipo": "texto",
              "titulo": "CMT",
              "score": 1.0,
              "valor": "1.11"
            },
            "eixos": {
              "tipo": "texto",
              "titulo": "EIXOS",
              "score": 1.0,
              "valor": "2"
            },
            "lotacao": {
              "tipo": "texto",
              "titulo": "LOTAÇÃO",
              "score": 1.0,
              "valor": "11A"
            },
            "carroceria": {
              "tipo": "texto",
              "titulo": "CARROCERIA",
              "score": 1.0,
              "valor": "Exemplo de carroceria"
            },
            "nome": {
              "tipo": "texto",
              "titulo": "NOME",
              "score": 1.0,
              "valor": "Exemplo de nome"
            },
            "cpf_cnpj": {
              "tipo": "texto",
              "titulo": "CPF / CNPJ",
              "score": 1.0,
              "valor": "11.111.111/1111-11"
            },
            "local": {
              "tipo": "texto",
              "titulo": "LOCAL",
              "score": 1.0,
              "valor": "SAO PAULO SP"
            },
            "data": {
              "tipo": "texto",
              "titulo": "DATA",
              "score": 1.0,
              "valor": "11/11/1111"
            }
          },
          "image_base64": "imagem_codificada_em_base64",
          "keypoints": [],
          "tipo": "superior_direito"
        },
        {
          "campos": {
            "observacoes": {
              "tipo": "texto",
              "titulo": "OBSERVAÇÕES DO VEÍCULO",
              "score": 1.0,
              "valor": "Exemplo de observações"
            }
          },
          "image_base64": "imagem_codificada_em_base64",
          "keypoints": [],
          "tipo": "inferior_esquerdo"
        }
      ],
      "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 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/detran/sp/crlve'
args = {
  "login_cpf":   "VALUE_OF_PARAMETER_LOGIN_CPF",
  "login_cnpj":  "VALUE_OF_PARAMETER_LOGIN_CNPJ",
  "login_senha": "VALUE_OF_PARAMETER_LOGIN_SENHA",
  "placa":       "VALUE_OF_PARAMETER_PLACA",
  "renavam":     "VALUE_OF_PARAMETER_RENAVAM",
  "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.
