Skip to main content

Update Lost Opportunity

Update an existing lost opportunity. Only the fields included in the request body are modified; omitted fields retain their current values.

πŸ”Ή Endpoint Details​

PUT /api/v1/lost-opportunities/{id}

πŸ”’ Authentication​

HeaderRequiredDescription
Content-TypeYesMust be application/json
AuthorizationYesFormat: ONLIVESITE Credential:ONLIVEAccessKeyId, Signature=CalculatedSignature

πŸ“ Path Parameters​

ParameterTypeRequiredDescription
idstring (UUID)YesID of the lost opportunity to update

πŸ“ Updatable Fields​

All fields are optional on update (the body is validated with PartialType of the create DTO).

FieldTypeDescription
organizationIdstring (UUID)Organization the record belongs to
entityTypeenumiCall | iChat | booking
interactionIdstringSource interaction identifier
statusenumpending | processed | rejected
reasonstringLoss reason
userGroupIdstring (UUID)Assigned user group
commentstringFree-form comment
originstringOrigin name
userEmailstringContact email
userPhonestringContact phone
extraFieldsobjectCustom metadata bag
externalIdstringExternal identifier

🧩 Request Example​

curl -X PUT "https://openapi.onlive.site/api/v1/lost-opportunities/123e4567-e89b-12d3-a456-426614174000" \
-H "Content-Type: application/json" \
-H "Authorization: ONLIVESITE Credential:ONLIVEAccessKeyId, Signature=CalculatedSignature" \
-d '{
"status": "processed",
"reason": "Customer chose a competitor",
"comment": "Customer asked to be contacted again in Q3"
}'

πŸ“₯ Response​

Success Response (200 OK)​

Returns the full updated Lost Opportunity entity.

Response Example​

{
"id": "123e4567-e89b-12d3-a456-426614174000",
"organizationId": "123e4567-e89b-12d3-a456-426614174001",
"organizationName": "Acme Inc.",
"entityType": "iCall",
"interactionId": "call_abc123",
"status": "processed",
"reason": "Customer chose a competitor",
"comment": "Customer asked to be contacted again in Q3",
"origin": "Website contact form",
"userEmail": "[email protected]",
"userPhone": "+33612345678",
"extraFields": { "department": "Sales" },
"userGroupId": "550e8400-e29b-41d4-a716-446655440000",
"userGroup": "Sales Team",
"involvedAgent": "123e4567-e89b-12d3-a456-426614174002",
"visibleAt": "2025-05-13T15:00:00Z",
"externalId": "frm_abc123",
"createdAt": "2025-05-13T15:00:00Z",
"updatedAt": "2025-05-13T17:22:11Z"
}

❌ Error Responses​

StatusDescription
404Lost opportunity not found

This endpoint follows the standard error format.

πŸ” Validation Rules​

  1. Partial update
    • Any subset of the create DTO fields may be sent; omitted fields are preserved
  2. Format
    • UUIDs must be valid when provided
    • userEmail must be a valid email when provided
  3. Enum values (when provided)
    • entityType ∈ booking
    • status ∈ rejected (DTO does not accept draft)

πŸ’‘ Best Practices​

  1. Status transitions
    • pending β†’ processed / rejected once an agent triages the record
  2. Reasoning
    • Update reason and comment together to record a complete loss analysis
  3. Classification
    • Use extraFields to enrich records over time
  4. Audit
    • Prefer small, focused updates β€” each one updates updatedAt

πŸ“˜ Notes​

  • Only the fields you include are updated
  • The updatedAt timestamp is refreshed automatically
  • involvedAgent, organizationName, userGroup, and visibleAt are server-managed
  • You must have access to the owning organization

βœ… Common Use Cases​

  • βœ… Triage: Move a record from pending to processed / rejected
  • πŸ“ Reasoning: Update reason and comment after analyzing the loss
  • 🏷️ Classification: Enrich extraFields with additional context
  • πŸ‘€ Routing: Reassign the record via userGroupId