Update Workspace Referral (v1)
Method & Path
PATCH /api/v1/admin/workspaces/:workspaceId/referral
Description
Assign or remove a referral from a workspace (client account).
Backend path: /v1/admin/workspaces/:workspaceId/referral
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 |
|---|---|---|---|
workspaceId | string | Yes | Workspace ID |
Request Body
{
"referralId": "65f1c1a2b3c4d5e6f7a8b901"
}
| Field | Type | Required | Description |
|---|---|---|---|
referralId | string | null | Yes | Referral ID to assign, or null to remove |
Response 200 OK
{
"message": "Referral updated successfully",
"workspace": {
"id": "65f1c1a2b3c4d5e6f7a8b902",
"name": "Clinic One",
"email": "clinic@example.com",
"referralId": "65f1c1a2b3c4d5e6f7a8b901",
"createdAt": "2025-01-01T00:00:00.000Z",
"updatedAt": "2025-01-10T00:00:00.000Z"
}
}
Common Errors
- 400 Bad Request: Invalid workspace or referral ID
- 401 Unauthorized: Missing or invalid admin authentication token
- 403 Forbidden: Insufficient permissions
- 404 Not Found: Workspace or referral not found
- 500 Internal Server Error: Server error