---
title: "Issue tokens"
method: POST
path: "/oauth2/token"
tags: ["OAuth2"]
---

# Issue tokens

`POST /oauth2/token`

## Request

- Base URL: `https://authx.giftcity.in.alpaca.markets/v1`
- URL: `https://authx.giftcity.in.alpaca.markets/v1/oauth2/token`
- Auth: none required

Issue access tokens using various grant types:
- `client_credentials`: Exchange client credentials for an access token
- `urn:ietf:params:oauth:grant-type:jwt-bearer`: Exchange JWT assertion (Keycloak for brokerdash or Google for admin)
- `refresh_token`: Refresh an admin access token using a refresh token

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

- TokenRequest
  - `client_assertion` string: Client assertion JWT (if using private_key_jwt)
  - `client_assertion_type` 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer': Client assertion type (if using private_key_jwt)
  - `client_id` string: Client ID
  - `client_secret` string: Client secret (if using client_secret)
  - `grant_type` 'client_credentials' | 'urn:ietf:params:oauth:grant-type:jwt-bearer' | 'refresh_token', required: Grant type

## Response `200`

OK

- TokenResponse
  - `access_token` string, required: Access token
  - `expires_in` integer, required: Time in seconds until the token expires
  - `refresh_token` string: Refresh token
  - `token_type` 'Bearer', required: Type of the token (e.g., Bearer)

## Other responses

- `default`: Error

---

[API](https://skmtc.dev/alpacahq/apis/authentication-api.md) - [All operations](https://skmtc.dev/alpacahq/apis/authentication-api/llms.txt) - [OpenAPI document](https://skmtc.dev/alpacahq/apis/authentication-api/revisions/d1f08e94b3ee?raw)
