Authorization in the Gold Apple Unified API Service
Interaction with the service — for example, sending a delivery date change or synchronizing the pickup point directory — requires authorization. Authorization is performed using a login and password issued by Gold Apple technical specialists. The service uses the username and password to generate an access token, which it returns in the response body. Use this token to authenticate subsequent requests. The token's lifetime is 5 minutes.
info
Attention! More than 10 authentication attempts with an incorrect login/password pair will result in the login and IP address being blocked. IP allowlisting is not used; the endpoint is accessible over the public network.
Basic Information
| Request method type | POST |
|---|---|
| Path / URL | /api/v1/auth/login |
| Description | Method for authenticating the External Courier Service in the Unified API service |
| Direction | The request is executed by the courier service. The response is provided by the Gold Apple IS. |
Request
Required Headers
| Parameter | Data type | Required | Description | Comment |
|---|---|---|---|---|
| Host | string | 1 | Courier service host | Filled in as "subdomain.domain.zone" |
| Content-Type | string | 1 | Request content type | Filled in as "application/json" |
Payload
| Parameter | Data type | Required | Description |
|---|---|---|---|
| username | string | 1 | Username (login) issued by Gold Apple |
| password | string | 1 | Password for authentication, issued by Gold Apple |
Request example
{
"username": "ECS_LOGIN",
"password": "*************"
}
Response
Response Codes and Messages
| Code | Status | Message | Reason |
|---|---|---|---|
| 200 | OK | Success response | Everything completed successfully |
| 400 | Bad Request | Missing or inappropriate required parameters | Required parameters are missing or invalid |
| 500 | Internal Server Error | Server unavailable | The server is unavailable |
Successful Response Parameters
| Parameter | Data type | Required | Description |
|---|---|---|---|
| access_token | string | 1 | Access token, issued for one month per login/password pair. |
| expires_in | string | 1 | Token lifetime, specified in seconds. |
Successful response example
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.
eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.
SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
"expires_in": "2592000"
}
Unsuccessful Response Parameters
| Parameter | Data type | Required | Description |
|---|---|---|---|
| error | string | 1 | Human-readable description of the error |
Unsuccessful response example
{
"error": "Missing or inappropriate required parameters"
}