400 UNSUPPORTED_BROKER.
We recommend connecting a broker in the Itoflow app, which guides you through each broker’s steps. The endpoints below do the same thing.
Connect
POST /brokers/connect with "broker_type": "trading212". Send your API key and secret as api_key and api_secret, and a permissions object. The key needs all eight permissions set to true: metadata, account_data, portfolio, orders_execute, orders_read, history_orders, history_transactions and history_dividends. If any is missing, you get 400 MISSING_REQUIRED_PERMISSIONS with the missing ones in details. The call connects straight away and returns connection_id, sync_status and portfolio_id. Treat the key and secret like passwords: load them from a secret store, never from source code, and don’t log them.
Then poll GET /brokers/{connectionId}/status until the connection is ready. A successful connect doesn’t mean holdings have synced yet.
Read
Reconnect
When the status says a reconnect is needed, callPOST /brokers/{connectionId}/reconnect. Trading 212 also has:
POST /brokers/{connectionId}/trading212/reconnectto reconnect with a new key and secret.POST /brokers/{connectionId}/trading212/reconnect-storedto retry with the key Itoflow already holds.POST /brokers/trading212/connect-manual, another way to connect with an API key.
Disconnect
DELETE /brokers/{connectionId} disconnects the account. The response doesn’t tell you what happened to open positions or orders, so first check any live portfolio that uses the connection and cancel its pending trades.
A connection ID only works for the account that owns it.
See the broker endpoint reference for each broker’s fields and errors.