---
title: "Authorize an OAuth Token"
method: POST
path: "/v1/oauth/authorize"
tags: ["OAuth"]
---

# Authorize an OAuth Token

`POST /v1/oauth/authorize`

## Request

- Base URL: `https://broker-api.giftcity.sandbox.in.alpaca.markets`
- URL: `https://broker-api.giftcity.sandbox.in.alpaca.markets/v1/oauth/authorize`
- Auth: HTTP basic

The operation issues an OAuth code which can be used in the OAuth code flow.

## Request body

- OAuthTokenRequest: This model is used for both the Issue and Authorize OAuth token routes
  - `account_id` string, uuid, required: end-user account ID
  - `client_id` string, required: OAuth client ID
  - `client_secret` string, required: OAuth client secret
  - `redirect_uri` string, required: redirect URI for the OAuth flow
  - `scope` string, required: scopes requested by the OAuth flow

## Response `200`

Successfully issued a code.

- AuthorizeOAuthTokenResponse
  - `client_id` string, required: OAuth `client_id`
  - `code` string, required: OAuth code to exchange with token
  - `redirect_uri` string, required: Redirect URI of OAuth flow
  - `scope` string, required: Granted scopes

## Other responses

- `401`: Client does not exist, you do not have access to the client, or "client_secret" is incorrect.
- `422`: Redirect URI or scope is invalid.

---

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