Skip to Content
API ReferenceAuthentication

Authentication

The Borderbolt API uses OAuth2 Client Credentials flow for authentication. This flow is designed for server-to-server communication where you authenticate using a client ID and client secret.

Obtaining API Credentials

  1. Log in to your Borderbolt account
  2. Navigate to Settings → API Documentation
  3. Click Generate API Credentials
  4. Store your client_id and client_secret securely

Important: The client secret is only shown once. Store it securely - you cannot retrieve it later.

Requesting an Access Token

Use the OAuth2 Client Credentials flow to obtain an access token:

curl -X POST https://app.borderbolt.com/oauth/token \ -H "Content-Type: application/json" \ -d '{ "grant_type": "client_credentials", "client_id": "your-client-id", "client_secret": "your-client-secret", "scope": "declarations:read declarations:write" }'

Request Parameters

ParameterRequiredDescription
grant_typeYesMust be client_credentials
client_idYesYour OAuth2 client ID
client_secretYesYour OAuth2 client secret
scopeNoSpace-separated list of scopes (defaults to all granted scopes)

Response

{ "token_type": "Bearer", "expires_in": 3600, "access_token": "eyJ0eXAiOiJKV1QiLCJhbGc...", "scope": "declarations:read declarations:write" }
FieldDescription
token_typeAlways Bearer
expires_inToken lifetime in seconds (3600 = 1 hour)
access_tokenJWT token to use for API requests
scopeGranted scopes for this token

Using Access Tokens

Include the access token in the Authorization header for all API requests:

curl -X GET https://app.borderbolt.com/api/v1/declarations \ -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGc..." \ -H "Accept: application/json"

Token Management

Get Token Information

Retrieve information about the current access token:

curl -X GET https://app.borderbolt.com/oauth/tokeninfo \ -H "Authorization: Bearer your-access-token"

Response:

{ "client_id": "your-client-id", "scopes": ["declarations:read", "declarations:write"], "expires_at": "2026-03-25T15:30:00.000000Z" }

Revoke Token

Revoke an access token before it expires:

curl -X POST https://app.borderbolt.com/oauth/revoke \ -H "Content-Type: application/json" \ -d '{ "token": "your-access-token" }'

Available Scopes

Scopes control access to specific API resources. Request only the scopes you need.

Declarations

ScopeDescription
declarations:readView declarations and lines
declarations:writeCreate and update declarations
declarations:deleteDelete draft declarations
declarations:submitSubmit declarations to customs

Transit (NCTS5)

ScopeDescription
transit:readView transit declarations
transit:writeCreate and update transit declarations
transit:deleteDelete draft transit declarations

Customers

ScopeDescription
customers:readView customer master data
customers:writeCreate and update customers
customers:deleteDelete customers

Reports

ScopeDescription
reports:readView and run reports
reports:exportExport reports to CSV

Item Master

ScopeDescription
item_master:readView item master data
item_master:writeCreate and update items
item_master:deleteDelete items

Guarantees

ScopeDescription
guarantees:readView guarantee balances and DVA overview

Dossiers

ScopeDescription
dossiers:readView dossiers
dossiers:writeCreate and update dossiers
dossiers:deleteDelete dossiers

Invoices

ScopeDescription
invoices:readView invoices
invoices:writeCreate, update, and finalize invoices
invoices:deleteDelete draft invoices

Best Practices

Token Caching: Access tokens are valid for 1 hour. Cache tokens and reuse them until they expire to minimize token requests.

Secure Storage: Never commit client secrets to version control. Use environment variables or secure credential storage.

Scope Minimization: Request only the scopes your application needs. This follows the principle of least privilege.

Error Responses

Invalid Credentials

{ "error": "invalid_client", "error_description": "Client authentication failed", "message": "Client authentication failed" }

HTTP Status: 401 Unauthorized

Invalid Scope

{ "error": "invalid_scope", "error_description": "The requested scope is invalid, unknown, or malformed", "message": "The requested scope is invalid, unknown, or malformed" }

HTTP Status: 400 Bad Request

Rate Limiting

API requests are rate-limited per client. See the Error Reference for details on rate limit headers and handling 429 responses.

Last updated on