> For the complete documentation index, see [llms.txt](https://docs.neox.vn/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.neox.vn/docs/global/global-collections/integration/api-authenplatform.md).

# API authenPlatform

#### Endpoint: POST /v2/auth/oauth2/token

#### Description: Obtain an OAuth 2.0 Bearer access token used to authenticate every other Global Collections API call.

## Request

#### Request Body Field Descriptions (JSON)

| Field Name     | Type   | Required | Description                                                             |
| -------------- | ------ | -------- | ----------------------------------------------------------------------- |
| grant\_type    | string | Yes      | OAuth 2.0 grant type. Use `client_credentials`.                         |
| client\_id     | string | Yes      | API integration ID from the Profile section on the Merchant Portal.     |
| client\_secret | string | Yes      | API integration secret from the Profile section on the Merchant Portal. |
| scope          | string | Yes      | Service scope. Use `global-collection`.                                 |

#### Request sample

```json
{
  "grant_type": "client_credentials",
  "client_id": "e1b2c3d4-5678-1234-9abc-1234567890ab",
  "client_secret": "s3cr3t-key-value",
  "scope": "global-collection"
}
```

### Response

#### Response Field Descriptions

| Field Name    | Type   | Description                                                                                        |
| ------------- | ------ | -------------------------------------------------------------------------------------------------- |
| code          | number | Response code. Refer to [Error Codes](/docs/global/global-collections/integration/error-codes.md). |
| access\_token | string | Token used to authenticate all other API calls.                                                    |
| token\_type   | string | Token type. `bearer` by default.                                                                   |
| expires\_in   | number | `access_token` expiration time, in seconds.                                                        |
| message       | string | Response message.                                                                                  |

#### Response sample

```json
{
  "code": 1,
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6Ikp...",
  "token_type": "bearer",
  "expires_in": 3600,
  "message": ""
}
```

### Notes

* This endpoint does not require a Bearer token; it is the call that issues one.
* The Accept-Language header can be used to specify the response language (Support: "vi", "en").
* Pass the returned `access_token` in the `Authorization: Bearer <access_token>` header of every other Global Collections API.
* Request a new token before the current one expires (`expires_in` seconds).
