Working with OAuth

OAuth allows you to request market data and manage portfolios on behalf of your end-users. For further details on the OAuth functionality, please see the OAuth documentation.

📘

Note

Each endpoint may have different base URLs.

Redirect User for Authorization

GET /oauth/authorize

Redirect your user from your application to this endpoint with the following query parameters.

Use the following base URL https://app.alpaca.markets

Example Request URL: https://app.alpaca.markets/oauth/authorize?response_type=code&client_id=YOUR_CLIENT_ID&redirect_uri=YOUR_REDIRECT_URL&state=SOMETHING_RANDOM&scope=account:write%20trading

Request

Query Parameters

AttributeTypeRequirementDescription
response_typestringRequiredMust be code to request an authorization code.
client_idstringRequiredThe client_id you received when you registered the application.
redirect_uristringRequiredThe URL where the user will be sent after authorization. It must match one of the whitelisted redirect URIs for your application.
statestringOptionalAn unguessable random string, used to protect against request forgery attacks.
scopestringOptionalA space-delimited list of scopes your application requests access to. Read-only endpoint access is assumed by default.

Response

Redirect to Alpaca authorization page.