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

# Create a new agent session



## OpenAPI

````yaml /deploy/api/openapi.json post /api/v1/appuid/{appUid}/agentsessions
openapi: 3.0.1
info:
  title: Mindset API Gateway
  version: 1.2.0
servers:
  - url: https://a.api.mindset.ai
  - url: https://b.api.mindset.ai
  - url: https://c.api.mindset.ai
  - url: https://d.api.mindset.ai
security: []
tags:
  - name: Agent Configuration
  - name: Agent Sessions
  - name: AppStatus
  - name: Context Files
  - name: Contexts
  - name: DynamicComponents
  - name: Labels
  - name: SDK Users
  - name: Threads
  - name: Webhooks
  - name: Agent Management (deprecated)
paths:
  /api/v1/appuid/{appUid}/agentsessions:
    post:
      tags:
        - Agent Sessions
      summary: Create a new agent session
      operationId: createAgentSession
      parameters:
        - name: appUid
          in: path
          description: Your application's uid
          required: true
          schema:
            minLength: 1
            type: string
      requestBody:
        content:
          application/json:
            schema:
              required:
                - agentUid
              type: object
              properties:
                agentUid:
                  minLength: 1
                  type: string
                  description: Uid of the agent to link to
                externalUserId:
                  type: string
                  description: User Id from external system
                userEmail:
                  maxLength: 100
                  type: string
                  description: >-
                    email address format user identifier. Deprecated. Prefer
                    using sdkUserEmail or externalUserId.
                sdkUserEmail:
                  maxLength: 100
                  type: string
                  description: >-
                    SDK user email address. Mutually exclusive with other user
                    identifiers.
                humanUid:
                  type: string
                  description: >-
                    Direct Mindset human UID. Mutually exclusive with other user
                    identifiers.
                realEmailAddress:
                  maxLength: 100
                  type: string
                  description: >-
                    User's actual email address for SSO or email-based auth.
                    Mutually exclusive with other user identifiers.
                tags:
                  maxItems: 10
                  type: array
                  description: Array of tags (max 10)
                  items:
                    maxLength: 60
                    minLength: 1
                    type: string
                contextUids:
                  maxItems: 30
                  type: array
                  description: Array of existing context Uids (max 30)
                  items:
                    maxLength: 30
                    minLength: 1
                    type: string
                mcpserverUids:
                  maxItems: 5
                  type: array
                  description: Array of existing MCP server Uids (max 5)
                  items:
                    maxLength: 20
                    minLength: 20
                    type: string
                planUids:
                  maxItems: 20
                  type: array
                  description: >-
                    Array of existing plan Uids (max 20). Overrides agent-level
                    planUids.
                  items:
                    type: string
                skillUids:
                  maxItems: 20
                  type: array
                  description: >-
                    Array of existing skill Uids (max 20). Overrides agent-level
                    skillUids.
                  items:
                    type: string
                forcePlanUid:
                  type: string
                  description: >-
                    Forces plan activation on session start. Must be a valid
                    plan UID if provided.
        required: true
      responses:
        '201':
          description: Agent Session created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  uid:
                    type: string
                    description: Unique ID of the agent session
                  agentSessionUid:
                    type: string
                    description: Unique ID of the agent session
                  humanUid:
                    type: string
                    description: Mindset internal user Uid linked to this agent sessions
                  externalUserId:
                    type: string
                    description: External user Id
                  userEmail:
                    type: string
                    description: External supplied user email address to identify the user
                  agentUid:
                    type: string
                    description: Unique Agent Id linked to this agent sessions
                  tags:
                    maxItems: 10
                    type: array
                    description: Array of tags (max 10)
                    items:
                      maxLength: 60
                      minLength: 1
                      type: string
                  contextUids:
                    maxItems: 30
                    type: array
                    description: Array of existing context Uids (max 30)
                    items:
                      maxLength: 30
                      minLength: 1
                      type: string
                  mcpserverUids:
                    maxItems: 5
                    type: array
                    description: Array of existing MCP server Uids (max 5)
                    items:
                      maxLength: 20
                      minLength: 20
                      type: string
                  createdAt:
                    type: string
                    description: Creation timestamp (ISO 8601)
                    format: date-time
                  lastUsedAt:
                    type: string
                    description: Last time used timestamp (ISO 8601)
                    format: date-time
        '400':
          description: Bad Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '422':
          description: Unprocessable Entity
          content: {}
        '500':
          description: Internal Server Error
          content: {}
      security:
        - APIKeyHeader: []
components:
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      name: x-api-key
      in: header

````