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

EnvironmentBase URLReal Money?KYB Required?
Sandboxhttps://api-sandbox.transfi.comNo — Use Order Status Simulation APINot Required
Productionhttps://api.transfi.comYesYes

How to authenticate — 3 steps

  1. Combine your credentials with a colon: username:password
  2. Base64-encode the combined string — most HTTP libraries do this automatically
  3. 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 = authenticated
401 = check your encoding or credential activation at displai.transfi.com.



Did this page help you?