## MTE / Certidão de Débitos Trabalhistas
Consulta dados da Certidão de Débitos Trabalhistas na Secretaria de Trabalho do Ministério do Trabalho e Previdência através do número de CPF ou CNPJ.


### Site URL
- https://eprocesso.sit.trabalho.gov.br/Certidao/Emitir

### Request
POST endpoint: `https://api.infosimples.com/api/v2/consultas/mte/certidao-debitos`



| Parameter     | Description                                                                                                                                                                                                                                                                |
| ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| token*        | The token that will authenticate and authorize the request.                                                                                                                                                                                                                |
| cnpj**        | CNPJ of the company to be queried.                                                                                                                                                                                                                                         |
| cpf**         | CPF of the individual to be queried.                                                                                                                                                                                                                                       |
| login_cpf*    | Deve ser informado o CPF para fazer login no GOV.BR.                                                                                                                                                                                                                       |
| login_senha*  | Deve ser informada a senha para fazer login no GOV.BR.                                                                                                                                                                                                                     |
| pkcs12_cert** | Este parâmetro é necessário caso o login no GOV.BR seja feito com certificado digital. Conteúdo do arquivo do certificado digital A1 encriptado seguindo <a href="https://api.infosimples.com/consultas/docs/certificados#criptografia">as instruções de criptografia</a>. |
| pkcs12_pass** | Este parâmetro é necessário caso o login no GOV.BR seja feito com certificado digital. Senha do certificado digital A1 encriptada seguindo <a href="https://api.infosimples.com/consultas/docs/certificados#criptografia">as instruções de criptografia</a>.               |

> * 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": "mte/certidao-debitos",
    "parameters": {
      "cnpj": "11111111111111"
    },
    "client_name": "Minha Empresa",
    "token_name": "Token de Produção",
    "billable": true,
    "price": "0.2",
    "requested_at": "2019-03-11T10:37:13.000-03:00",
    "elapsed_time_in_milliseconds": 3,
    "remote_ip": "111.111.111.111",
    "signature": "U2FsdGVkX1+eUPvfQjc4zrBFm+KoRUwqAPx3DWM3t1YJxARVN4u+JrMPpDUvIdEuys/soNmQ/WPs1zmYJa+d3A=="
  },
  "data_count": 1,
  "data": [
    {
      "cnpj": "11.111.111/1111-11",
      "codigo_autenticidade": "São Paulo",
      "conseguiu_emitir_certidao_negativa": true,
      "cpf": "",
      "emissao_datahora": "10/03/2019, às 18h45",
      "empregador": "Nome de Exemplo",
      "mensagem": "",
      "normalizado_cnpj": "11111111111111",
      "normalizado_cpf": "",
      "normalizado_emissao_datahora": "10/03/2019 18:45:00",
      "site_receipt": "https://api.infosimples.com/receipt/exemplo-de-url"
    }
  ],
  "site_receipts": [
    "https://api.infosimples.com/receipt/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
import base64
# pip install aes-bridge
import aes_bridge

url = 'https://api.infosimples.com/api/v2/consultas/mte/certidao-debitos'
args = {
  "cnpj":        "VALUE_OF_PARAMETER_CNPJ",
  "cpf":         "VALUE_OF_PARAMETER_CPF",
  "login_cpf":   "VALUE_OF_PARAMETER_LOGIN_CPF",
  "login_senha": "VALUE_OF_PARAMETER_LOGIN_SENHA",
  "pkcs12_cert": aes_bridge.encrypt(base64.b64encode(open("certificate.pfx", "rb").read()).decode(), "ENCRYPTION_KEY").decode("ascii").replace("+", "-").replace("/", "_").rstrip("="),
  "pkcs12_pass": aes_bridge.encrypt("CERTIFICATE_PASSWORD", "ENCRYPTION_KEY").decode("ascii").replace("+", "-").replace("/", "_").rstrip("="),
  "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.
