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

Placing your first options order

Learn how to place your first options order by getting option expiration dates, retrieving option chain data, checking market prices, running preflight checks, and placing the order.

Get your account ID

First, retrieve your account ID using the accounts endpoint:

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

This returns your available accounts with their options trading levels:

{
  "accounts": [
    {
      "accountId": "YOUR_ACCOUNT_ID",
      "accountType": "BROKERAGE",
      "optionsLevel": "LEVEL_2",
      "brokerageAccountType": "MARGIN"
    }
  ]
}

Get option expiration dates

First, retrieve available expiration dates for the underlying stock (e.g., AAPL):

curl --request POST \
  --url https://api.public.com/userapigateway/marketdata/{YOUR_ACCOUNT_ID}/option-expirations \
  --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "instrument": {
      "symbol": "AAPL",
      "type": "EQUITY"
    }
  }'

This returns available expiration dates:

{
  "baseSymbol": "AAPL",
  "expirations": [
    "2024-01-19",
    "2024-01-26",
    "2024-02-02",
    "2024-02-16",
    "2024-03-15"
  ]
}

Get option chain data

Get the option chain for a specific expiration date to see available strikes for both CALL and PUT options:

curl --request POST \
  --url https://api.public.com/userapigateway/marketdata/{YOUR_ACCOUNT_ID}/option-chain \
  --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "instrument": {
      "symbol": "AAPL",
      "type": "EQUITY"
    },
    "expirationDate": "2024-02-16"
  }'

This returns calls and puts with current pricing:

{
  "baseSymbol": "AAPL",
  "calls": [
    {
      "instrument": {
        "symbol": "AAPL240216C00145000",
        "type": "OPTION"
      },
      "outcome": "SUCCESS",
      "last": "7.50",
      "lastTimestamp": "2024-01-15T15:59:00Z",
      "bid": "7.30",
      "bidSize": 10,
      "ask": "7.70",
      "askSize": 15
    }
  ],
  "puts": [
    {
      "instrument": {
        "symbol": "AAPL240216P00145000",
        "type": "OPTION"
      },
      "outcome": "SUCCESS",
      "last": "2.25",
      "bid": "2.15",
      "ask": "2.35"
    }
  ]
}

Get current option quote

Get the current market price for the specific option you want to buy:

curl --request POST \
  --url https://api.public.com/userapigateway/marketdata/{YOUR_ACCOUNT_ID}/quotes \
  --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "instruments": [
      {
        "symbol": "AAPL240216C00145000",
        "type": "OPTION"
      }
    ]
  }'

This returns current bid/ask prices for the option:

{
  "quotes": [
    {
      "instrument": {
        "symbol": "AAPL240216C00145000",
        "type": "OPTION"
      },
      "outcome": "SUCCESS",
      "last": "7.50",
      "lastTimestamp": "2024-01-15T15:59:00Z",
      "bid": "7.30",
      "bidSize": 10,
      "ask": "7.70",
      "askSize": 15
    }
  ]
}

Run preflight check

Before placing an options order, run a preflight check to estimate costs and validate the order:

curl --request POST \
  --url https://api.public.com/userapigateway/trading/{YOUR_ACCOUNT_ID}/preflight/single-leg \
  --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "instrument": {
      "symbol": "AAPL240216C00145000",
      "type": "OPTION"
    },
    "orderSide": "BUY",
    "orderType": "LIMIT",
    "expiration": {
      "timeInForce": "DAY"
    },
    "quantity": "1",
    "limitPrice": "7.50",
    "openCloseIndicator": "OPEN"
  }'

The response provides estimated costs and option details:

{
  "instrument": {
    "symbol": "AAPL240216C00145000",
    "type": "OPTION"
  },
  "estimatedCommission": "0.65",
  "orderValue": "750.00",
  "estimatedQuantity": "1",
  "estimatedCost": "750.65",
  "buyingPowerRequirement": "750.65",
  "optionDetails": {
    "baseSymbol": "AAPL",
    "type": "CALL",
    "strikePrice": "145.00",
    "optionExpireDate": "2024-02-16"
  },
  "regulatoryFees": {
    "orfFee": "0.04",
    "occFee": "0.02"
  },
  "estimatedOrderRebate": {
    "estimatedOptionRebate": "0.50",
    "optionRebatePercent": 50,
    "perContractRebate": "0.50"
  },
  "priceIncrement": {
    "incrementBelow3": "0.05",
    "incrementAbove3": "0.10",
    "currentIncrement": "0.05"
  }
}

Place the options order

Now place the actual options order. Generate a unique UUID for the orderId. The openCloseIndicator is set to "OPEN" since we're opening a new CALL position:

curl --request POST \
  --url https://api.public.com/userapigateway/trading/{YOUR_ACCOUNT_ID}/order \
  --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "orderId": "550e8400-e29b-41d4-a716-446655440001",
    "instrument": {
      "symbol": "AAPL240216C00145000",
      "type": "OPTION"
    },
    "orderSide": "BUY",
    "orderType": "LIMIT",
    "expiration": {
      "timeInForce": "DAY"
    },
    "quantity": "1",
    "limitPrice": "7.50",
    "openCloseIndicator": "OPEN"
  }'

The response confirms the order was submitted:

{
  "orderId": "550e8400-e29b-41d4-a716-446655440001"
}

Check order status

Monitor your options order status to see if it has been filled:

curl --request GET \
  --url https://api.public.com/userapigateway/trading/{YOUR_ACCOUNT_ID}/order/550e8400-e29b-41d4-a716-446655440001 \
  --header 'Authorization: Bearer YOUR_ACCESS_TOKEN'

The response shows the current order status:

{
  "orderId": "550e8400-e29b-41d4-a716-446655440001",
  "instrument": {
    "symbol": "AAPL240216C00145000",
    "type": "OPTION"
  },
  "createdAt": "2024-01-15T16:00:00Z",
  "type": "LIMIT",
  "side": "BUY",
  "status": "FILLED",
  "quantity": "1",
  "filledQuantity": "1",
  "averagePrice": "7.45",
  "limitPrice": "7.50",
  "openCloseIndicator": "OPEN",
  "expiration": {
    "timeInForce": "DAY"
  }
}

Get option Greeks (optional)

You can also retrieve the Greeks for your option position for risk analysis:

curl --request GET \
  --url https://api.public.com/userapigateway/option-details/AAPL240216C00145000/greeks \
  --header 'Authorization: Bearer YOUR_ACCESS_TOKEN'

The response provides the option's risk metrics:

{
  "delta": "0.65",
  "gamma": "0.02",
  "theta": "-0.15",
  "vega": "0.85",
  "rho": "0.45",
  "impliedVolatility": "0.25"
}

Verify your position

Finally, check your portfolio to confirm the new options position:

curl --request GET \
  --url https://api.public.com/userapigateway/trading/{YOUR_ACCOUNT_ID}/portfolio/v2 \
  --header 'Authorization: Bearer YOUR_ACCESS_TOKEN'

You should now see your new options position in the portfolio:

{
  "accountId": "YOUR_ACCOUNT_ID",
  "accountType": "BROKERAGE",
  "buyingPower": {
    "cashOnlyBuyingPower": "4104.35",
    "buyingPower": "9104.35",
    "optionsBuyingPower": "9104.35"
  },
  "positions": [
    {
      "instrument": {
        "symbol": "AAPL240216C00145000",
        "name": "AAPL Feb 16 '24 $145 Call",
        "type": "OPTION"
      },
      "quantity": "1.0",
      "currentValue": "750.00",
      "percentOfPortfolio": "7.50",
      "costBasis": {
        "totalCost": "745.65",
        "unitCost": "745.65",
        "gainValue": "4.35",
        "gainPercentage": "0.58"
      }
    }
  ],
  "equity": [
    {
      "type": "OPTIONS_LONG",
      "value": "750.00",
      "percentageOfPortfolio": "7.50"
    }
  ]
}

📝 Important Notes for Options Trading

  • openCloseIndicator: This field is required for all options orders. Use "OPEN" when establishing new positions (buying to open or selling to open), and "CLOSE" when closing existing positions (buying to close or selling to close).
  • Options require appropriate approval levels (Level 1-4) depending on the strategy complexity.
  • Option prices are quoted per share, but represent contracts of 100 shares (multiply by 100 for total cost).
  • Always run preflight checks to understand costs, including commissions, regulatory fees, and potential rebates.