Delete Agency
Delete an agency and all associated data.
WARNING
Requires super-admin or partner role.
DANGER
This action is irreversible and will delete all vehicles, bookings, and client data associated with the agency.
Endpoint
INFO
DELETE /api/v1/dashboard/agencies/{agency}
Headers
| Header | Value | Required |
|---|---|---|
Accept | application/json | Yes |
Authorization | Bearer {token} | Yes |
Path Parameters
| Parameter | Type | Description |
|---|---|---|
agency | integer | Agency ID |
Example Request
bash
curl -X DELETE https://api.daakey.com/api/v1/dashboard/agencies/1 \
-H "Accept: application/json" \
-H "Authorization: Bearer {token}"Response
Success (200)
json
{
"success": true,
"message": "Agency deleted",
"data": null,
"request_id": "uuid",
"timestamp": "2024-01-01T00:00:00.000Z"
}Error (400)
json
{
"success": false,
"message": "Cannot delete agency",
"data": {
"reason": "Agency has active bookings",
"active_bookings": 3
},
"request_id": "uuid",
"timestamp": "2024-01-01T00:00:00.000Z"
}Notes
- Agencies with active bookings cannot be deleted
- Consider deactivating instead of deleting