List Referral Workspaces (v1)
Method & Path
GET /api/v1/admin/referrals/:referralId/workspaces
Description
List all workspaces registered under a referral, including subscription payment share amounts.
Backend path: /v1/admin/referrals/:referralId/workspaces
Authentication
Required: Admin authentication with businesses.manage permission.
Authorization: Bearer <admin_token>
Headers
Authorization: Bearer <admin_token>
Content-Type: application/json
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
referralId | string | Yes | Referral ID |
Request Body
None.
Response 200 OK
{
"referral": {
"id": "65f1c1a2b3c4d5e6f7a8b901",
"name": "Ahmed Ali",
"phone": "0599123456",
"sharePercentage": 10,
"createdBy": "65aab1c2d3e4f5a6b7c8d901",
"createdAt": "2025-01-15T10:00:00.000Z",
"updatedAt": "2025-01-15T10:00:00.000Z"
},
"workspaces": [
{
"id": "65f1c1a2b3c4d5e6f7a8b902",
"name": "Clinic One",
"email": "clinic@example.com",
"subscriptionEndDate": "2025-02-01T00:00:00.000Z",
"totalSubscriptionAmount": 199,
"totalShareAmount": 19.9,
"payments": [
{
"id": "65f1c1a2b3c4d5e6f7a8b903",
"amount": 199,
"paymentDate": "2025-01-01T00:00:00.000Z",
"shareAmount": 19.9,
"metadata": {
"period": "monthly"
}
}
]
}
]
}
Common Errors
- 400 Bad Request: Invalid referral ID
- 401 Unauthorized: Missing or invalid admin authentication token
- 403 Forbidden: Insufficient permissions
- 404 Not Found: Referral not found
- 500 Internal Server Error: Server error