Skip to main content

The API to buy Treasuries directly

Our API is built on top of TreasuryDirect. You can connect an existing account or open a new account with one API call, and then automate treasury management with just a few lines of code.
There is no risk of bank runs or money market fund failures, as you deal directly with the US Treasury Department.

Open accounts in minutes

Manage TreasuryDirect accounts for individuals and entities.

curl -L -X POST '<TREASURY_API_URL>/accounts' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <TOKEN>' \
-d '{
"registration": {
"entityId": "entity_fnl4z",
"bankRoutingNumber": "101050001",
"bankAccountNumber": "9488442",
"bankAccountType": "CHECKING",
"password": "*********"
}
}'
# Register new accounts
curl -L -X POST '<TREASURY_API_URL>/accounts' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <TOKEN>' \
-d '{
"registration": {
"entityId": "entity_fnl4z",
"bankRoutingNumber": "101050001",
"bankAccountNumber": "9488442",
"bankAccountType": "CHECKING",
"password": "*********"
}
}'
curl -L -X POST '<TREASURY_API_URL>/accounts' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <TOKEN>' \
-d '{
"credentials": {
"accountNumber": "W-530-247-999",
"password": "*********"
}
}'
# Connect existing accounts
curl -L -X POST '<TREASURY_API_URL>/accounts' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <TOKEN>' \
-d '{
"credentials": {
"accountNumber": "W-530-247-999",
"password": "*********"
}
}'
curl -L -X PATCH \
'<TREASURY_API_URL>/accounts/:accountId/credentials' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <TOKEN>' \
-d '{
"accountNumber": "W-530-247-999",
"password": "*********"
"otp": "Y7sGksme"
}'
# Update account credentials
curl -L -X PATCH \
'<TREASURY_API_URL>/accounts/:accountId/credentials' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <TOKEN>' \
-d '{
"accountNumber": "W-530-247-999",
"password": "*********"
"otp": "Y7sGksme"
}'
# List Accounts
curl -L -X GET '<TREASURY_API_URL>/accounts' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <TOKEN>'
# Get Account
curl -L -X GET '<TREASURY_API_URL>/accounts/account_43gf9' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <TOKEN>'
# Monitor account status
# List Accounts
curl -L -X GET '<TREASURY_API_URL>/accounts' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <TOKEN>'
# Get Account
curl -L -X GET '<TREASURY_API_URL>/accounts/account_43gf9' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <TOKEN>'
Arrow up icon

Register new accounts

Connect existing accounts

Update account credentials

Monitor account status

Buy, monitor, research T-bills with code

Everything you can do with the UI, you can do with code.

curl -L -X POST '<TREASURY_API_URL>/orders' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <TOKEN>' \
-d '{
"accountId": "account_4i8rm",
"securityId": "security_gkjlzp",
"amount": 10000
}'
# Place Treasury orders
curl -L -X POST '<TREASURY_API_URL>/orders' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <TOKEN>' \
-d '{
"accountId": "account_4i8rm",
"securityId": "security_gkjlzp",
"amount": 10000
}'
# List Orders
curl -L -X GET '<TREASURY_API_URL>/orders' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <TOKEN>'
# Get Order
curl -L -X GET '<TREASURY_API_URL>/orders/order_girj0z' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <TOKEN>'
# Monitor order status
# List Orders
curl -L -X GET '<TREASURY_API_URL>/orders' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <TOKEN>'
# Get Order
curl -L -X GET '<TREASURY_API_URL>/orders/order_girj0z' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <TOKEN>'
# List Securities
curl -L -X GET '<TREASURY_API_URL>/securities' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <TOKEN>'
# Get Security
curl -L -X GET '<TREASURY_API_URL>/securities/security_gkjlzp' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <TOKEN>'
# Research tradable securities
# List Securities
curl -L -X GET '<TREASURY_API_URL>/securities' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <TOKEN>'
# Get Security
curl -L -X GET '<TREASURY_API_URL>/securities/security_gkjlzp' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <TOKEN>'
# List Holdings
curl -L -X GET '<TREASURY_API_URL>/holdings' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <TOKEN>'
# Get Holding
curl -L -X GET '<TREASURY_API_URL>/holdings/holding_rj3nf' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <TOKEN>'
# Check holding balances
# List Holdings
curl -L -X GET '<TREASURY_API_URL>/holdings' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <TOKEN>'
# Get Holding
curl -L -X GET '<TREASURY_API_URL>/holdings/holding_rj3nf' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <TOKEN>'
Arrow up icon

Place Treasury orders

Monitor order status

Research tradable securities

Check holding balances

Automate treasury management

Ladder short-term and long-term bills for optimal liquidity and yield, automatically.

# I have $2 million in corporate cash.
total_cash = 2_000_000
# Leave $500k as operating cash, and buy treasury bills with the rest.
treasury_allocation = total_cash - 500_000
# Put 1/3 into 4 week bills, 1/3 into 26 week bills, and 1/3 into 52 week bills, and repeat.
repeat_buy(interval="1 month", term="FOUR_WEEK", amount=treasury_allocation / 3)
repeat_buy(interval="6 months", term="TWENTY_SIX_WEEK", amount=treasury_allocation / 3)
repeat_buy(interval="1 year", term="FIFTY_TWO_WEEK", amount=treasury_allocation / 3)

Frequently Asked Questions