> ## Documentation Index
> Fetch the complete documentation index at: https://trueforge.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Create turn events

> Create events for a turn. Only the session creator may create them.



## OpenAPI

````yaml /openapi.json post /api/v1/sessions/{session_id}/turns/{turn_id}/events
openapi: 3.1.0
info:
  description: >-
    HTTP API for the TrueForge agent server (`/api/v1`). Interactive docs are
    served at `/api/v1/docs` (OpenAPI JSON at `/api/v1/openapi.json`).


    **Authentication:** Standalone auth accepts requests without credentials —
    middleware stamps a local default user. When OIDC or TrueFoundry auth is
    configured, protected routes require a valid cookie or `Authorization:
    Bearer` token. There is no built-in API-key scheme; pass custom headers only
    if your reverse proxy or IdP layer requires them.


    Covers DB-backed sessions, the agent registry, settings catalogs, and
    model/MCP/skill/sandbox providers.
  title: TrueForge API
  version: 0.0.0
servers: []
security:
  - BearerAuth: []
tags:
  - name: Internal
  - name: Auth
  - name: Capabilities
  - name: Models
  - name: MCP Servers
  - name: Skills
  - name: Sandboxes
  - name: Web Search Providers
  - name: Agents
  - name: Schedules
  - name: Agent Sessions
paths:
  /api/v1/sessions/{session_id}/turns/{turn_id}/events:
    post:
      tags:
        - Agent Sessions
      summary: Create turn events
      description: Create events for a turn. Only the session creator may create them.
      parameters:
        - description: Session identifier.
          in: path
          name: session_id
          required: true
          schema:
            description: Session identifier.
            maxLength: 64
            minLength: 1
            type: string
        - description: Turn identifier.
          in: path
          name: turn_id
          required: true
          schema:
            description: Turn identifier.
            minLength: 1
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateTurnEventRequest'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateTurnEventResponse'
          description: Events created.
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RequestErrorResponse'
          description: Invalid request body.
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RequestErrorResponse'
          description: Caller is not the session creator.
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RequestErrorResponse'
          description: Session or turn not found.
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RequestErrorResponse'
          description: Turn is terminal, or an event id already exists.
components:
  schemas:
    CreateTurnEventRequest:
      properties:
        events:
          description: One or more user events.
          items:
            $ref: '#/components/schemas/TurnInboundEventItem'
          minItems: 1
          type: array
      required:
        - events
      type: object
    CreateTurnEventResponse:
      properties:
        data:
          description: Events with server-minted `id` and `created_at`, in request order.
          items:
            discriminator:
              mapping:
                user.mcp_auth_continue: '#/components/schemas/UserMCPAuthContinueEvent'
                user.tool_approval: '#/components/schemas/UserToolApprovalEvent'
                user.tool_approval_policy: '#/components/schemas/UserToolApprovalPolicyEvent'
                user.tool_response: '#/components/schemas/UserToolResponseEvent'
              propertyName: type
            oneOf:
              - $ref: '#/components/schemas/UserToolApprovalEvent'
              - $ref: '#/components/schemas/UserToolResponseEvent'
              - $ref: '#/components/schemas/UserToolApprovalPolicyEvent'
              - $ref: '#/components/schemas/UserMCPAuthContinueEvent'
          type: array
      required:
        - data
      type: object
    RequestErrorResponse:
      properties:
        error:
          properties:
            code:
              description: Optional machine-readable error code; null when not applicable.
              type:
                - string
                - 'null'
            message:
              description: Human-readable explanation of the failure.
              type: string
            param:
              description: >-
                Optional request field that caused the error; null when not
                field-specific.
              type:
                - string
                - 'null'
            type:
              description: Optional error category (e.g. validation vs conflict).
              type: string
          required:
            - message
          type: object
      required:
        - error
      type: object
    TurnInboundEventItem:
      discriminator:
        mapping:
          user.mcp_auth_continue: '#/components/schemas/UserMCPAuthContinueInputEvent'
          user.tool_approval: '#/components/schemas/UserToolApprovalInputEvent'
          user.tool_approval_policy: '#/components/schemas/UserToolApprovalPolicyMessage'
          user.tool_response: '#/components/schemas/UserToolResponseInputEvent'
        propertyName: type
      oneOf:
        - $ref: '#/components/schemas/UserToolApprovalInputEvent'
        - $ref: '#/components/schemas/UserToolResponseInputEvent'
        - $ref: '#/components/schemas/UserToolApprovalPolicyMessage'
        - $ref: '#/components/schemas/UserMCPAuthContinueInputEvent'
    UserMCPAuthContinueEvent:
      properties:
        created_at:
          description: ISO 8601 event timestamp.
          type: string
        id:
          description: Unique identifier for the event (monotonic ULID).
          type: string
        type:
          description: Client resume after mcp.auth_required (OAuth completed).
          enum:
            - user.mcp_auth_continue
          type: string
      required:
        - type
        - id
        - created_at
      type: object
    UserToolApprovalEvent:
      properties:
        approval:
          $ref: '#/components/schemas/ApprovalDecision'
        created_at:
          description: ISO 8601 event timestamp.
          type: string
        id:
          description: Unique identifier for the event (monotonic ULID).
          type: string
        thread_id:
          description: Thread that owns the pending tool call.
          minLength: 1
          type: string
        tool_call_id:
          description: Tool call id being approved or denied.
          minLength: 1
          type: string
        type:
          description: Client resume after tool.approval_required.
          enum:
            - user.tool_approval
          type: string
      required:
        - type
        - thread_id
        - tool_call_id
        - approval
        - id
        - created_at
      type: object
    UserToolApprovalPolicyEvent:
      properties:
        created_at:
          description: ISO 8601 event timestamp.
          type: string
        id:
          description: Unique identifier for the event (monotonic ULID).
          type: string
        policies:
          description: One or more (server_name, name) policy entries.
          items:
            $ref: '#/components/schemas/ToolApprovalPolicyItem'
          minItems: 1
          type: array
        type:
          description: Sticky allow-session policy for matching tools (optional expiry).
          enum:
            - user.tool_approval_policy
          type: string
      required:
        - type
        - policies
        - id
        - created_at
      type: object
    UserToolResponseEvent:
      properties:
        content:
          description: Client-side tool result content.
          minLength: 1
          type: string
        created_at:
          description: ISO 8601 event timestamp.
          type: string
        id:
          description: Unique identifier for the event (monotonic ULID).
          type: string
        thread_id:
          description: Thread that owns the pending tool call.
          minLength: 1
          type: string
        tool_call_id:
          description: Tool call id receiving the client response.
          minLength: 1
          type: string
        type:
          description: Client resume after tool.response_required.
          enum:
            - user.tool_response
          type: string
      required:
        - type
        - thread_id
        - tool_call_id
        - content
        - id
        - created_at
      type: object
    UserMCPAuthContinueInputEvent:
      properties:
        type:
          description: Client resume after mcp.auth_required (OAuth completed).
          enum:
            - user.mcp_auth_continue
          type: string
      required:
        - type
      type: object
    UserToolApprovalInputEvent:
      properties:
        approval:
          $ref: '#/components/schemas/ApprovalDecision'
        thread_id:
          description: Thread that owns the pending tool call.
          minLength: 1
          type: string
        tool_call_id:
          description: Tool call id being approved or denied.
          minLength: 1
          type: string
        type:
          description: Client resume after tool.approval_required.
          enum:
            - user.tool_approval
          type: string
      required:
        - type
        - thread_id
        - tool_call_id
        - approval
      type: object
    UserToolApprovalPolicyMessage:
      properties:
        policies:
          description: One or more (server_name, name) policy entries.
          items:
            $ref: '#/components/schemas/ToolApprovalPolicyItem'
          minItems: 1
          type: array
        type:
          description: Sticky allow-session policy for matching tools (optional expiry).
          enum:
            - user.tool_approval_policy
          type: string
      required:
        - type
        - policies
      type: object
    UserToolResponseInputEvent:
      properties:
        content:
          description: Client-side tool result content.
          minLength: 1
          type: string
        thread_id:
          description: Thread that owns the pending tool call.
          minLength: 1
          type: string
        tool_call_id:
          description: Tool call id receiving the client response.
          minLength: 1
          type: string
        type:
          description: Client resume after tool.response_required.
          enum:
            - user.tool_response
          type: string
      required:
        - type
        - thread_id
        - tool_call_id
        - content
      type: object
    ApprovalDecision:
      discriminator:
        mapping:
          allow: '#/components/schemas/ApprovalAllow'
          deny: '#/components/schemas/ApprovalDeny'
        propertyName: status
      oneOf:
        - $ref: '#/components/schemas/ApprovalAllow'
        - $ref: '#/components/schemas/ApprovalDeny'
    ToolApprovalPolicyItem:
      properties:
        action:
          $ref: '#/components/schemas/ToolApprovalPolicyAction'
        name:
          description: Tool name on that server.
          minLength: 1
          type: string
        server_name:
          description: MCP server name.
          minLength: 1
          type: string
      required:
        - server_name
        - name
        - action
      type: object
    ApprovalAllow:
      properties:
        status:
          description: Allow the pending tool call(s).
          enum:
            - allow
          type: string
      required:
        - status
      type: object
    ApprovalDeny:
      properties:
        reason:
          description: Optional reason shown to the agent when denied.
          type: string
        status:
          description: Deny the pending tool call(s).
          enum:
            - deny
          type: string
      required:
        - status
      type: object
    ToolApprovalPolicyAction:
      discriminator:
        mapping:
          allow_session: '#/components/schemas/ToolApprovalPolicyAllowSession'
        propertyName: type
      oneOf:
        - $ref: '#/components/schemas/ToolApprovalPolicyAllowSession'
    ToolApprovalPolicyAllowSession:
      properties:
        expire_at:
          description: >-
            ISO 8601 timestamp when this session allow expires. Omit to allow
            for the whole session.
          type: string
        type:
          description: Allow matching tool calls for the rest of this session.
          enum:
            - allow_session
          type: string
      required:
        - type
      type: object
  securitySchemes:
    BearerAuth:
      bearerFormat: JWT
      description: >-
        Caller credential (`Authorization: Bearer <token>`). Required on
        protected routes when auth is enabled. Browser sessions may use the
        HttpOnly `id_token` or `accessToken` cookie instead.
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.