Skip to main content

Update Referral (v1)

Method & Path

PATCH /api/v1/workspace/:workspaceId/referrals/:referralId

Actual backend path: /v1/workspace/:workspaceId/referrals/:referralId

Description

Update an existing referral. All fields are optional - only provided fields will be updated.

Authentication

Required: Workspace authentication with appropriate permissions.

Headers

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

Path Parameters

ParameterTypeRequiredDescription
workspaceIdstringYesWorkspace identifier
referralIdstringYesReferral identifier

Request Body

{
"name": "Jane Doe",
"email": "jane.doe@example.com",
"countryCode": "+1",
"phone": "9876543210",
"whatsappNumber": null
}

Request Body Schema

All fields are optional:

FieldTypeRequiredDescription
namestringNoReferral name (min length: 1 if provided)
emailstringNoValid email address
countryCodestringNoCountry code (min length: 1 if provided)
phonestringNoPhone number (min length: 1 if provided)
whatsappNumberstringNoWhatsApp number (nullable)

Response 200 OK

{
"id": "507f1f77bcf86cd799439011",
"workspaceId": "507f1f77bcf86cd799439012",
"name": "Jane Doe",
"email": "jane.doe@example.com",
"countryCode": "+1",
"phone": "9876543210",
"whatsappNumber": null,
"createdAt": "2024-01-15T10:00:00Z",
"updatedAt": "2024-01-16T10: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 or referral 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