Guest Machines
API referenceChats

Reorder a waiting message

POST/api/v1/chats/{chat_id}/pending-messages/{message_id}/move

Move a queued or failed message in front of another, or last, so the chat takes it in sooner or later. Returns the waiting messages in their new order.

Name the message it goes in front of as before_id, or send null to move it last. Messages steering the working turn always come first and can't be moved.

A 409 means a message named was taken in meanwhile, or is steering the working turn. List the waiting messages and try again.

Required access

Credentials: delegated token, user session, user API key

User API keys use the owner’s current permissions, subject to any key restrictions. Capability scopes below apply to automation account keys and delegated tokens.

Scope: chats:edit

Only the member who started the chat, through their user API key or an integration acting for them: a chat is private to them. Another member's chat answers 404, also to a workspace owner or admin, who may only stop its turn or delete it, signed in to the app, and reads none of it. Automation accounts have no chats.

Authorization

AuthorizationBearer <token>

A user-owned key prefixed gsmc_uk_, bound to one organization. It follows its owner's current membership, role and resource permissions, optionally restricted to read-only access. No X-Org-Id header is needed; a conflicting organization is rejected. Credential creation, personal connection setup and human attestations require a signed-in session. Runs are private to the calling user; sharing an agent grants access to your own personal memory of it, never to the agent's own memory.

In: header

Path Parameters

chat_id*Chat Id
Formatuuid
message_id*Message Id

Header Parameters

X-Org-Id?|

Selects the active organization for a direct user session that has more than one membership. Automation account keys and delegated tokens are each bound to one organization and ignore it.

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Where a queued or failed message goes in its chat's queue.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/api/v1/chats/497f6eca-6276-4993-bfeb-53cbbbba6f08/pending-messages/0/move" \  -H "Authorization: Bearer $GUEST_MACHINES_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "before_id": 412  }'
{  "items": [    {      "id": 0,      "status": "failed",      "content": "string",      "client_ref": "string",      "attachment_count": 0,      "failure_message": "string",      "created_at": "2019-08-24T14:15:22Z",      "updated_at": "2019-08-24T14:15:22Z"    }  ]}