Form Flow
Integrations
APIs
KwikID API Integration Guide
Environments
KwikID provides two environments for integration:
UAT Environment
- Base URL:
https://<YOUR-DOMAIN>.<ENV>.getkwikid.com - Used for testing and development
- Sandbox environment with test data
Production Environment
- Base URL:
https://<YOUR-DOMAIN>.<ENV>.getkwikid.com - Used for live transactions
- Handles real user data
Note: Replace
<YOUR-DOMAIN>from SaaS portal and<ENV>with eithertestfor UAT orappfor Production in all example endpoints below. e.g. BASE-URL = company-domain.test.getkwikid.com
Authentication
Before making any API calls, you'll need to generate an authentication token.
Generate Authentication Token
POST https://<BASE-URL>/agentapi/v1/agent/generate_tokenRequest Headers
{
"accept": "application/json",
"Content-Type": "application/json"
}Request Body
{
"username": "<>",
"password": "<>"
}Example Request
curl -X POST "https://<BASE-URL>/agentapi/v1/agent/generate_token" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"username": "<>",
"password": "<>"
}'Response
The API will return an authentication token that should be used in subsequent requests.
Send Link API
Send a link to a user for various purposes like authentication or verification.
POST https://<BASE-URL>/agentapi/v1/agent/sendLink/Request Headers
{
"auth": "YOUR_AUTH_TOKEN",
"accept": "application/json",
"Content-Type": "application/json"
}Request Body Parameters
| Parameter | Type | Description |
|---|---|---|
| user_id | string | Unique identifier for the user |
| phone_number | string | User's phone number |
| session_type | string | Type of session to create |
| origin | string | Origin of the request |
| send_notification | string | Whether to send notification |
| link_type | string | Type of link to send |
| extras | object | Additional parameters |
Example Request
curl -X POST "https://<BASE-URL>/agentapi/v1/agent/sendLink/" \
-H "auth: YOUR_AUTH_TOKEN" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"user_id": "",
"phone_number": "",
"session_type": "",
"origin": "",
"send_notification": "",
"link_type": "",
"extras": {}
}'Get Session Details
Retrieve details about a specific session.
GET https://<BASE-URL>/agentapi/v1/session/get_details/{session_id}Request Headers
{
"auth": "YOUR_AUTH_TOKEN",
"accept": "application/json"
}Path Parameters
| Parameter | Type | Description |
|---|---|---|
| session_id | string | The ID of the session to retrieve |
Example Request
curl -X GET "https://<BASE-URL>/agentapi/v1/session/get_details/YOUR_SESSION_ID" \
-H "auth: YOUR_AUTH_TOKEN" \
-H "accept: application/json"Environment Variables
For easier environment management, consider using environment variables in your application:
# UAT Environment
KWIKID_API_URL=https://<YOUR-DOMAIN>.test.getkwikid.com
# Production Environment
KWIKID_API_URL=https://<YOUR-DOMAIN>.app.getkwikid.comError Handling
All endpoints may return the following HTTP status codes:
| Status Code | Description |
|---|---|
| 200 | Success |
| 400 | Bad Request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 404 | Not Found |
| 500 | Internal Server Error |
Security Considerations
- Always store authentication credentials securely
- Use HTTPS for all API calls
- Implement proper error handling
- Don't expose authentication tokens in client-side code
- Implement rate limiting in your applications
- Use appropriate credentials for each environment
- Never use production credentials in UAT environment
Best Practices
- Cache authentication tokens appropriately
- Implement retry logic with exponential backoff
- Log all API interactions for debugging
- Validate all input before sending to the API
- Keep your integration code modular and maintainable
- Test thoroughly in UAT before moving to production
- Use environment variables to manage different endpoint URLs
- Implement proper error handling for each environment
Environment-Specific Configurations
Create separate configuration files for each environment:
// config.js
const config = {
uat: {
baseUrl: 'https://<YOUR-DOMAIN>.test.getkwikid.com',
timeout: 30000,
retryAttempts: 3
},
production: {
baseUrl: 'https://<YOUR-DOMAIN>.app.getkwikid.com',
timeout: 15000,
retryAttempts: 5
}
};