1. Inicio
  2. Documentos
  3. NS ANTT ( English )
  4. First Steps
  5. Introduction


What is NS ANTT API?

NS ANTT API is an integration application through which other applications can perform the issuance and management of methods InserirLogVendaPassagem and InserirLogCancelarPassagem to ANTT.

With the NS ANTT API, data is sent and received through HTTP requests that can be easily implemented in any programming language.

See our integration examples how to implement communication.

An application that has methods that can be accessed directly through the code of other applications.

The application that consumes the methods of an API is given the name of Consumer or Client.

Information sent and received on requests
Request data

Request data varies depending on the method being consumed. See the API consumption documentation for detailed information on what data is sent for each method.

The format of data to be sent is JSON.

Received data

Every request will receive in return some information that can be classified into two groups: HTTP Status and Response Data.

HTTP status

The HTTP status is sent in the response header and informs if the request was successful or if an error occurred. This status consists of a code and a message.

For example, if the HTTP request is made to the wrong address, the HTTP status will have code 404 and message Not Found. If the HTTP request is performed correctly, the HTTP status will have code 200 and message OK.

HTTP Status information should not be considered as response data from the consumed method. This information only informs whether the HTTP request was successful or not.

Veja na tabela abaixo os códigos de Status HTTP que pod

See the table below for the HTTP Status codes that can be returned by the API:

OccurrenceHas return data?
400Bad RequestWhen the request is being performed with wrongly assembled dataNo
401Not authorizedWhen the consumer application tries to access some unauthorized resourceNo
403Access deniedWhen the access token entered is invalidNo
404Not foundWhen the method URL is invalid or the requested information is not foundYes ( but it may not contain if the error is a non-existent URL error )
501API internal errorWhen an unanticipated internal error occursYes
Response Data

The reponse data is returned in the response body and contains the consumed method’s response information. This data varies according to each method consumed.

Depending on what HTTP Status is returned, this information may not exist. For example, if the HTTP Status is 400 (Bad Request), the return will contain only the HTTP Status and will not have Return Data. For this reason, it is important that your application always validates the HTTP Status received before using the Return Data information to ensure that it exists.

Response Code and Description

The return data has two fields that indicate the status of the processing performed, called status and reason. In addition to these fields, other fields will also be present and will be specific to each API method. See the API consumption documentation to view the fields returned by each method.

The status and reason fields inform the Processing Status code and literal description of the processing status, respectively.

The Processing Status is different from the HTTP Status seen above. For example, the consumption of a certain method can return HTTP Status 200, which indicates that the communication with the API happened correctly, and Processing Status -400, which indicates that some mandatory field was not informed.

The table below shows the Processing Status codes that are common to all methods. Other codes are specific to each method and are documented in the consumption page of the API.

Código Descrição
-400Mandatory fields not filled in
-500 or -999API internal error
-401User without permissions to manage documents of the respective taxpayer
Integration data layout

The default integration layout for exchanging information is JSON in the NS ANTT API.

JSON generation example

In the table below you can see an example of this data:

    "tpAmb": 2,
    "logEmissao": {        
        "codigoBilheteEmbarque": 1,    
        "codigoCategoriaTransporte": "02",
        "identificacaoLinha": "1",        
        "codigoTipoServico": 1,
        "dataViagem": "20210823",
        "horaViagem": "173145",
        "codigoTipoViagem": 1,

Como podemos ajudar?