Connect your app to Unlok with OAuth2 or Personal Access Tokens. Trading, portfolio management, and more - all through a secure, production-ready API.
The Unlok API allows third-party vendors to build integrations that access user data with their explicit consent. We use OAuth 2.0 with PKCE (Proof Key for Code Exchange) to ensure secure authorization.
This guide walks you through the complete integration process:
To get started with the Unlok API, send us the details below via email to developers@unlok.com. Our team will review your submission and follow up with your credentials.
Include the following about your company:
Tell us about the application you'd like to integrate:
read:accounts - Read account details and profilewrite:accounts - Update account settingsread:orders - View orders and trade historywrite:orders - Place and manage ordersread:banking - View banking and funding detailswrite:banking - Manage banking and fundingclientId and clientSecret, along
with separate redirect URIs.
clientId and
clientSecret at your business email to get started with development and testing.
For complete API documentation with request/response schemas, see the OpenAPI specification.
Personal Access Tokens (PATs) provide a simple way to authenticate with the Unlok API for your own account. Unlike OAuth2, which is designed for third-party apps acting on behalf of users, PATs are meant for direct, personal use - scripts, automation, CLI tools, or programmatic access to your own data.
With a PAT you can:
Navigate to app.unlok.com/developer and open the Personal Access Tokens section.
When creating a new token, you will need to provide the following:
READ_WRITE - Full access (GET, POST, PUT, DELETE)READ_ONLY - Read-only access (GET, HEAD, OPTIONS only)After creation, you will be shown your token once. It will not be displayed again. Copy it and store it securely - you will use the entire token string to authenticate.
To authenticate, call the POST /pat/login endpoint with your token. This exchanges your PAT
for a short-lived session token (JWT) that you use for subsequent API requests.
const response = await fetch('https://api.unlok.com/pat/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
token: 'your-tokenId.your-secret'
})
});
const { userId, token } = await response.json();
// `token` is a JWT session token - use it for API calls
curl -X POST https://api.unlok.com/pat/login \
-H "Content-Type: application/json" \
-d '{"token": "a1b2c3d4-e5f6-7890-abcd-ef1234567890.4f8c9a2b..."}'
Response:
{
"userId": "usr_abc123",
"token": "eyJhbGciOiJIUzI1NiIs..."
}
Use the JWT returned from /pat/login in the Authorization header for all
subsequent API calls:
curl https://api.unlok.com/accounts \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..."
const session = await fetch('https://api.unlok.com/pat/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ token: process.env.UNLOK_PAT })
}).then(r => r.json());
const accounts = await fetch('https://api.unlok.com/accounts', {
headers: { 'Authorization': `Bearer ${session.token}` }
}).then(r => r.json());
import os, requests
pat = os.environ["UNLOK_PAT"]
# Authenticate
session = requests.post("https://api.unlok.com/pat/login", json={"token": pat})
jwt_token = session.json()["token"]
# Make API calls
headers = {"Authorization": f"Bearer {jwt_token}"}
accounts = requests.get("https://api.unlok.com/accounts", headers=headers)
print(accounts.json())
The only public endpoint for Personal Access Tokens is the login endpoint used to exchange your PAT for a session token. All other token management (create, list, revoke) is done through the Unlok dashboard at app.unlok.com/developer.
Exchange your Personal Access Token for a short-lived JWT session token.
READ_ONLY scope unless your integration needs to create or modify
data.
/pat/login-activity periodically for
unexpected access patterns.
POST /pat/revoke with the token's ID. Revocation takes effect immediately and invalidates
all active sessions created from that token.