Authentication

All requests sent to Connect must include an authentication token, which is obtained by submitting a valid username and password.

During the authentication process, the API returns a token along with the expirationDate field, which indicates the token's validity period. By default, the expiration time is 24 hours, but this value can be configured as needed. It is essential that the client properly manages the token's lifecycle, ensuring it is renewed before expiration to avoid request failures.

The /Authenticate route allows users to obtain an access token to use other Connect features. To do this, a username and password must be submitted. If the credentials are correct, the route returns a valid token and its expiration date. In case of an error, such as invalid credentials or server issues, appropriate messages are returned.

📘

Address of our services:

Homologation:

POST https://homologapix.clearsale.com.br/connect/v1/authenticate

Production:

POST https://apix.clearsale.com.br/connect/v1/authenticate


Body Params

ParametersPropertiesRequired
userstringYes
passwordstringYes

Request Example

POST https://homologapix.clearsale.com.br/connect/v1/authenticate
Content-Type: application/json 
 
{   
   "user": "{Your User}",    
   "password": "{Your Password}"
}

Status Response

ReturnDescription
200OK
400Bad Request
401Unauthorized
403Forbidden
500Internal Server Error

Result Example

HTTP/1.1 200 OK
Content-Type: application/json;  charset=utf-8 
 
{  
  "token": "{JWT Token}",  
  "expirationDate": "{Date and time of expiration}"
}

Response with error

"User or Password not authorized"