---
title: "Create agent session input events"
method: POST
path: "/agents/sessions/{session_id}/events"
tags: ["Agents"]
---

# Create agent session input events

`POST /agents/sessions/{session_id}/events`

Submits message, cancellation, or tool-result events to a managed agent session. Cancellation can recover a still-open turn whose backend execution has ended by marking it cancelled and abandoning unpublished outputs. Saved results, published files, and existing terminal outcomes are preserved. HTTP 202 confirms acceptance, not durable completion. See [session events](https://developers.openai.com/api/docs/guides/agents-api/sessions/events).

## Path parameters

- `session_id` string, required

## Headers

- `Idempotency-Key` string

## Request body

- CreateSessionEventsParams — Input events submitted to an existing session.
  - `events` SessionInputParam[], required — The input events to submit to the session.
    - union — Input submitted to an existing session.
      - object — Adds one or more user messages and starts a turn.
        - `type` 'agent.session.input.message', required — The type of the object. Always `agent.session.input.message`.
        - `input` InputMessageParam[], required — The user messages to add to the session.
          - `type` 'message' — The type of the input item. Always `message`.
          - `role` 'user', required — The role of the message author. Always `user`.
          - `content` InputContentParam[], required — The content of the message.
            - union — Content included in an input message.
              - …
      - object — Cancels the session's active turn.
        - `type` 'agent.session.input.cancel', required — The type of the object. Always `agent.session.input.cancel`.
      - object — Submits the result of a function call.
        - `type` 'agent.session.input.tool_result', required — The type of the object. Always `agent.session.input.tool_result`.
        - `turn_id` string, required — The ID of the turn that requested the function call.
        - `call_id` string, required — The ID of the function call.
        - `success` boolean, required — Whether the function call succeeded.
        - `output` union — A function result represented as text or supported model-input content.
          - string
          - InputContentParam[]
            - union — Content included in an input message.
              - …
        - `error` string, nullable — The error message when the call failed.

## Response `202`

The events were accepted.

## Other responses

- `400` — The request was invalid.
- `401` — Authentication or project context was missing.
- `403` — The API key lacks the required permission.
- `404` — The requested session or event was not found.
- `409` — The request conflicted with the current session state.
- `500` — An internal error occurred.
- `503` — The service is temporarily unavailable.

## Changes

- **2026-09-10** `f2dae1a9aced` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/openai/apis/openapi/changes/agents/sessions/:session_id/events/post.md)

---

[API](https://skmtc.dev/openai/apis/openapi.md) · [All operations](https://skmtc.dev/openai/apis/openapi/llms.txt) · [OpenAPI document](https://skmtc.dev/openai/apis/openapi/revisions/4b75527da17b?raw)
