Create Referral (v1)
Method & Path
POST /api/v1/workspace/:workspaceId/referrals
Actual backend path: /v1/workspace/:workspaceId/referrals
Description
Create a new referral for a workspace.
Authentication
Required: Workspace authentication with appropriate permissions.
Headers
| Header | Type | Required | Description |
|---|---|---|---|
Authorization | string | Yes | Bearer token: Bearer <token> |
Content-Type | string | Yes | application/json |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
workspaceId | string | Yes | Workspace identifier |
Request Body
{
"name": "John Doe",
"email": "john.doe@example.com",
"countryCode": "+1",
"phone": "1234567890",
"whatsappNumber": "+11234567890"
}
Request Body Schema
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Referral name (min length: 1) |
email | string | Yes | Valid email address |
countryCode | string | Yes | Country code (min length: 1) |
phone | string | Yes | Phone number (min length: 1) |
whatsappNumber | string | No | WhatsApp number (nullable) |
Response 201 Created
{
"id": "507f1f77bcf86cd799439011",
"workspaceId": "507f1f77bcf86cd799439012",
"name": "John Doe",
"email": "john.doe@example.com",
"countryCode": "+1",
"phone": "1234567890",
"whatsappNumber": "+11234567890",
"createdAt": "2024-01-15T10:00:00Z",
"updatedAt": "2024-01-15T10:00:00Z"
}
Common Errors
- 400 Bad Request: Invalid request body or validation error
- 401 Unauthorized: Missing or invalid authentication token
- 403 Forbidden: Insufficient permissions
- 404 Not Found: Workspace not found
- 409 Conflict: A referral with this email already exists
- 422 Unprocessable Entity: Validation error (e.g., invalid email format)
- 500 Internal Server Error: Server error