API

Get Started

WelcomeQuickstartExamplesChangelogSDKs and Tools

Authorization

POSTCreate personal access token

List Accounts

GETGet accounts

Account Details

GETGet account portfolio v2GETGet history

Instrument Details

GETGet all instrumentsGETGet instrument

Market Data

POSTGet quotesPOSTGet option expirationsPOSTGet option chain

Order Placement

POSTPreflight single legPOSTPreflight multi legPOSTPlace orderPOSTPlace multileg orderGETGet orderDELETECancel order

Option Details

GETGet option greeks_1
HelpFeedback

Get Started

Quickstart

Learn how to authenticate to the Public API and make your first request.

Example integration

1 Generate a Secret key

Go to the settings page and generate a secret key.

Important: Keep your secret keys secure and never expose them in client-side code.

2 Authorization

Use the secret key to exchange for an access token.

curl --request POST \
  --url https://api.public.com/userapiauthservice/personal/access-tokens \
  --header 'Content-Type: application/json' \
  --data '{
  "validityInMinutes": 123,
  "secret": "YOUR_SECRET_KEY"
}'

Receive an access token in the response:

{
  "accessToken": "YOUR_ACCESS_TOKEN"
}

Subsequently you use the accessToken to authenticate any API request:

Authorization: Bearer YOUR_ACCESS_TOKEN

3 Making your first request

Here's how to make your first API request to get account information:

curl --request GET \
  --url https://api.public.com/userapigateway/trading/account \
  --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  --header 'Content-Type: application/json'

4 Response format

A successful response will return a JSON object with the account information:

{
  "accounts": [
    {
      "accountId": "string",
      "accountType": "BROKERAGE",
      "optionsLevel": "NONE",
      "brokerageAccountType": "CASH",
      "tradePermissions": "BUY_AND_SELL"
    }
  ]
}

5 Error handling

The API returns standard HTTP status codes. Here are some common error responses:

401 Unauthorized

Invalid or missing access token

{
  "error": "Unauthorized",
  "message": "Invalid access token"
}
400 Bad Request

Invalid request parameters

{
  "error": "Bad Request",
  "message": "Error message"
}