API

Get Started

WelcomeQuickstartExamplesChangelogSDKs and ToolsOrder Limits

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 orderPUTReplace orderPOSTPlace multileg orderGETGet orderDELETECancel order

Option Details

GETGet option greeks
HelpFeedback

Get Started

Getting Started with the Public CLI

The publicdotcom-cli lets you interact with your Public brokerage account directly from the terminal. This guide walks through installing the CLI, authenticating, and going from a quote to a placed order without leaving the command line.

What You'll Do

Step 01

Install the CLI

Step 02

Authenticate

Step 03

Check a quote

Step 04

Place and monitor an order

Before You Get Started

  • →You need a Public.com brokerage account. Create one at public.com/signup.
  • →Python 3.9 or later must be installed on your machine. Verify with python --version.
  • →The CLI is open source. You can browse the source code on GitHub.
1

Installing the CLI

The recommended way to install the CLI is with pipx, which installs it into an isolated environment and puts the public command on your PATH without affecting any other Python projects:

pipx install publicdotcom-cli

Alternatively, install with uv:

uv tool install publicdotcom-cli

Verify the installation by printing the help output:

public --help

You should see a list of available command groups: auth, accounts, market, portfolio, instruments, and order.

2

Authenticating

Run the login command. It will open a browser window where you authorize the CLI against your Public account, then store the resulting credentials locally:

public auth login

Credentials are saved in your OS keychain by default. The CLI handles token refresh automatically, but you can also trigger it manually:

public auth refresh

To remove stored credentials at any time, run:

public auth logout
3

Listing Accounts and Setting a Default

Most trading commands require an account ID. Start by listing all accounts linked to your login:

public accounts list

The output shows each account along with its ID, type, and options level. Copy the account ID you want to use and set it as the default so you don't have to pass it on every command:

public accounts set-default YOUR_ACCOUNT_ID

You can verify your holdings at any time with:

public portfolio show
4

Getting a Quote

Before placing an order it's good practice to check the current market price. Pass one or more tickers to the quotes command:

public market quotes AAPL

You can quote multiple symbols in a single call:

public market quotes AAPL MSFT TSLA

Add the --json flag to any command to get machine-readable output, useful for scripting:

public market quotes AAPL --json
5

Placing and Monitoring an Order

The CLI uses JSON files to describe orders, which makes it easy to version-control and reuse order templates. There are two steps: run a preflight check first, then place the order with the same file.

Create an order file

Save the following as order.json. This example buys 1 share of AAPL at market price, good for the day:

{
  "instrument": {
    "symbol": "AAPL",
    "type": "EQUITY"
  },
  "orderSide": "BUY",
  "orderType": "MARKET",
  "expiration": {
    "timeInForce": "DAY"
  },
  "quantity": "1"
}

Run a preflight check

The preflight command validates the order and returns an estimated cost breakdown — including buying-power impact and regulatory fees — without submitting anything live:

public order preflight-single --file order.json

Place the order

Once you've reviewed the preflight output, place the order using the same file:

public order place --file order.json

Important

Placing an order through the CLI submits a real order against your live brokerage account. Review the preflight output carefully before running order place.

The command returns an order ID. Use it to check the order status:

public order get ORDER_ID

If you need to cancel before it fills:

public order cancel ORDER_ID

Quick Reference

CommandDescription
public auth loginAuthenticate and store credentials
public auth logoutRemove stored credentials
public accounts listList all accounts
public accounts set-default IDSet a default account
public portfolio showShow portfolio and holdings
public market quotes AAPLGet a live quote
public market option-chain AAPL 2026-06-20View options chain
public order preflight-single --file order.jsonValidate an order
public order place --file order.jsonPlace an order
public order get ORDER_IDCheck order status
public order cancel ORDER_IDCancel an open order

What's Next

You've installed the CLI, authenticated, and placed your first order. From here you can write shell scripts that combine quotes, preflight checks, and order placement into automated workflows, or pipe --json output into tools like jq for further processing.

If you prefer working directly with the REST API instead of the CLI, the placing your first equity order template covers the same end-to-end flow using raw HTTP requests.

For the full list of commands and flags, run public --help or visit the publicdotcom-cli GitHub repository.