# Index

1. [When to use the service information endpoint?](#quando-usar)
2. [Sending a request](#criacao-pedido)
3. [Configuration parameters](#parametros-configuracao)
4. [Response structure](#estrutura-de-resposta)
5. [Example (Receita Federal / CNPJ)](#exemplo-receita-federal-cnpj)

## [When to use the service information endpoint?](#quando-usar)
This endpoint returns important information about a service, such as:

- Success rate for the last hour;
- Average response time for the last hour;
- Additional cost of a service.

> This endpoint has no cost.

> You can make up to 100 requests per hour, for each one of the services available at Infosimples.


## [Sending a request](#criacao-pedido)
|                 |                                               |
| --------------- | --------------------------------------------- |
| HTTP Method     | GET                                           |
| URL             | https://api.infosimples.com/api/admin/service |
| Response Format | JSON                                          |


## [Configuration parameters](#parametros-configuracao)
`*`: Required parameter
| Parameter | Description                                                                                                 |
| --------- | ----------------------------------------------------------------------------------------------------------- |
| token*    | The token that will authenticate and authorize the request.                                                 |
| service   | Specifies the service to be inquired. Example: for **Receita Federal / CNPJ** , use `receita-federal/cnpj`. |


## [Response structure](#estrutura-de-resposta)
Responses from the status endpoint have the following fields in the `data` key:
| Field          | Type    | Description                                                                                        |
| -------------- | ------- | -------------------------------------------------------------------------------------------------- |
| service        | string  | The `path` for the inquired service.                                                               |
| name           | string  | Inquired service's name.                                                                           |
| price_extra    | string  | Additional cost of a service. If a service has no additional cost, it will be returned as `"0.0"`. |
| variable_price | boolean | Indicates if a service has variable additional cost.                                               |
| paused         | boolean | Indicates if a service is paused or not.                                                           |
| success_rate   | number  | Success rate in the last 60 minutes. It's a value between **0.0** and **1.0**.                     |
| duration_ms    | number  | Average time for the calls in the last 60 minutes. Value in milliseconds.                          |

## [Example using Receita Federal / CNPJ](#exemplo-receita-federal-cnpj)
The example below shows a request and response using the **Receita Federal / CNPJ** service.

### Request examples

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

url = "https://api.infosimples.com/api/admin/service"
args = {
  "token": "VALUE_OF_PARAMETER_TOKEN",
  "service": "VALUE_OF_PARAMETER_SERVICE"
}

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

print(response_json)
```


### Response example

#### Success
```json
{
    "code": 200,
    "code_message": "A requisição foi processada com sucesso.",
    "data": {
        "service": "receita-federal/cnpj",
        "name": "Receita Federal / CNPJ",
        "price_extra": "0.0",
        "variable_price": false,
        "paused": false,
        "success_rate": 0.997,
        "duration_ms": 1798
    }
}
```


#### Error
```json
{
    "code": 612,
    "code_message": "Os dados não existem no banco de dados do serviço de origem.",
    "errors": [
        "O serviço abc/xyz não foi encontrado."
    ]
}
```


## We're 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.
