Docs menu
Get started
Using the API
API reference
Classification
Landed cost
Compliance
- POSTRegulate: find an agency product code
- POSTCheck restricted goods
- GETRestricted-goods checks
- GETAgency filing checks
- POSTCheck agency filings (Comply)
- POSTCross: classify, restrict, comply, regulate and calculate in one call
- GETYour restricted-goods rules
- POSTAdd a restricted-goods rule
- DELETERemove a restricted-goods rule
- POSTScreen a person or company
- GETYour screening checks
Reference
Origin
Shipping documents
Bulk
Catalogue
- GETList products
- POSTCreate a product
- GETGet a product
- PATCHUpdate a product
- POSTArchive a product
- GETA product’s history
- GETA product’s codes
- POSTAdd a code
- POSTSuggest codes
- POSTApprove a code
- POSTReject a code
- POSTClassify many products
- GETYour imports
- POSTImport a CSV file
- GETAn import
- GETExport as CSV
- POSTSync records from a source
- GETApproved codes to write back
- GETCatalogue vocabularies
- GETSource kinds
- GETDefault target markets
- POSTSet default target markets
Authentication
Authenticate border.bot REST calls with API client access tokens and scopes, and MCP clients with OAuth 2.1.
API clients#
REST calls authenticate with an access token issued to one of your workspace's API clients.
Create an API client in the dashboard under Developers → API clients. You get a client ID (client_…) and a client secret. The secret is shown once and border.bot never stores it, so put it in your secrets manager straight away. A client can have an expiry (30, 90 or 365 days, or never), and a workspace can have up to 25 active clients.
Trade the client ID and secret for an access token at https://api.border.bot/oauth2/token:
curl -X POST https://api.border.bot/oauth2/token \
-d grant_type=client_credentials \
-d client_id="$BORDERBOT_CLIENT_ID" \
-d client_secret="$BORDERBOT_CLIENT_SECRET"The response has access_token and expires_in (about an hour). Send the token in the Authorization header:
Authorization: Bearer <access_token>Fetch a new token before the old one expires, or after a 401. A missing, invalid or expired token, or a token from a revoked or expired client, gets 401 unauthorized with a WWW-Authenticate: Bearer header.
Admins can rotate a client's secret (the old secret stops working at once) or revoke the client (it stops at once, including tokens it already holds).
Scopes#
An API client has full access, or only the scopes you pick when you create it. Each endpoint in the reference names the scope it needs. A client without that scope gets 403 forbidden with details.reason set to missing_scope, and the message says which scope is missing ("This API client can’t use …").
| Scope | Allows |
|---|---|
classify |
Classification: Classify products (single and batch), agency product codes, and feedback on answers. |
calculate |
Landed cost: Landed cost for a line or a whole shipment, and duty stacking. |
origin |
Products and origin: Read product pages, work out or check the country of origin, and inspect photos of goods (Inspect). |
compliance |
Compliance checks: Restricted goods checks and denied-party screening, with the screening history. |
catalog |
Product catalogue: Read and change the workspace’s catalogue: products, their content and sources, codes per market (review and approval), imports, exports and syncs. Suggesting codes also needs Classification. |
bulk |
Bulk runs: Start, follow and cancel bulk runs. A run also needs the scope of what it runs: Classification, or Landed cost. |
documents |
Shipping documents: Generate air waybills (master and house) and commercial or pro forma invoices as PDF. |
settings |
Workspace rules: Read and change blocked codes and restriction rules. |
account |
Account: Credit balance, ledger and usage history. |
GET /v1/me works with any client's token and reports the client under client, with its scopes and expiresAt.
Endpoints without authentication#
These reference endpoints are public and rate limited per IP address:
GET /v1/countries: destinations and what each one supports.GET /v1/pricing: what every action costs in credits.GET /v1/classify/modes: the classification modes you can choose.
MCP clients: OAuth 2.1#
The MCP server at https://mcp.border.bot/mcp doesn't need an API client. MCP clients sign the user in with OAuth 2.1 (authorization code with PKCE S256):
- Clients can register themselves with dynamic client registration (
POST https://mcp.border.bot/oauth/register, RFC 7591) or use a client ID metadata document. - Scopes:
mcp:readto read,mcp:writeto run actions that spend credits. - Discovery: protected resource metadata (RFC 9728) and authorization server metadata (RFC 8414).
Agents that register themselves should read auth.md.
Keeping credentials safe#
- Call the API from your server, never from a browser or a mobile app.
- Give each integration its own API client with only the scopes it needs, so you can revoke one without breaking the others.
- Every call is in the workspace's request log (
GET /v1/requests, 30 days), with the API client that made it.
Last updated