# PATCH /v1/streams/{id}

Update a stream

The id stays. A new name must be free within the server. contentRetentionDays applies to an inbound stream only and sets how long received content is kept.

Takes a server key (`sk_…`, or `sk_test_…` on a test server) as a bearer token. TypeScript: `sendora.streams.update(streamId, { name, contentRetentionDays })`. Python: `sendora.streams.update(stream_id, name=..., content_retention_days=...)`.

## Parameters

- `id` (path, required, string (uuid)): The stream id.

## Request body

- `name` (string (at least 1, at most 100 characters)): 1 to 100 characters.
- `contentRetentionDays` (integer (1 to 30) or null): Days an inbound stream keeps received content, 1 to 30; null for the default of 30.

Example:

```json
{
  "name": "Driftinformation"
}
```

## Responses

### 200 A stream of this server.

- `streamId` (string (uuid), required): What a send names as streamId.
- `kind` ("transactional" | "broadcast" | "inbound", required): transactional for mail the recipient expects; broadcast for mail to many; inbound for mail the server receives.
- `name` (string (at least 1, at most 100 characters), required): The name given at creation, unique within the server.
- `isDefault` (boolean, required): The stream a send without a streamId goes on; one per server, transactional.
- `createdAt` (string (date-time), required)
- `archivedAt` (string (date-time) or null, required): Set once archived; the stream then takes no new messages.
- `pausedAt` (string (date-time) or null, required): Set while Sendora has paused the stream after complaints; it takes no messages until support has resumed it.
- `inboundAddress` (string or null, required): The address of an inbound stream, its id on inbound.sendora.se; mail sent there is received on the stream. Null on every other kind.
- `contentRetentionDays` (integer (1 to 30) or null, required): How many days an inbound stream keeps received content, 1 to 30; null means the default of 30. Null on every other kind.

Example:

```json
{
  "streamId": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
  "kind": "transactional",
  "name": "Driftinformation",
  "isDefault": false,
  "createdAt": "2026-09-16T12:00:00.000Z",
  "archivedAt": null,
  "pausedAt": null,
  "inboundAddress": null,
  "contentRetentionDays": null
}
```

## Errors

Every error answers `error`, the code, and `message`, a sentence for a person. A code that adds fields is shown in full below the table.

| Code | Status | Meaning |
| --- | --- | --- |
| `invalid_request` | 400 | The body, the query or a header does not match what the route takes. |
| `unauthorized` | 401 | The key is missing, malformed or revoked. |
| `wrong_token_kind` | 403 | The key is of the other kind: a server key (sk_) where an account key (ak_) is needed, or the reverse. The message names the kind the operation takes. |
| `not_found` | 404 | No such stream of this server. |
| `stream_exists` | 409 | The server already has a stream with this name, archived or not. |

### `invalid_request`

- `issues` (array of object): One entry per invalid field; absent when a header is wrong.
  - `path` (string, required): The field, dotted, such as to.0.email; empty when the whole body is wrong.
  - `message` (string, required)

Example:

```json
{
  "error": "invalid_request",
  "message": "The request is invalid: to.0: Invalid email address",
  "issues": [
    {
      "path": "to.0",
      "message": "Invalid email address"
    }
  ]
}
```

### `stream_exists`

- `streamId` (string (uuid), required): The stream that already carries the name.

Example:

```json
{
  "error": "stream_exists",
  "message": "This server already has a stream with that name.",
  "streamId": "7c9e6679-7425-40de-944b-e07fc1f90ae7"
}
```
