---
title: "Generate access token"
method: POST
path: "/as/token.oauth2"
tags: ["Journey execution"]
---

# Generate access token

`POST /as/token.oauth2`

## Request

- Base URL: `https://api.auth.gbgplc.com`
- URL: `https://api.auth.gbgplc.com/as/token.oauth2`
- Auth: none required

Get an access token to authenticate API requests. If you're unfamiliar with the authentication process, check out the [authentication guide](/docs/go-v2/developer-integration/execute-customer-journeys/authenticate) for more details.

## Request body `application/x-www-form-urlencoded`

- union
  - PasswordGrantRequest
    - `client_id` string, required: The client ID assigned to your organization.
    - `client_secret` string, required: The client secret assigned to your organization.
    - `username` string, required: The username for API authentication.
    - `password` string, required: The password for API authentication.
    - `grant_type` 'password', required: Must always be set to 'password'.
  - ClientCredentialsGrantRequest
    - `client_id` string, required: The client ID assigned to your organization.
    - `client_secret` string, required: The client secret assigned to your organization.
    - `grant_type` 'client_credentials', required: Must always be set to 'client_credentials'.
    - `scope` 'gbg.token', required: Must always be set to 'gbg.token'.

## Response `200`

Successfully retrieved access token.

- object
  - `access_token` string: The access token used for authentication.
  - `expires_in` integer: Token expiration time in seconds.
  - `token_type` string: The type of token, usually 'Bearer'.

## Other responses

- `400`: Invalid request. Check your credentials.
- `401`: Unauthorized request. Invalid username or password.

## Changes

- **2026-09-16** `1439566e2f31`: 1 breaking
  - added the new required request property `oneOf[#/components/schemas/ClientCredentialsGrantRequest]/scope`
- **2026-07-06** `2841983b254a`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/gbgplc/apis/gbg-go-next-gen-flow-captain-api/changes/as/token.oauth2/post.md)

---

[API](https://skmtc.dev/gbgplc/apis/gbg-go-next-gen-flow-captain-api.md) - [All operations](https://skmtc.dev/gbgplc/apis/gbg-go-next-gen-flow-captain-api/llms.txt) - [OpenAPI document](https://skmtc.dev/gbgplc/apis/gbg-go-next-gen-flow-captain-api/revisions/f4b64916866a?raw)
