Skip to main content

Portfolio API: Getting Started

Integrate your portfolio data with external applications using the Consumer API. Create API keys, authenticate requests, and automate your investment workflows.

Last reviewed

Getting Started

What the Consumer API is and who can use it.

What Is the Consumer API?

The Portfolio Tracker Consumer API allows you to access your portfolio data programmatically. You can fetch holdings, record transactions, import broker statements, and receive real-time notifications via webhooks, all from your own scripts, spreadsheets, or third-party tools.

The API follows RESTful conventions and returns JSON responses. All endpoints are versioned under /api/v1/portfolio/ext/ to ensure stability as we add new features.

Who Can Use the API?

The Consumer API is included in selected subscription plans. The Subscription page shows which plans include it, and Rate Limits below lists each plan’s request allowance.

Note

If your plan does not include the Consumer API, you can upgrade from the Subscription page to get started.

What Can You Do with It?

The API gives you full programmatic access to your portfolio data. Common use cases include:

  • Retrieve holdings: Fetch your current positions, market values, and gain/loss data
  • Record transactions: Log buy, sell, and dividend transactions automatically
  • Import statements: Upload broker statements for automatic parsing
  • Set up webhooks: Receive notifications when a price alert triggers or a transaction is processed (on plans that include webhooks)
  • Export data: Pull your portfolio data into spreadsheets, dashboards, or analytics tools

Authentication

How to create and use API keys to authenticate your requests.

Creating an API Key

API keys are created from the Developer hub. Each key is scoped to your account and can be revoked at any time.

  1. Open the Developer hub with the Go to Developer Hub button at the foot of this page (the Portfolio Tracker Developer page shows the same tools, so either route works)
  2. Click "Create key" and give your key a descriptive name (e.g. "My Spreadsheet Integration")
  3. Choose the scopes the key needs: portfolio:read for read-only access, or portfolio:write to record changes
  4. Copy the key immediately, because it will only be displayed once
  5. Store the key securely (e.g. in a password manager or environment variable)

Important

Your API key is shown only once at creation time. We store a one-way Argon2 hash of the key, so it cannot be retrieved later. If you lose your key, revoke it and create a new one.

Using Your API Key

All API requests must include your key in the Authorization header using the Bearer scheme. Keys use a twai_ prefix so they are easy to identify in your code (older keys beginning pk_ keep working).

Example header:

Authorization: Bearer twai_your_api_key_here

Tip

Never hard-code your API key directly in source files. Use environment variables or a secrets manager to keep your key safe.

Your First API Call

A step-by-step guide to making your first request.

Step-by-Step

Follow these steps to verify your API key is working and retrieve your holdings.

  1. Create an API key from the Developer hub (see Authentication above)
  2. Make a GET request to the holdings endpoint:
    GET /api/v1/portfolio/ext/holdings/
    Include your API key in the Authorization header as described above
  3. Check the response. A successful request returns a JSON object containing your holdings array along with summary data such as total market value and daily change
  4. If you receive a 401 Unauthorised response, verify that your key is correct and has not been revoked

Tip

Use a tool such as cURL, Postman, or your programming language’s HTTP library to make your first request. See the Code Examples page for ready-to-use snippets in Python, JavaScript, and more.

Rate Limits

Understand how request limits work for each plan tier.

Limits are counted on a sliding window. When you go over one, the API answers 429 Too Many Requests with a Retry-After header telling you how long to wait.

Document downloads

Each vault file or will PDF handed out, on top of the Consumer API budget.

  • Every plan: 60 requests per hour

Shared by every key you hold, so a new key never adds to it. Scopes: documents:read.

These figures come from the limits the API enforces, also served as JSON at /api/v1/portfolio/rate-limits/.

Every response reports your allowance in the X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset headers, so an integration can pace itself. The Usage panel on the Developer Page breaks the hour down by key so you can find the integration spending it.

Tip

Cache responses locally where possible and avoid polling more frequently than necessary. If you need real-time updates, consider setting up webhooks (available on plans that include webhooks) instead of polling.

Common Workflows

Typical ways to use the Consumer API.

Popular Use Cases

Below are some of the most common workflows that API users set up. Each one is covered in detail in the Code Examples help page.

  • Fetching holdings: Retrieve your current portfolio positions, including quantities, market values, and unrealised gains
  • Recording transactions: Programmatically log buy, sell, and dividend transactions to keep your portfolio up to date
  • Importing broker statements: Upload CSV or PDF statements from supported brokers for automatic parsing and reconciliation
  • Setting up webhooks: Register callback URLs to receive real-time notifications when a transaction is created, a corporate action is detected, a price alert triggers, tax figures are recalculated, or an import completes (on plans that include webhooks)

Related Topics

Can’t find what you’re looking for?

Our support team is here to help. Contact us and we’ll get back to you as soon as possible.

Contact Support

We use cookies to improve your experience. See our Cookie Policy (opens in a new tab) for details.