DHUBiC
Sign InGet Started
API Reference/Authentication
Authentication Guide

Authenticating API Requests

Bearer tokens, OAuth 2.0 flows, scopes, token refresh, and rate limits. Everything you need to securely call any DHUBiC API endpoint.

01

Overview

DHUBiC supports two primary authentication mechanisms. Choose the one that fits your integration type:

🔑

Bearer Token (JWT)

Short-lived tokens obtained via POST /api/login. Best for server-to-server integrations and scripts.

🔐

OAuth 2.0

Delegated access for third-party apps. Users authorise your app without sharing credentials.

All API traffic must be sent over HTTPS. Requests over plain HTTP are rejected with 400 Bad Request.
02

Bearer Token (JWT)

Attach your token in the Authorization header of every request:

Authorization: Bearer <your-token>
  • Tokens expire after 24 hours by default.
  • Workspace admins can configure shorter TTLs (minimum 15 minutes).
  • Service accounts can request non-expiring tokens with restricted scopes.
03

Obtaining a Token

Call POST/api/login with your credentials. The response includes both an access_token and a refresh_token.

POST/api/loginRequest / Response

Request body

{
  "email": "you@company.com",
  "password": "••••••••"
}

200 Response

{
  "access_token": "eyJhbGci...",
  "refresh_token": "drt_01hwz...",
  "expires_in": 86400
}
04

Making Authenticated Requests

Include these headers on every API call:

HeaderRequiredValue
AuthorizationYesBearer <token>
Content-TypePOST/PUTapplication/json
AcceptNoapplication/json
X-Request-IDNoUUID for idempotency
05

OAuth 2.0

Use OAuth 2.0 when building integrations that act on behalf of users. DHUBiC implements the Authorization Code flow with PKCE.

1

Redirect to DHUBiC

Send the user to the authorization endpoint with client_id, redirect_uri, scope, and PKCE challenge.

2

User authorises

DHUBiC shows a consent screen. On approval the user is redirected back with a one-time authorization code.

3

Exchange for token

POST /accounts/auth/oauth/token with the code and PKCE verifier to receive access + refresh tokens.

4

Use the token

Include the access token in your Authorization header exactly like a password login token.

5

Refresh when needed

Before expiry, POST /accounts/auth/oauth/refresh with your refresh token to obtain a fresh pair.

06

Scopes & Permissions

Specify the minimum scopes your application needs when requesting OAuth access:

ScopeAccess granted
payments:readView payments and beneficiaries
payments:writeCreate and approve payments
rates:readRead FX rates and rate history
accounts:readView account balances and statements
reporting:readAccess reports and analytics
workspace:adminFull workspace administration
Principle of least privilege: request only the scopes your integration actually needs. Workspace admins can audit and revoke individual scopes at any time.
07

Error Handling

Authentication failures return standard HTTP status codes with a JSON error body:

401
Unauthorized

Token is missing, expired, or malformed. Re-authenticate to obtain a new token.

403
Forbidden

Token is valid but lacks the required scope. Request additional permissions from the workspace admin.

429
Too Many Requests

Rate limit exceeded. Back off and retry after the interval in the Retry-After response header.

Error response body
{
  "error": "unauthorized",
  "message": "Token has expired",
  "status": 401
}
08

Rate Limits

Every API response includes rate limit headers. Default limit is 1,000 requests / minute per workspace.

Response headers
X-RateLimit-Limit:     1000
X-RateLimit-Remaining: 987
X-RateLimit-Reset:     1717027200
Retry-After:           60
When you receive a 429 response, wait the number of seconds specified in Retry-After before retrying. Repeated immediate retries will not restore the limit faster.
09

SDK Quickstart

Authenticate and make your first API call in under a minute:

api.dhubic.com/v1
# 1. Obtain a token
curl -s -X POST https://api.dhubic.com/v1/api/login \
  -H "Content-Type: application/json" \
  -d '{"email":"you@company.com","password":"••••••••"}' \
  | jq -r '.access_token'

# 2. Use the token
TOKEN="eyJhbGciOiJSUzI1NiJ9..."

curl https://api.dhubic.com/v1/payments \
  -H "Authorization: Bearer $TOKEN" \
  -H "Accept: application/json"

Ready to explore endpoints?

Browse the full API reference to see all available operations.

Browse APIs →