trading212-api▌
trading212-labs/agent-skills · updated Apr 8, 2026
MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.
Note: The Trading 212 API is currently in beta and under active development. Some endpoints or behaviors may change.
Trading 212 API
Note: The Trading 212 API is currently in beta and under active development. Some endpoints or behaviors may change.
Quick Reference
Environments
| Environment | Base URL | Purpose |
|---|---|---|
| Demo | https://demo.trading212.com/api/v0 |
Paper trading - test without real funds |
| Live | https://live.trading212.com/api/v0 |
Real money trading |
Order Quantity Convention
- Positive quantity = BUY (e.g.,
10buys 10 shares) - Negative quantity = SELL (e.g.,
-10sells 10 shares)
Account Types
Only Invest and Stocks ISA accounts are supported.
Instrument Identifiers
Trading 212 uses custom tickers as unique identifiers for instruments. Always search for the Trading 212 ticker before making instrument requests.
Authentication
HTTP Basic Auth with API Key (username) and API Secret (password).
Check Existing Setup First
Before guiding the user through authentication setup, check if credentials are already configured:
Semantic rule: Credentials are configured when at least one complete set is present: a complete set is key + secret for the same account (e.g. T212_API_KEY + T212_API_SECRET, or T212_API_KEY_INVEST + T212_API_SECRET_INVEST, or T212_API_KEY_STOCKS_ISA + T212_API_SECRET_STOCKS_ISA). You do not need all four account-specific vars; having only the Invest pair or only the Stocks ISA pair is enough. Check for any combination that gives at least one usable key+secret pair.
# Example: configured if any complete credential set exists
if [ -n "$T212_AUTH_HEADER" ] && [ -n "$T212_BASE_URL" ]; then
echo "Configured (derived vars)"
elif [ -n "$T212_API_KEY" ] && [ -n "$T212_API_SECRET" ]; then
echo "Configured (single account)"
elif [ -n "$T212_API_KEY_INVEST" ] && [ -n "$T212_API_SECRET_INVEST" ]; then
echo "Configured (Invest); Stocks ISA also if T212_API_KEY_STOCKS_ISA and T212_API_SECRET_STOCKS_ISA are set"
elif [ -n "$T212_API_KEY_STOCKS_ISA" ] && [ -n "$T212_API_SECRET_STOCKS_ISA" ]; then
echo "Configured (Stocks ISA); Invest also if T212_API_KEY_INVEST and T212_API_SECRET_INVEST are set"
else
echo "No complete credential set found"
fi
If any complete set is present, skip the full setup and proceed with API calls; when making requests, use the resolution order in "Making Requests" below (pick the pair that matches the user's account context when multiple sets exist). Do not ask the user to run derivation one-liners or merge keys into a header. Only guide users through the full setup process below when no complete credential set exists.
Important: Before making any API calls, always ask the user which environment they want to use: LIVE (real money) or DEMO (paper trading). Do not assume the environment.
API Keys Are Environment-Specific
API keys are tied to a specific environment and cannot be used across environments.
| API Key Created In | Works With | Does NOT Work With |
|---|---|---|
| LIVE account | live.trading212.com |
demo.trading212.com |
| DEMO account | demo.trading212.com |
live.trading212.com |
If you get a 401 error, verify that:
- You're using the correct API key for the target environment
- The API key was generated in the same environment (LIVE or DEMO) you're trying to access
Get Credentials
- Decide which environment to use - LIVE (real money) or DEMO (paper trading)
- Open Trading 212 app (mobile or web)
- Switch to the correct account - Make sure you're in LIVE or DEMO mode matching your target environment
- Navigate to Settings > API
- Generate a new API key pair - you'll receive:
- API Key (ID) (e.g.,
35839398ZFVKUxpHzPiVsxKdOtZdaDJSrvyPF) - API Secret (e.g.,
7MOzYJlVJgxoPjdZJCEH3fO9ee7A0NzLylFFD4-3tlo)
- API Key (ID) (e.g.,
- Store the credentials separately for each environment if you use both
Building the Auth Header
Combine your API Key (ID) and Secret with a colon, base64 encode, and prefix with Basic for the Authorization header.
Optional: To precompute the header from key/secret, you can set:
export T212_AUTH_HEADER="Basic $(echo -n "$T212_API_KEY:$T212_API_SECRET" | base64)"
Otherwise, the agent builds the header from T212_API_KEY and T212_API_SECRET when making requests.
Manual (placeholders):
# Format: T212_AUTH_HEADER = "Basic " + base64(API_KEY_ID:API_SECRET)
export T212_AUTH_HEADER="Basic $(echo -n "<YOUR_API_KEY_ID>:<YOUR_API_SECRET>" | base64)"
# Example with sample credentials:
export T212_AUTH_HEADER="Basic $(echo -n "35839398ZFVKUxpHzPiVsxKdOtZdaDJSrvyPF:7MOzYJlVJgxoPjdZJCEH3fO9ee7A0NzLylFFD4-3tlo" | base64)"
Making Requests
When making API calls, use the first option that applies (semantically: pick the credential set that matches the user's account, or the only set present):
- If
T212_AUTH_HEADERandT212_BASE_URLare set: use them in requests. - Else if
T212_API_KEYandT212_API_SECRETare set: use this pair (single account). Build header asBasic $(echo -n "$T212_API_KEY:$T212_API_SECRET" | base64)and base URL ashttps://${T212_ENV:-live}.trading212.com. Do not guide the user to derive or merge; you do it. - Else if both account-specific pairs are set (
T212_API_KEY_INVEST/T212_API_SECRET_INVESTandT212_API_KEY_STOCKS_ISA/T212_API_SECRET_STOCKS_ISA): the user must clearly specify which account to target (Invest or Stocks ISA), unless they ask for information for all accounts. Use the Invest pair when the user refers to Invest, and the Stocks ISA pair when the user refers to ISA/Stocks ISA. If the user wants information for all accounts, make multiple API calls—one per account (Invest and Stocks ISA)—and present or aggregate the results for both. If it is not clear from context which account to use (and they did not ask for all accounts), ask for confirmation before making API calls (e.g. "Which account should I use — Invest or Stocks ISA?"). Do not assume. Build the header from the chosen key/secret and base URL ashttps://${T212_ENV:-live}.trading212.com. - Else if only the Invest pair is set (
T212_API_KEY_INVESTandT212_API_SECRET_INVEST): use this pair for requests; if the user asks about Stocks ISA, only the Invest account is configured. - Else if only the Stocks ISA pair is set (
T212_API_KEY_STOCKS_ISAandT212_API_SECRET_STOCKS_ISA): use this pair for requests; if the user asks about Invest, only the Stocks ISA account is configured.
Use the T212_AUTH_HEADER value in the Authorization header when it is set:
# When T212_AUTH_HEADER and T212_BASE_URL are set:
curl -H "Authorization: $T212_AUTH_HEADER" \
"${T212_BASE_URL}/api/v0/equity/account/summary"
When only primary vars are set, use the inline form in the curl:
# When only T212_API_KEY, T212_API_SECRET, T212_ENV are set:
curl -H "Authorization: Basic $(echo -n "$T212_API_KEY:$T212_API_SECRET" | base64)" \
"https://${T212_ENV:-live}.trading212.com/api/v0/equity/account/summary"
Warning:
T212_AUTH_HEADERmust be the full header value including theBasicprefix.# WRONG - raw base64 without "Basic " prefix curl -H "Authorization: <base64-only>" ... # This will NOT work! # CORRECT - use T212_AUTH_HEADER (contains "Basic <base64>") curl -H "Authorization: $T212_AUTH_HEADER" ... # This works
Environment Variables
Single account vs all accounts: API keys are for a single account. One key/secret pair (T212_API_KEY + T212_API_SECRET) = one account (Invest or Stocks ISA). To use all accounts (Invest and Stocks ISA), the user must set two sets of key/secret: T212_API_KEY_INVEST / T212_API_SECRET_INVEST and T212_API_KEY_STOCKS_ISA / T212_API_SECRET_STOCKS_ISA. When both pairs are set, the user must clearly specify which account to target; if it is not clear from context, ask for confirmation (Invest or Stocks ISA) before making API calls.
Primary (single account): Set these for consistent setup with the plugin README:
export T212_API_KEY="your-api-key" # API Key (ID) from Trading 212
export T212_API_SECRET="your-api-secret"
export T212_ENV="demo" # or "live" (defaults to "live" if unset)
Account-specific (Invest and/or Stocks ISA): Set only the pair(s) you use. One complete set (key + secret for the same account) is enough. For example, only Invest:
export T212_API_KEY_INVEST="your-invest-api-key"
export T212_API_SECRET_INVEST="your-invest-api-secret"
export T212_ENV="demo" # or "live"
For both accounts, set both pairs:
export T212_API_KEY_INVEST="your-invest-api-key"
export T212_API_SECRET_INVEST="your-invest-api-secret"
export T212_API_KEY_STOCKS_ISA="your-stocks-isa-api-key"
export T212_API_SECRET_STOCKS_ISA="your-stocks-isa-api-secret"
export T212_ENV="demo" # or "live" (applies to both)
Optional – precomputed (for scripts or if the user prefers): The user can set the auth header and base URL from the primary vars, but they do not need to; when making API calls you (the agent) must build the header and base URL from primary vars if these are not set.
# Build auth header and base URL from T212_API_KEY, T212_API_SECRET, T212_ENV
export T212_AUTH_HEADER="Basic $(echo -n "$T212_API_KEY:$T212_API_SECRET" | base64)"
export T212_BASE_URL="https://${T212_ENV:-live}.trading212.com"
Alternative (manual): If you prefer not to store key/secret in env, set derived vars directly. Remember: API keys only work with their matching environment.
# For DEMO (paper trading)
export T212_AUTH_HEADER="Basic $(echo -n "<DEMO_API_KEY_ID>:<DEMO_API_SECRET>" | base64)"
export T212_BASE_URL="https://demo.trading212.com"
# For LIVE (real money) - generate separate credentials in LIVE account
# export T212_AUTH_HEADER="Basic $(echo -n "<LIVE_API_KEY_ID>:<LIVE_API_SECRET>" | base64)"
# export T212_BASE_URL="https://live.trading212.com"
Tip: If you use both environments, use separate variable names:
# Demo credentials
export T212_DEMO_AUTH_HEADER="Basic $(echo -n "<DEMO_KEY_ID>:<DEMO_SECRET>" | base64)"
# Live credentials
How to use trading212-api on Cursor
AI-first code editor with Composer
Prerequisites
Before installing skills in Cursor, ensure your development environment meets these requirements:
- ›Cursor installed and configured on your development machine
- ›Node.js version 16.0+ with npm package manager (verify with
node --version) - ›Active project directory or workspace where you want to add trading212-api
Execute installation command
Execute the skills CLI command in your project's root directory to begin installation:
The skills CLI fetches trading212-api from GitHub repository trading212-labs/agent-skills and configures it for Cursor.
Select Cursor when prompted
The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:
Verify installation
Confirm successful installation by checking the skill directory location:
Reload or restart Cursor to activate trading212-api. Access the skill through slash commands (e.g., /trading212-api) or your agent's skill management interface.
Security & Verification Notice
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.
List & Monetize Your Skill
Submit your Claude Code skill and start earning
Use Cases▌
Task Automation & Efficiency
Automate repetitive workflows and reduce manual effort
Example
Generate reports, summarize documents, draft communications
Save 3-5 hours per week on routine tasks
Knowledge Enhancement
Learn new skills, understand complex topics, get expert guidance
Example
Explain concepts, provide examples, suggest learning resources
Accelerate learning and skill development by 2x
Quality Improvement
Enhance output quality through reviews, suggestions, and refinements
Example
Review drafts, suggest improvements, catch errors
Improve work quality by 30-40% with less effort
Implementation Guide▌
Prerequisites
- ›Claude Desktop or compatible AI client with skill support
- ›Clear understanding of task or problem to solve
- ›Willingness to iterate and refine outputs
Time Estimate
15-45 minutes depending on use case complexity
Installation Steps
- 1.Install skill using provided installation command
- 2.Test with simple use case relevant to your work
- 3.Evaluate output quality and relevance
- 4.Iterate on prompts to improve results
- 5.Integrate into regular workflow if valuable
Common Pitfalls
- ⚠Expecting perfect results without iteration
- ⚠Not providing enough context in prompts
- ⚠Using skill for tasks outside its intended scope
- ⚠Accepting outputs without review and validation
Best Practices▌
✓ Do
- +Start with clear, specific prompts
- +Provide relevant context and constraints
- +Review and refine all outputs before using
- +Iterate to improve output quality
- +Document successful prompt patterns
✗ Don't
- −Don't use without understanding skill limitations
- −Don't skip validation of outputs
- −Don't share sensitive information in prompts
- −Don't expect skill to replace human judgment
💡 Pro Tips
- ★Be specific about desired format and style
- ★Ask for multiple options to choose from
- ★Request explanations to understand reasoning
- ★Combine AI efficiency with human expertise
When to Use This▌
✓ Use When
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
✗ Avoid When
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
Learning Path▌
- 1Familiarize yourself with skill capabilities and limitations
- 2Start with low-risk, non-critical tasks
- 3Progress to more complex and valuable use cases
- 4Build expertise through regular use and experimentation
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
Ratings
4.6★★★★★54 reviews- ★★★★★Chen Chawla· Dec 28, 2024
Registry listing for trading212-api matched our evaluation — installs cleanly and behaves as described in the markdown.
- ★★★★★Meera Diallo· Dec 12, 2024
I recommend trading212-api for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
- ★★★★★Mei Rahman· Dec 8, 2024
Solid pick for teams standardizing on skills: trading212-api is focused, and the summary matches what you get after install.
- ★★★★★Dhruvi Jain· Dec 4, 2024
Solid pick for teams standardizing on skills: trading212-api is focused, and the summary matches what you get after install.
- ★★★★★Aanya Nasser· Dec 4, 2024
Keeps context tight: trading212-api is the kind of skill you can hand to a new teammate without a long onboarding doc.
- ★★★★★Mei Zhang· Nov 27, 2024
We added trading212-api from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- ★★★★★Oshnikdeep· Nov 23, 2024
We added trading212-api from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- ★★★★★Li Ramirez· Nov 19, 2024
Useful defaults in trading212-api — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
- ★★★★★Mateo Desai· Nov 11, 2024
trading212-api is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Li Smith· Nov 3, 2024
trading212-api reduced setup friction for our internal harness; good balance of opinion and flexibility.
showing 1-10 of 54