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 accountscurl -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 accountscurl -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 credentialscurl -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 Accountscurl -L -X GET '<TREASURY_API_URL>/accounts' \-H 'Content-Type: application/json' \-H 'Authorization: Bearer <TOKEN>'# Get Accountcurl -L -X GET '<TREASURY_API_URL>/accounts/account_43gf9' \-H 'Content-Type: application/json' \-H 'Authorization: Bearer <TOKEN>'
# Monitor account status# List Accountscurl -L -X GET '<TREASURY_API_URL>/accounts' \-H 'Content-Type: application/json' \-H 'Authorization: Bearer <TOKEN>'# Get Accountcurl -L -X GET '<TREASURY_API_URL>/accounts/account_43gf9' \-H 'Content-Type: application/json' \-H 'Authorization: Bearer <TOKEN>'
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 orderscurl -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 Orderscurl -L -X GET '<TREASURY_API_URL>/orders' \-H 'Content-Type: application/json' \-H 'Authorization: Bearer <TOKEN>'# Get Ordercurl -L -X GET '<TREASURY_API_URL>/orders/order_girj0z' \-H 'Content-Type: application/json' \-H 'Authorization: Bearer <TOKEN>'
# Monitor order status# List Orderscurl -L -X GET '<TREASURY_API_URL>/orders' \-H 'Content-Type: application/json' \-H 'Authorization: Bearer <TOKEN>'# Get Ordercurl -L -X GET '<TREASURY_API_URL>/orders/order_girj0z' \-H 'Content-Type: application/json' \-H 'Authorization: Bearer <TOKEN>'
# List Securitiescurl -L -X GET '<TREASURY_API_URL>/securities' \-H 'Content-Type: application/json' \-H 'Authorization: Bearer <TOKEN>'# Get Securitycurl -L -X GET '<TREASURY_API_URL>/securities/security_gkjlzp' \-H 'Content-Type: application/json' \-H 'Authorization: Bearer <TOKEN>'
# Research tradable securities# List Securitiescurl -L -X GET '<TREASURY_API_URL>/securities' \-H 'Content-Type: application/json' \-H 'Authorization: Bearer <TOKEN>'# Get Securitycurl -L -X GET '<TREASURY_API_URL>/securities/security_gkjlzp' \-H 'Content-Type: application/json' \-H 'Authorization: Bearer <TOKEN>'
# List Holdingscurl -L -X GET '<TREASURY_API_URL>/holdings' \-H 'Content-Type: application/json' \-H 'Authorization: Bearer <TOKEN>'# Get Holdingcurl -L -X GET '<TREASURY_API_URL>/holdings/holding_rj3nf' \-H 'Content-Type: application/json' \-H 'Authorization: Bearer <TOKEN>'
# Check holding balances# List Holdingscurl -L -X GET '<TREASURY_API_URL>/holdings' \-H 'Content-Type: application/json' \-H 'Authorization: Bearer <TOKEN>'# Get Holdingcurl -L -X GET '<TREASURY_API_URL>/holdings/holding_rj3nf' \-H 'Content-Type: application/json' \-H 'Authorization: Bearer <TOKEN>'
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)