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

# Update Session by Labels

> Update session title/labels, selected by external id and/or labels. Identify sessions with the `id` query param and/or arbitrary label query params (every query key except `id`, `limit`, and `offset` becomes a label). Example: `?id=ticket-4821&userId=alice&channel=web`.



## OpenAPI

````yaml /openapi.yaml put /workspaces/{workspaceId}/agents/{agentId}/sessions/by-labels
openapi: 3.1.0
info:
  title: Actx0 API
  version: 1.0.0
  description: >-
    REST API for Actx0 workspaces, access keys, agents, sessions, messages,
    memories, prompts, and knowledge documents.


    Authenticate with `X-Access-Key` (workspace), `X-API-Key` (user), or a
    dashboard session.
servers:
  - url: https://app.actx0.com/api/v1
    description: Actx0 cloud
security: []
tags:
  - name: Me
    description: Inspect the authenticated access key or API key
  - name: API Keys
    description: User API keys for X-API-Key auth
  - name: Workspaces
    description: Team workspaces
  - name: Access Keys
    description: Scoped workspace keys for agents and SDKs
  - name: Agents
    description: Agents inside a workspace
  - name: Sessions
    description: Agent conversation sessions
  - name: Messages
    description: Session messages and semantic search
  - name: Memories
    description: Session memories, search, batch, and regenerate
  - name: Prompts
    description: Versioned prompts
  - name: Knowledge
    description: Document upload and semantic search
paths:
  /workspaces/{workspaceId}/agents/{agentId}/sessions/by-labels:
    put:
      tags:
        - Sessions
      summary: Update Session by Labels
      description: >-
        Update session title/labels, selected by external id and/or labels.
        Identify sessions with the `id` query param and/or arbitrary label query
        params (every query key except `id`, `limit`, and `offset` becomes a
        label). Example: `?id=ticket-4821&userId=alice&channel=web`.
      operationId: updateSessionByLabels
      parameters:
        - $ref: '#/components/parameters/WorkspaceId'
        - $ref: '#/components/parameters/AgentId'
        - $ref: '#/components/parameters/SessionExternalId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateSessionRequest'
            example:
              title: 'Ticket #4821'
              labels:
                userId: alice
                channel: web
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Session'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - AccessKeyAuth: []
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: curl
          label: curl / acli
          source: >
            curl -X PUT
            'https://app.actx0.com/api/v1/workspaces/<workspaceId>/agents/<agentId>/sessions/by-labels'
            \
              -H "X-Access-Key: YOUR_ACCESS_KEY" \
              -H "Content-Type: application/json" \
              -H "Accept: application/json" \
              -d '{"title": "Ticket #4821", "labels": {"userId": "alice", "channel": "web"}}'

            # ---


            # acli

            export ACTX0_ACCESS_KEY="YOUR_ACCESS_KEY"

            export ACTX0_WORKSPACE_ID="YOUR_WORKSPACE_ID"


            acli session update \
              --agent-id AGENT_ID \
              --external-id support-ticket-42 \
              --title "Renamed ticket" \
              --set-label channel=email
        - lang: python
          label: pctx0
          source: |
            from pctx0 import Pctx0Client

            client = Pctx0Client(
                access_key="YOUR_ACCESS_KEY",
                workspace_id="YOUR_WORKSPACE_ID",
            )

            session = client.session.update(
                "AGENT_ID",
                external_id="support-ticket-42",
                title="Renamed ticket",
                new_labels={"channel": "email"},
            )
        - lang: javascript
          label: nctx0
          source: |
            import { Nctx0Client } from "@actx0/nctx0";

            const client = new Nctx0Client({
              accessKey: "YOUR_ACCESS_KEY",
              workspaceId: "YOUR_WORKSPACE_ID",
            });

            const session = await client.session.update("AGENT_ID", {
              externalId: "support-ticket-42",
              title: "Renamed ticket",
              newLabels: { channel: "email" },
            });
        - lang: go
          label: gtcx0
          source: "package main\n\nimport (\n\t\"context\"\n\n\t\"github.com/Actx0/Gctx0\"\n)\n\nfunc main() {\n\tclient := gctx0.NewClient(\n\t\tgctx0.WithAccessKey(\"YOUR_ACCESS_KEY\"),\n\t\tgctx0.WithWorkspaceId(\"YOUR_WORKSPACE_ID\"),\n\t)\n\tdefer client.Close()\n\tctx := context.Background()\n\tsession, err := client.Session.Update(\n\t\tctx,\n\t\t\"AGENT_ID\",\n\t\tgctx0.SessionLookup{ExternalID: \"support-ticket-42\"},\n\t\t\"Renamed ticket\",\n\t\tmap[string]string{\"channel\": \"email\"},\n\t)\n\t_ = session\n\t_ = err\n}\n"
components:
  parameters:
    WorkspaceId:
      name: workspaceId
      in: path
      required: true
      schema:
        type: string
        format: uuid
      example: 11111111-1111-1111-1111-111111111111
    AgentId:
      name: agentId
      in: path
      required: true
      schema:
        type: string
        format: uuid
      example: 22222222-2222-2222-2222-222222222222
    SessionExternalId:
      name: id
      in: query
      required: false
      schema:
        type: string
      description: External session id. Provide id and/or arbitrary label query params.
      example: ticket-4821
  schemas:
    UpdateSessionRequest:
      type: object
      properties:
        title:
          type: string
          maxLength: 255
          nullable: true
          example: 'Ticket #4821'
        labels:
          type: object
          additionalProperties:
            type: string
          example:
            userId: alice
            channel: web
    Session:
      type: object
      required:
        - id
        - externalId
        - workspaceId
        - agentId
        - status
        - createdAt
        - updatedAt
      properties:
        id:
          type: string
          format: uuid
          description: Internal session UUID used in message and memory paths.
          example: 33333333-3333-3333-3333-333333333333
        externalId:
          type: string
          description: Client-facing session id from the id query param (or generated).
          example: ticket-4821
        workspaceId:
          type: string
          format: uuid
          example: 11111111-1111-1111-1111-111111111111
        agentId:
          type: string
          format: uuid
          example: 22222222-2222-2222-2222-222222222222
        title:
          type: string
          example: 'Ticket #4821'
        status:
          type: string
          example: active
        labels:
          type: object
          additionalProperties:
            type: string
          example:
            userId: alice
            channel: web
        meta: {}
        lastActivityAt:
          type: string
          format: date-time
          example: '2026-07-01T12:00:00Z'
        createdAt:
          type: string
          format: date-time
          example: '2026-07-01T12:00:00Z'
        updatedAt:
          type: string
          format: date-time
          example: '2026-07-01T12:00:00Z'
    Error:
      type: object
      required:
        - errorMessage
      properties:
        errorMessage:
          type: string
          example: Name is required
  securitySchemes:
    AccessKeyAuth:
      type: apiKey
      in: header
      name: X-Access-Key
      description: Workspace access key for agent/runtime integrations.
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: User API key for management and automation.

````