Delete Policy
Sprint 3
Delete a policy (soft delete). Sets deleted_at timestamp but does not permanently remove from database.
Endpoint
DELETE /api/v1/policies/{policy_id}
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer <access_token> |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
policy_id | integer | Yes | Policy ID |
Response
Success (200)
{
"success": true,
"data": {
"policy_id": 1,
"deleted_at": "2024-12-01T11:00:00Z"
},
"message": "Policy deleted successfully"
}
Error Codes
| Status | Code | Description |
|---|---|---|
| 401 | UNAUTHORIZED | Invalid or missing authentication token |
| 404 | NOT_FOUND | Policy not found |
Features
- Soft delete (sets
deleted_attimestamp) - Organization-scoped access control
- Policy is not permanently removed from database
Important Notes
- This is a soft delete - the policy is marked as deleted but not permanently removed
- Deleted policies are excluded from normal queries
- Can be restored if needed (implementation-dependent)
Example
curl -X DELETE "https://api.rivergen.com/api/v1/policies/1" \
-H "Authorization: Bearer <access_token>"
Related Endpoints
- List Policies - List all policies (excludes deleted by default)
- Get Policy - Get policy details