All Products
Search
Document Center

Qoder CN Series:Send session events

Last Updated:Jul 15, 2026

Write user or system input events to a Forward Session.

Request headers

Header

Required

Description

Authorization

Yes

Bearer <PAT>

Content-Type

Yes

application/json

Idempotency-Key

No

Optional idempotency key for requests with side effects.

Path parameters

Parameter

Type

Required

Description

session_id

string

Yes

Session ID.

Request body

Field

Type

Required

Description

events

array

Yes

Array of event objects

events[].type

string

Yes

Event type

events[].content

string \

array

Depends on type

events[].content[].type

string

Yes

Content block type, e.g. text

events[].content[].text

string

Yes

Text content

content supports two formats:

  • Shorthand: plain string "content": "text content"

  • Full: content block array "content": [{"type": "text", "text": "text content"}]

Use the shorthand format for plain text messages. Use the full format when sending multimedia content such as images.

Supported event types

type

Description

Required fields

user.message

User sends a message

content

user.interrupt

User interrupts Agent execution

-

user.tool_confirmation

Authorize a tool call from the Agent

tool_use_id, decision (approve or deny)

user.custom_tool_result

Return the execution result of a custom tool

tool_use_id, content

user.define_outcome

User defines the expected outcome

content

Example request

curl -s -X POST 'https://api.qoder.com.cn/api/v1/forward/sessions/sess_xxx/events' \
  -H "Authorization: Bearer $QODER_PAT" \
  -H "Content-Type: application/json" \
  -d '{
  "events": [
    {
      "type": "user.message",
      "content": [
        {
          "type": "text",
          "text": "Continue the analysis."
        }
      ],
      "file_attachments": []
    }
  ]
}'

Example response

HTTP 200 OK

{
  "data": [
    {
      "id": "evt_xxx",
      "type": "user.message",
      "session_id": "sess_xxx",
      "content": [
        {
          "type": "text",
          "text": "Continue the analysis."
        }
      ],
      "processed_at": "2026-06-22T11:00:00Z"
    }
  ]
}

Response fields

Field

Type

Description

data

array

Array of created Event objects, filtered according to Forward rules.

Errors

HTTP

Type

Code

Condition

400

invalid_request_error

invalid_event

Event type or fields are invalid.

404

not_found_error

session_not_found

Session does not exist.

409

conflict_error

session_archived

Session is archived.

409

conflict_error

turn_already_running

Current turn state does not allow a new turn.

404

not_found_error

pending_action_not_found

No matching pending action found for the tool confirmation or result.

409

conflict_error

pending_action_already_resolved

Pending action has already been resolved.

401

authentication_error

authentication_required

PAT is invalid or expired.

Notes

  • Allowed types include user.message, user.interrupt, user.tool_confirmation, user.tool_result, user.custom_tool_result, user.define_outcome, and system.message.

  • system.message is limited to one per request and must be the last event.

  • The response does not return the raw runtime event JSON.

See also