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

> ## Agent Instructions
> Start with /introduction/getting-started. Use the Inference API's Direct Query endpoint (POST /api/inference/query) with the newton-c-2.6 or newton-fusion-1.0 model (text, image, and video reasoning) or the omega-embedding encoder (time-series embeddings). ATAI_API_ENDPOINT is the base URL https://platform.u1.archetypeai.app with no version path; every endpoint path begins with /api. Pages whose descriptions are marked (Archived) document the legacy Lens runtime — do not use them for new projects.

# Update Deployment

> Change a ready serving deployment's session limits

Requires [version 2.0.1](https://docs.archetypeai.app/release-notes/2.0.x.md#v2-0-1) or later of the Archetype platform.

## Overview

This endpoint changes the session settings of a `serving` deployment and returns the deployment.
Only a `ready` `serving` deployment takes a change.

Each field of `sessions` you send replaces the deployment's current value. Each one you leave out,
or send as `null`, keeps it. Leaving out `sessions`, or sending `null` or `{}`, changes nothing and
returns the deployment as it is.

## Request

**deployment\_id** `string` *required*

Deployment `dpl_` id.

**sessions** `object`

New limits for the deployment's sessions. A field this object does not have is refused with
`400`.

**sessions.max** `integer`

The most sessions the deployment holds open at once, per running copy of the deployment.
Minimum `1`, maximum `1000`. Lowering it closes no open session; it only refuses new ones.

**sessions.idle\_timeout\_secs** `integer`

Seconds a session can sit unused, counted from its last use, before the deployment closes it.
Maximum `86400`. `0` means never, which is refused with `400` where the platform stops idle
deployments.

## Response

Returns `200 OK` with the deployment, with the same fields as [Get
Deployment](https://docs.archetypeai.app/api-reference/agents/deployments/get-deployment.md) returns. Its `sessions` gives the
stored settings.

```bash cURL theme={"system"}
curl -X PATCH "$ATAI_API_ENDPOINT/agents/deployments/dpl_01jcg7r2t9xb5qw3m8n6kfzc4d" \
  -H "Authorization: Bearer $ATAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"sessions": {"max": 64}}'
```

```python Python theme={"system"}
import os
import requests

base_url = os.environ["ATAI_API_ENDPOINT"]
api_key = os.environ["ATAI_API_KEY"]

response = requests.patch(
    f"{base_url}/agents/deployments/dpl_01jcg7r2t9xb5qw3m8n6kfzc4d",
    headers={"Authorization": f"Bearer {api_key}"},
    json={"sessions": {"max": 64}},
)

if response.status_code == 200:
    print(response.json()["sessions"])
else:
    print(f"Error: {response.json()['errors']}")
```

```javascript JavaScript theme={"system"}
const response = await fetch(
  `${process.env.ATAI_API_ENDPOINT}/agents/deployments/dpl_01jcg7r2t9xb5qw3m8n6kfzc4d`,
  {
    method: 'PATCH',
    headers: {
      'Authorization': `Bearer ${process.env.ATAI_API_KEY}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({ sessions: { max: 64 } })
  }
);

const body = await response.json();

if (response.ok) {
  console.log(body.sessions);
} else {
  console.error('Error:', body.errors);
}
```

```json 200 - Settings changed theme={"system"}
{
  "id": "dpl_01jcg7r2t9xb5qw3m8n6kfzc4d",
  "org_id": "org_01jc8m5r2vq9xt4bn7h3kdzs6w",
  "project_id": "prj_01jcd4m8t2vq6xn3r7k5hbzw9e",
  "created_by": "usr_01jc8m6t3wr0yv5cp8j4mezt7x",
  "package_id": "pkg_01jcb2x7m4qv8n3h5t6rk9dzs0",
  "kind": "serving",
  "status": "ready",
  "error": null,
  "created_at": "2026-11-05T17:00:00Z",
  "ready_at": "2026-11-05T17:02:10Z",
  "stopped_at": null,
  "sessions": {"max": 64, "idle_timeout_secs": 900}
}
```

## Important Notes

> [!NOTE]
>
> * A `400` means the body does not parse, names a field this endpoint does not have, or gives a value that is not a whole number (`invalid_request_body`); a value is outside its limits (`out_of_range`); or the deployment is not `serving`, or `idle_timeout_secs` is `0` where idle deployments are stopped (`bad_request`). A value the deployment already has is kept as it is, not checked again.
> * A `403` means you can see the deployment's project but cannot modify it.
> * A `404` means the deployment does not exist, belongs to another organization, or is in a project you cannot see.
> * A `409` with the code `conflict` means the deployment is not `ready`. The message says whether to wait for it or that it has ended. Nothing is stored.
> * A `409` with the code `deployment_sessions_unsupported` means the deployment cannot take session settings. Deploy the package again to get one that can. Nothing is stored.
> * A `503` with the code `unavailable` means the settings could not be stored. The same request is safe to retry.


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