# Obtain access token

**POST** `/authentication/oauth2/-core/access_token`

Base URL: `https://api-sbx.pre.globalgetnet.com/dpy/payment-link/v1`

Obtains an OAuth 2.0 access token via the Client Credentials flow.
The returned token must be included as `Authorization: Bearer {token}` in all subsequent requests.

**URLs do Token por ambiente:**
| Ambiente | URL |
|----------|-----|
| SBX | `https://api-sbx.pre.globalgetnet.com/authentication/oauth2/-core/access_token` |
| UAT | `https://api.pre.globalgetnet.com/authentication/oauth2/-core/access_token` |
| PROD | `https://api.globalgetnet.com/authentication/oauth2/-core/access_token` |

**Escopo:** `digital-plataform:gateway-api` — Acesso completo (leitura/escrita) à Payment Link API.

## Body

Content type: `application/x-www-form-urlencoded`

- `grant_type` ("client_credentials", required)
  OAuth 2.0 grant type
- `client_id` (string, required)
  Client identifier
- `client_secret` (string, required)
  Client secret
- `scope` (string, required)
  API access scope

Example:

```json
{
  "grant_type": "client_credentials",
  "client_id": "seu-client-id",
  "client_secret": "seu-client-secret",
  "scope": "digital-plataform:gateway-api"
}
```

## Responses

### 200

Token obtained successfully

- `access_token` (string)
  JWT access token
- `token_type` (string)
  Token type
- `expires_in` (integer)
  Expiration time in seconds
- `scope` (string)
  Granted scope

Example:

```json
{
  "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
  "token_type": "Bearer",
  "expires_in": 3600,
  "scope": "digital-plataform:gateway-api"
}
```

### 400

Invalid request

- `error_code` (string)
- `message` (string)
- `status_code` (integer)

Example:

```json
{
  "error_code": "payment_link_not_found",
  "message": "Payment Link not found",
  "status_code": 422
}
```

### 401

Invalid credentials

- `error_code` (string)
- `message` (string)
- `status_code` (integer)

Example:

```json
{
  "error_code": "payment_link_not_found",
  "message": "Payment Link not found",
  "status_code": 422
}
```