The Comserv API provides programmatic access to system functionality, allowing developers to:
- Retrieve and manipulate data
- Integrate with external systems
- Extend platform functionality
- Automate workflows
- Build custom interfaces
The Comserv API provides programmatic access to system functionality, allowing developers to:
Administrator Action: You can manage API credentials through the API Credentials Management interface. See the API Credentials Documentation for more details.
The API supports two authentication methods:
POST /api/v1/oauth/token
Content-Type: application/x-www-form-urlencoded
grant_type=client_credentials&
client_id=YOUR_CLIENT_ID&
client_secret=YOUR_CLIENT_SECRET
Response (example):
{
"access_token": "[JWT_TOKEN_EXAMPLE]",
"token_type": "Bearer",
"expires_in": 3600,
"scope": "read write"
}
Use the access token in subsequent requests:
GET /api/v1/users
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Include your API key in the request header:
GET /api/v1/users
X-API-Key: YOUR_API_KEY
GET /api/v1/users
Query parameters:
page: Page number (default: 1)limit: Results per page (default: 20, max: 100)role: Filter by role (optional)status: Filter by status (optional)Response:
{
"data": [
{
"id": 1,
"username": "johndoe",
"email": "[email protected]",
"role": "editor",
"status": "active",
"created_at": "2023-01-15T08:30:00Z",
"last_login": "2023-05-20T14:22:10Z"
},
...
],
"meta": {
"current_page": 1,
"total_pages": 5,
"total_count": 98
}
}
GET /api/v1/users/{id}
Response:
{
"id": 1,
"username": "johndoe",
"email": "[email protected]",
"role": "editor",
"status": "active",
"created_at": "2023-01-15T08:30:00Z",
"last_login": "2023-05-20T14:22:10Z",
"profile": {
"first_name": "John",
"last_name": "Doe",
"phone": "+1234567890",
"bio": "System editor and content manager"
}
}
POST /api/v1/users
Content-Type: application/json
{
"username": "newuser",
"email": "[email protected]",
"password": "securepassword",
"role": "normal",
"profile": {
"first_name": "New",
"last_name": "User"
}
}
Response:
{
"id": 99,
"username": "newuser",
"email": "[email protected]",
"role": "normal",
"status": "active",
"created_at": "2023-05-21T10:15:30Z"
}
GET /api/v1/documents
Query parameters:
page: Page number (default: 1)limit: Results per page (default: 20, max: 100)category: Filter by category (optional)status: Filter by status (optional)Response:
{
"data": [
{
"id": 1,
"title": "Annual Report 2023",
"category": "reports",
"status": "published",
"created_at": "2023-03-15T08:30:00Z",
"updated_at": "2023-03-16T14:22:10Z",
"author_id": 5
},
...
],
"meta": {
"current_page": 1,
"total_pages": 8,
"total_count": 156
}
}
The API uses standard HTTP status codes and returns detailed error information:
{
"error": {
"code": "invalid_request",
"message": "The request is missing a required parameter",
"details": "The 'email' field is required"
}
}
Common error codes:
invalid_request: Missing or invalid parametersauthentication_failed: Invalid credentialspermission_denied: Insufficient permissionsresource_not_found: Requested resource doesn't existrate_limit_exceeded: Too many requestsAPI requests are subject to rate limiting:
Rate limit headers are included in all responses:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1621612345
user.created: New user registrationuser.updated: User profile updatedocument.created: New document createddocument.updated: Document updateddocument.published: Document published
{
"event": "document.published",
"timestamp": "2023-05-21T15:32:10Z",
"data": {
"id": 42,
"title": "New Policy Document",
"category": "policies",
"status": "published",
"author_id": 5
}
}
Each webhook includes an X-Webhook-Signature header containing an HMAC-SHA256 signature.
Verify this signature using your webhook secret to ensure the request is authentic.
Official client libraries:
The API uses versioning in the URL path (e.g., /api/v1/). When breaking changes are introduced,
a new version will be released. We maintain backward compatibility for at least 12 months after a new version is released.
For API support:
We welcome feedback and feature requests for the API.