How to get a cTrader Open API API key

cTrader issues a client id and secret per application, then an access token when you authorize your cTrader ID.

About 20 minutes 4 steps Checked October 2026

Before you start

  • A cTrader ID with a demo or live account at a cTrader broker

Create your cTrader Open API API key

  1. 1

    Open the Open API portal

    Sign in at openapi.ctrader.com with your cTrader ID.

  2. 2

    Add an application

    Create an application with a redirect URI. Wait for it to become Active, then copy the Client ID and Secret.

  3. 3

    Authorize accounts

    Use the Playground or the OAuth authorize URL to log in and grant access to your trading accounts.

  4. 4

    Save the token

    Copy the access token (and refresh token) and store it as CTRADER_ACCESS_TOKEN.

Test the key

Before wiring the key into a strategy, make one request by hand. It separates “the key is wrong” from “my code is wrong”.

1. Connect to demo.ctraderapi.com:5036 (WebSocket, JSON)
2. Send ProtoOAApplicationAuthReq {clientId, clientSecret}
3. Send ProtoOAGetAccountListByAccessTokenReq {accessToken}
An account list response means the credentials work.

Keep the credentials safe

  • Store values in a password manager or a git-ignored .env, never in code or notebooks you share.
  • In an AlgoGP project you can still add them under APIs & keys (encrypted at rest) and read them with strategy_runtime.secrets.get("CTRADER_CLIENT_ID").
  • Give each bot its own credential so you can revoke one without stopping the others.
CTRADER_CLIENT_ID=paste-your-value-here
CTRADER_CLIENT_SECRET=paste-your-value-here
CTRADER_ACCESS_TOKEN=paste-your-value-here
.env for local runs

Frequently asked questions

Do cTrader access tokens expire?

Yes; use the refresh token to obtain a new access token.

Design and backtest your cTrader Open API strategy first

AlgoGP turns an idea into Python and tests it on years of history before you connect it to cTrader Open API. The exported code keeps the broker behind four small adapter methods.

  • AI copilot writes and revises the rules
  • Backtests with realistic costs
  • Exported Python ready to wire to cTrader Open API

Free plan, no card required.

How the cTrader Open API works

AlgoGP is not affiliated with cTrader Open API. Menus get renamed from time to time; if a label differs, the official documentation has the current path.