Update Conversation Status

Use the toggle_status API to change the status of a specified conversation. The server validates whether the target status is valid according to the STATUS_TRANSITIONS status transition matrix.

Request Method

POST

Request URL

https://livedesk-api.engagelab.com/api/v2/accounts/conversations/{conversation_id}/toggle_status

Authentication

For details, see the authentication instructions in API Overview.

Request

Request Example

curl -X POST 'https://livedesk-api.engagelab.com/api/v2/accounts/conversations/{conversation_id}/toggle_status' \ -H 'Content-Type: application/json' \ -H 'Authorization: Basic base64(api_key:api_secret)' \ -d '{ "status": "resolved", "snoozed_until": 1715000000 }'
              
              curl -X POST 'https://livedesk-api.engagelab.com/api/v2/accounts/conversations/{conversation_id}/toggle_status' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic base64(api_key:api_secret)' \
-d '{
    "status": "resolved",
    "snoozed_until": 1715000000
}'

            
This code block in the floating window

Request Headers

Field Type Description
Authorization string Authenticate using Authorization: Basic base64(API Key:API Secret). Go to the API Keys page to obtain the API key and API secret, separate them with a colon, and encode the result in Base64.
Content-Type application/json Data type. Use application/json for regular text messages.

Path Parameters

Field Type Required Description
conversation_id string Yes Conversation ID.

Request Body Parameters

Field Type Required Description
status string Yes Target status. See the enumerated values below.
snoozed_until integer No Takes effect only when status=snoozed. UNIX timestamp in seconds. If omitted, the conversation is snoozed indefinitely.
sender_type string No Used only for internal server-side identification. When the caller is AgentBot, the current status is pending, and the target status is open, the bot_handoff! process is triggered and the CONVERSATION_BOT_HANDOFF event is dispatched.

status Enumerated Values

Value Meaning
open Open
resolved Resolved
pending Pending bot/agent handling
snoozed Snoozed
closed Closed (archived)

Status Transition Matrix (STATUS_TRANSITIONS)

Current Status Allowed Transitions
open open, resolved, pending, snoozed
resolved resolved, open, pending, snoozed, closed
pending pending, open, resolved, snoozed
snoozed snoozed, open, resolved, pending
closed closed, open

Key Constraints

  • resolved is the only prerequisite status for entering closed: open, pending, and snoozed cannot be changed directly to closed. They must first transition to resolved before being archived.
  • closed can only return to open: An archived conversation cannot transition directly to other active statuses, such as resolved, pending, or snoozed.
  • Writing the same status is idempotent: When the target status is the same as the current status, validation is skipped and the request succeeds directly. No callback is triggered.
  • Validation is implemented at the ActiveRecord model layer through validate :status_transition_allowed, if: :will_save_change_to_status?, and applies to all save!, update!, and status= followed by save paths.

Response

Successful Response

HTTP 200:

{ "meta": {}, "payload": { "success": true, "conversation_id": 45, "current_status": "resolved", "snoozed_until": null } }
              
              {
  "meta": {},
  "payload": {
    "success": true,
    "conversation_id": 45,
    "current_status": "resolved",
    "snoozed_until": null
  }
}

            
This code block in the floating window

Response Parameters

Field Type Description
success boolean The return value of save; true when the status change succeeds.
conversation_id integer The conversation's display_id—the ID visible within the account.
current_status string The conversation status after the change.
snoozed_until integer / null The currently effective snooze expiration timestamp; always null for non-snoozed statuses.

Error Responses

HTTP Status Code Trigger Condition
401 Unauthenticated or authentication failed.
403 The current user does not have permission to access the Inbox to which the conversation belongs.
404 No conversation with the corresponding display_id can be found in the current account.
422 status is not a valid enumerated value, parsing of snoozed_until fails, or the target status violates the STATUS_TRANSITIONS matrix.

422 Response Structure

Violation of the status transition matrix (from model-layer validation and rendered as full_messages by RequestExceptionHandler):

{ "message": "Status can't transition from open to closed", "attributes": ["status"] }
              
              {
  "message": "Status can't transition from open to closed",
  "attributes": ["status"]
}

            
This code block in the floating window

Unknown status enumerated value (from CustomExceptions::Conversation::InvalidStatus):

{ "message": "Invalid conversation status: \"foo\" ('foo' is not a valid status)" }
              
              {
  "message": "Invalid conversation status: \"foo\" ('foo' is not a valid status)"
}

            
This code block in the floating window

Invalid snoozed_until (from CustomExceptions::Conversation::InvalidSnoozedUntil):

{ "message": "Invalid snoozed_until: \"not-a-timestamp\" (invalid date)" }
              
              {
  "message": "Invalid snoozed_until: \"not-a-timestamp\" (invalid date)"
}

            
This code block in the floating window
Icon Solid Transparent White Qiyu
Contact Sales