Authentication Process
The authentication process consists of three main steps:Detailed Authentication Steps
1
Vendor Onboarding & API Credentials
- A vendor is registered internally in the Charp.ai system
- The system provides the vendor with a unique Client ID & Secret Key
- Vendor account is assigned a plan (Free, Standard, Enterprise)
These credentials should be securely stored as they will be required for all API authentication.
2
Authentication & Token Retrieval
- Vendors use their Client ID & Secret to request an access token
- The request is sent to the
/auth/token
endpoint - Upon successful authentication, an access token is returned
Request
Response
3
Accessing APIs
- The access token is included in all API requests via the Authorization header
- The token grants access to Brand, Campaign, and Tools APIs based on the vendor’s plan
- Token validity is checked for each request
Example API Request
Access tokens expire after the time specified in
expires_in
(typically 1 hour). Use the refresh token to obtain a new access token when needed.Token Refresh
When an access token expires, you can use the refresh token to obtain a new one without requiring the client credentials again:Refresh Token Request
Response
Security Best Practices
Store Credentials Securely
Never hardcode credentials in client-side code or version control systems.
Implement Token Rotation
Regularly refresh tokens and implement proper token lifecycle management.
Use HTTPS
Always use HTTPS for all API communication to ensure data encryption.
Validate Responses
Always validate API responses and implement proper error handling.