Admin
API Integration for Approvals
Use the API to programmatically manage policy approvals from external systems.
API Integration for Approvals
CertAssure provides API endpoints for external systems to manage approvals.
Overview
The Approval API allows SingleFlow and other integrations to:
- Query pending approvals
- Update approval status programmatically
- Sync approvals with external systems
Authentication
API requests require authentication using Laravel Sanctum tokens.
Headers:
Authorization: Bearer <your_api_token>
Content-Type: application/json
Accept: application/json
Available Endpoints
Get Pending Approvals
GET /api/v1/approvals/pending
Returns all pending approval requests that can be processed.
Update Approval Status
PATCH /api/v1/approvals/{approver_id}
Update an approver's status (approve or reject).
Request body:
{
"status": "approved",
"comments": "Approved via automated workflow"
}
Workflow Example
A typical SingleFlow workflow:
- Trigger: Receive webhook when approval is requested
- Action: Send notification to approver via email/Slack
- Wait: Approver clicks approve/reject link in message
- Action: Call API to update approval status
- Complete: CertAssure updates the policy
External Approval Links
For external approvers, CertAssure generates unique approval links:
https://your-domain.com/approve/{token}
These links:
- Are valid for 30 days
- Can only be used once
- Don't require login
- Expire after use
Error Handling
API errors return standard HTTP status codes:
| Code | Meaning |
|---|---|
| 200 | Success |
| 401 | Unauthorized (invalid token) |
| 403 | Forbidden (insufficient permissions) |
| 404 | Approver not found |
| 422 | Validation error |
Rate Limiting
API requests are rate-limited to prevent abuse:
- 60 requests per minute per token
- 429 status returned when exceeded
Best Practices
- Store API tokens securely
- Handle errors gracefully in workflows
- Log all API interactions
- Use test environment for development
- Refresh tokens periodically