Quickstart
The TBNS API provides a RESTful interface for managing users, points, and transactions. The API supports both development (sandbox) and production environments.
Base URL
https://api.tbns.io/functions/v1/api
Environment Switching
Development/Sandbox Mode
Add ?dev=true
parameter to any endpoint to use the development environment:
curl -X GET "https://api.tbns.io/functions/v1/api/partner?dev=true"
-H "Content-Type: application/json"
-H "Authorization: Bearer ...."
You can onboard yourself to the sandbox via: https://app.tbns.io/version-test/apply
Authentication
All API requests require two headers:
Authorization Header: static key
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Imh3a2htcWF2enphaWVvdmtvdHdiIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDMwMDA3NDAsImV4cCI6MjA1ODU3Njc0MH0.nKjMLLZ7cY92nchtE2mFtBCOMqb0WWbiqkekaMqVFMU
X-Token Header: authentication token (obtained from login)
X-Token: [YOUR_AUTH_TOKEN]
To get your authentication token, make the following request:
curl -X POST "https://api.tbns.io/functions/v1/api/login" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Imh3a2htcWF2enphaWVvdmtvdHdiIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDMwMDA3NDAsImV4cCI6MjA1ODU3Njc0MH0.nKjMLLZ7cY92nchtE2mFtBCOMqb0WWbiqkekaMqVFMU" \
-d '{"email": "test@company.com", "password": "test1234"}'
Creating Users
To create a new user in the system:
curl -X POST "https://api.tbns.io/functions/v1/api/users/create" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Imh3a2htcWF2enphaWVvdmtvdHdiIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDMwMDA3NDAsImV4cCI6MjA1ODU3Njc0MH0.nKjMLLZ7cY92nchtE2mFtBCOMqb0WWbiqkekaMqVFMU" \
-H "X-Token: X-TOKEN" \
-d '{
"email": "user@company.com",
"first_name": "John",
"last_name": "Doe"
}'
Points Management
Creating Points
You can create points with an initial "Open" status:
curl -X POST "https://api.tbns.io/functions/v1/api/points/create" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Imh3a2htcWF2enphaWVvdmtvdHdiIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDMwMDA3NDAsImV4cCI6MjA1ODU3Njc0MH0.nKjMLLZ7cY92nchtE2mFtBCOMqb0WWbiqkekaMqVFMU" \
-H "X-Token: X-TOKEN" \
-d '{
"subid": "order-12345",
"amount": 100,
"user_view_text": "Points for completing survey",
"user_id": "1749801330826x541366778024405570"
}'
Approving Points
To approve pending points, use the PATCH endpoint:
curl --location --request PATCH 'https://api.tbns.io/functions/v1/api/points/update' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Imh3a2htcWF2enphaWVvdmtvdHdiIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDMwMDA3NDAsImV4cCI6MjA1ODU3Njc0MH0.nKjMLLZ7cY92nchtE2mFtBCOMqb0WWbiqkekaMqVFMU' \
--header 'X-Token: X-TOEKN' \
--header 'Content-Type: application/json' \
--data '{
"point_id": "1749807859784x717369051962552600",
"status": "Pending"
}'
Best Practices
Authentication
Store authentication tokens securely
Implement token refresh mechanisms
Handle authentication errors appropriately
User Management
Store user IDs in your system
Validate user creation responses
Maintain proper tenant associations
Points System
Implement proper error handling for point creation
Keep track of point mint IDs
Consider implementing a queue system for point approval
Remember that pending points cannot be modified
Integration Flow
Authenticate with the system
Create user accounts as needed
Generate points in "Open" status
Approve points when appropriate
Monitor point status changes
Last updated