---
title: "Patch Session"
method: PATCH
path: "/v1/agents/sessions/{session_id}"
tags: ["Agent Sessions"]
---

# Patch Session

`PATCH /v1/agents/sessions/{session_id}`

Update session metadata.

Only user_memory can be updated. To change agent configuration,
create a new session.

Args:
    request: FastAPI request with tenant context
    session_id: Session identifier
    payload: Update request

Returns:
    PatchSessionResponse with update timestamp

Raises:
    NotFoundError: If session not found

Example:
    ```bash
    curl -X PATCH http://localhost:8000/v1/agents/sessions/ses_abc123 \
      -H "Authorization: Bearer {api_key}" \
      -H "X-Namespace: {namespace_id}" \
      -H "Content-Type: application/json" \
      -d '{
        "user_memory": {
          "preferences": {"language": "en", "domain": "tech"}
        }
      }'
    ```

## Path parameters

- `session_id` string, required — Session ID

## Request body

- PatchSessionRequest — Request payload for updating session metadata. Only user_memory can be updated after session creation. To change agent_config or quotas, create a new session. Attributes: user_memory: Updated user memory/preferences Example: ```python request = PatchSessionRequest( user_memory={ "preferences": {"language": "es", "domain": "science"}, "learned_context": {"favorite_topics": ["AI", "robotics"]} } ) ```
  - `user_memory` object, required — Updated user memory (REQUIRED)

## Response `200`

Successful Response

- PatchSessionResponse — Response for session update. Attributes: session_id: Session identifier updated_at: Update timestamp
  - `session_id` string, required — Session identifier
  - `updated_at` string, date-time, required — Update timestamp

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `403` — Forbidden
- `404` — Not Found
- `422` — Validation Error
- `500` — Internal Server Error

---

[API](https://skmtc.net/mixpeek/apis/mixpeek-api.md) · [All operations](https://skmtc.net/mixpeek/apis/mixpeek-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/mixpeek/mixpeek-api/versions/04b379bdbb7c/schema)
