API Overview
The Perfex CRM SaaS Module includes a REST API that allows you to manage your SaaS platform programmatically. This is useful for:
- Custom signup pages - Build your own registration flow
- Third-party integrations - Connect with external tools (Zapier, Integromat, custom apps)
- Billing automation - Sync with external billing systems
- Monitoring - Build custom dashboards and monitoring tools
- Mobile apps - Create mobile management interfaces
Getting Started with the APIโ
Step 1: Enable the APIโ
- Go to SaaS Management โ SuperAdmin Settings
- Click the API Settings tab
- Toggle the API ON
- Generate an API token
Step 2: Authenticationโ
All API requests require authentication via a Bearer token in the request header:
Authorization: Bearer YOUR_API_TOKEN_HERE
Step 3: Base URLโ
Your API base URL is:
https://yoursite.com/api/saas/
Replace yoursite.com with your actual domain.
Quick Exampleโ
Here's a quick example of creating a tenant via the API:
curl -X POST https://yoursite.com/api/saas/tenants \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"company_name": "Acme Corp",
"email": "[email protected]",
"first_name": "John",
"last_name": "Doe",
"plan_id": 1,
"subdomain": "acme"
}'
Response:
{
"success": true,
"tenant_id": 42,
"domain": "acme.yoursite.com",
"message": "Tenant created successfully"
}
API Capabilitiesโ
| Endpoint Group | What You Can Do |
|---|---|
| Tenants | Create, read, update, delete tenants |
| Plans | List, create, update plans |
| Subscriptions | Manage tenant subscriptions |
| Usage | Query tenant usage and quotas |
For the complete list of endpoints, see the API Reference.
Rate Limitingโ
The API implements rate limiting to protect your server:
- 100 requests per minute per API token
- Rate limit headers are included in every response
If you exceed the rate limit, you'll receive a 429 Too Many Requests response.
Best Practicesโ
- Keep your API token secret - Never expose it in client-side code or public repositories
- Use HTTPS - Always make API requests over HTTPS
- Handle errors gracefully - Check response status codes and handle errors appropriately
- Cache when possible - Don't query the same data repeatedly; cache responses when they don't change often
info
Need a custom integration? If the API doesn't cover your use case, contact us through support. We're constantly expanding the API based on customer feedback.