Partners can open a WebSocket connection to receive real-time events for a specific client — for example when an order is placed, a transaction settles, or a journey completes.
Open a WebSocket to:
- Sandbox –
wss://api.sandbox.fondo.se/v2/partner/client/{clientId}/subscribe - NPC –
wss://api.npc.fondo.se/v2/partner/client/{clientId}/subscribe - Production –
wss://api.fondo.se/v2/partner/client/{clientId}/subscribe
Use the wss:// scheme — TLS is required.
On success the server sends a hello event:
{ "eventType": "hello", "instanceId": "…" }Authenticate the WebSocket handshake with the same OAuth2 bearer token used for REST requests, sent as an Authorization: Bearer <token> header on the upgrade request:
GET /v2/partner/client/{clientId}/subscribe HTTP/1.1
Host: api.sandbox.fondo.se
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: <client-generated nonce>
Authorization: Bearer <YOUR_TOKEN_HERE>The token is checked once at handshake time. The connection then stays open until either side closes it — it is not severed when the token's session TTL expires, so you do not need to reconnect on token refresh.
Browsers cannot set the Authorization header on the WebSocket handshake. Connect from a backend.
If your partner account uses IP allowlisting, the source IP of the WebSocket handshake must also be on the allowlist; otherwise the upgrade is rejected with 403.
| You see | Cause |
|---|---|
404 Not Found on a plain GET | The endpoint only responds to a WebSocket handshake. Sending a normal GET (curl, Postman, browser navigation, the API Reference "Try it" button) returns 404. Use a WebSocket client. |
400 on the upgrade | Missing or malformed Authorization header. |
401 on the upgrade | Token is invalid, expired, or doesn't belong to a session. Re-fetch a token via Authentication. |
403 on the upgrade | The token's partner does not own clientId, or your source IP is not allowlisted. |
The server sends a heartbeat event roughly every five seconds to keep the connection alive:
{ "eventType": "heartbeat" }Every event is a JSON object with an eventType field. Events that carry data also include a payload object:
.createevents containpayload.current— the created resource..updateevents containpayload.currentandpayload.previous— the resource after and before the change..deleteevents containpayload.previous— the resource that was removed..correctevents containpayload.currentandpayload.previous— the correcting transaction and the one it replaces.
Example:
{
"eventType": "order.create",
"eventId": "6f1c2a4e-…",
"payload": {
"current": { "id": "abc123", "status": "received", "…": "…" }
}
}| Event type | Trigger |
|---|---|
account.create | Account created, or your client got access to it |
account.update | Account updated, including its balance, bank accounts, autogiro mandates and company owner details |
account.delete | Account deleted, or your client lost access to it |
client.update | Client updated |
client.delete | Client deleted |
order.create | Order created |
order.update | Order updated |
order.delete | Order canceled |
cashTransaction.create | Cash transaction created |
cashTransaction.update | Cash transaction updated |
cashTransaction.correct | Cash transaction replaced by a correction |
cashTransaction.delete | Cash transaction aborted, for example when its order is canceled |
fundTransaction.create | Fund transaction created |
fundTransaction.update | Fund transaction updated |
fundTransaction.correct | Fund transaction replaced by a correction |
fundTransaction.delete | Fund transaction aborted, for example when its order is canceled |
journey.update | Journey updated |
instrument.reloaded | Fund data refreshed for all instruments |
Each connection receives events for the clientId in the URL only. The exception is instrument.reloaded, which is broadcast to all connections.
The server may close the connection at any time (for example during a deployment) with close code 1001, and sends a server_closing event about two seconds before a planned close. The load balancer also closes every connection after about an hour, without warning. Clients should implement reconnection with exponential back-off. To avoid gaps, open the new connection before the old one closes, and expect some events twice while both are open.
There is no event replay or sequence numbering. Any state you missed during the disconnect must be reconciled via the REST API — for example by re-fetching orders modified since your last known timestamp. Treat the WebSocket as a low-latency notifier, not as a durable event log.
- Sandboxhttps://api.sandbox.fondo.se/v2/partner/client/{clientId}/subscribe
- NPChttps://api.npc.fondo.se/v2/partner/client/{clientId}/subscribe
- Productionhttps://api.fondo.se/v2/partner/client/{clientId}/subscribe
curl -i -N --http1.1 \
-H "Connection: Upgrade" \
-H "Upgrade: websocket" \
-H "Sec-WebSocket-Version: 13" \
-H "Sec-WebSocket-Key: $(openssl rand -base64 16)" \
-H "Authorization: Bearer <YOUR_TOKEN_HERE>" \
https://api.sandbox.fondo.se/v2/partner/client/<CLIENT_ID>/subscribeSee the getWebsocket operation in the API Reference for the full event schema and response codes.