Connect via the API
With the PDT API, you can retrieve your portfolio data in your own scripts, spreadsheets or tools, or add broker actions to PDT automatically. To do this, you create an API token in PDT.
Want to ask questions about your portfolio in an AI chat such as ChatGPT or Claude? Use the MCP connection instead. You can read how this works in Integrations.
Create an API token
Step 1: Go to Integrations and open the API tab.
Step 2: Click Add token.
Step 3: Under Name, give your token a name that tells you what you use it for, for example "Google Sheets dividend overview".
Step 4: Under Permission, choose what the token is allowed to do:
- Read only: view all portfolio actions in PDT. Nothing can be changed.
- Read and write: besides viewing, broker actions can also be created, edited and deleted.
Step 5: Under Valid for, choose how long the token stays active: 30 days, 90 days, 1 year or no expiration date. Click Save.
Step 6: In the Token created screen, click Copy and store the token in a safe place, such as a password manager. Then click Confirm.
You will only see the token once. Anyone with this token can access your portfolio data, so never share it. Lost it? Then generate a new token.
You can read how to use the token in your own script or tool, and which data you can retrieve, in the API documentation.
Manage your tokens
The API tab shows all your tokens, with their permission, expiration date and last activity.
Regenerate token creates a new token with the same name and permission. The current token stops working immediately, so replace it in your script or tool afterwards. This is also the way to go if your token is lost or has expired.
Revoke access removes the token. Scripts and tools that use it can no longer access your data.