Skip to main content

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

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token: Bearer <token>
Content-TypestringYesapplication/json

Path Parameters

ParameterTypeRequiredDescription
workspaceIdstringYesWorkspace identifier

Request Body

{
"name": "John Doe",
"email": "john.doe@example.com",
"countryCode": "+1",
"phone": "1234567890",
"whatsappNumber": "+11234567890"
}

Request Body Schema

FieldTypeRequiredDescription
namestringYesReferral name (min length: 1)
emailstringYesValid email address
countryCodestringYesCountry code (min length: 1)
phonestringYesPhone number (min length: 1)
whatsappNumberstringNoWhatsApp 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