Authenticating on the TransFi API
Every request to the TransFi API must include your credentials. TransFi uses HTTP Basic Authentication — combine your username and password, Base64-encode the result, and include it in an Authorization header on every request.
Basic authentication is a simple authentication scheme built into the HTTP protocol. To use it, send your HTTP requests with an Authorization header that contains the word Basic followed by a space and a base64-encoded string username:password.
Get your credentials: Sign in to displai.transfi.com → Settings → API Credentials.
You have separate credentials for sandbox and production.
Security rule: Credentials must only live in server-side code. Never include them in frontend JavaScript, mobile app bundles, or public repositories. Use environment variables.
Two Environments
| Environment | Base URL | Real Money? | KYB Required? |
|---|---|---|---|
| Sandbox | https://api-sandbox.transfi.com | No — Use Order Status Simulation API | Not Required |
| Production | https://api.transfi.com | Yes | Yes |
How to authenticate — 3 steps
- Combine your credentials with a colon:
username:password - Base64-encode the combined string — most HTTP libraries do this automatically
- Add to every request:
Authorization: Basic
cURL
curl https://api-sandbox.transfi.com/v3/balance \
-u "$TRANSFI_USERNAME:$TRANSFI_PASSWORD"Node.js
const axios = require('axios');
const credentials = Buffer.from(
`${process.env.TRANSFI_USERNAME}:${process.env.TRANSFI_PASSWORD}`
).toString('base64');
const headers = {
'Authorization': `Basic ${credentials}`,
'Content-Type': 'application/json'
};Python
import requests, base64, os
credentials = base64.b64encode(
f"{os.getenv('TRANSFI_USERNAME')}:{os.getenv('TRANSFI_PASSWORD')}".encode()
).decode()
headers = {
'Authorization': f'Basic {credentials}',
'Content-Type': 'application/json'
}Test your connection
curl https://api-sandbox.transfi.com/v3/balance \
-u "$TRANSFI_USERNAME:$TRANSFI_PASSWORD"200 OK = authenticated401 = check your encoding or credential activation at displai.transfi.com.
Updated about 1 month ago
Did this page help you?