API Authentication Flow
Our API platform uses OAuth 2.0 for secure authentication. This section outlines the authentication flow from vendor onboarding to API access.
Authentication Process
The authentication process consists of three main steps:
Detailed Authentication Steps
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.
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
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
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:
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.
Next Steps
Now that you understand the authentication flow, proceed to explore the specific API Endpoints available for your integration.