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

# Assign Session Project

> Assign or clear the ``project_id`` of a session — Package 8 Step 8.

``project_id=null`` removes the assignment (returns the session to
the "All sessions" view). A non-null ``project_id`` must reference a
project owned by the same user; otherwise the call yields 404 to
avoid leaking the existence of someone else's project.

Returns 404 (not 403) for both unknown sessions and unknown projects.

# IDOR AUDIT PASS — both Session.user_id and (when project_id is set)
# Project.user_id are matched against the authenticated user_id.



## OpenAPI

````yaml patch /api/v1/sessions/{session_id}/project
openapi: 3.1.0
info:
  title: EDN Memory Engine
  version: 0.1.0
servers:
  - description: EDN evaluation endpoint
    url: https://api.tensorpro.ai
security:
  - EDNApiKey: []
paths:
  /api/v1/sessions/{session_id}/project:
    patch:
      summary: Assign Session Project
      description: |-
        Assign or clear the ``project_id`` of a session — Package 8 Step 8.

        ``project_id=null`` removes the assignment (returns the session to
        the "All sessions" view). A non-null ``project_id`` must reference a
        project owned by the same user; otherwise the call yields 404 to
        avoid leaking the existence of someone else's project.

        Returns 404 (not 403) for both unknown sessions and unknown projects.

        # IDOR AUDIT PASS — both Session.user_id and (when project_id is set)
        # Project.user_id are matched against the authenticated user_id.
      operationId: assign_session_project_api_v1_sessions__session_id__project_patch
      parameters:
        - in: path
          name: session_id
          required: true
          schema:
            title: Session Id
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AssignProjectRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SessionSummary'
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
components:
  schemas:
    AssignProjectRequest:
      properties:
        project_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Project Id
      title: AssignProjectRequest
      type: object
    SessionSummary:
      properties:
        created_at:
          title: Created At
          type: string
        id:
          title: Id
          type: string
        is_archived:
          default: false
          title: Is Archived
          type: boolean
        last_message_preview:
          anyOf:
            - type: string
            - type: 'null'
          title: Last Message Preview
        message_count:
          title: Message Count
          type: integer
        project_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Project Id
        title:
          title: Title
          type: string
        updated_at:
          title: Updated At
          type: string
      required:
        - id
        - title
        - created_at
        - updated_at
        - message_count
        - last_message_preview
      title: SessionSummary
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    ValidationError:
      properties:
        ctx:
          title: Context
          type: object
        input:
          title: Input
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
  securitySchemes:
    EDNApiKey:
      description: >-
        EDN API key presented as 'Bearer <key>' in the Authorization header.
        Create and manage keys from the Console.
      in: header
      name: Authorization
      type: apiKey

````