---
title: "Expire messages on the stream"
method: POST
path: "/_fabric/{fabric}/_api/streams/{stream}/expiry/{seconds}"
tags: ["Streams"]
---

# Expire messages on the stream

`POST /_fabric/{fabric}/_api/streams/{stream}/expiry/{seconds}`

## Request

- The document declares no server URL.
- Auth: one of:
  - API key in header `Authorization`
  - HTTP bearer
- TypeScript: <https://skmtc.dev/macrometa/apis/macrometa-api-reference/docs/_fabric/:fabric/_api/streams/:stream/expiry/:seconds/post.ts> (a function with typed inputs; its response is checked against the schema)

Set the expiration time for all messages on the stream, this applies to all subscriptions.

## Path parameters

- `fabric` string, string, required
- `stream` string, string, required
- `seconds` integer, required

## Response `200`

Successfully set the expiration time.

- SetStreamTtlExampleRc200
  - `error` boolean: Flag if there is an error in response. *False* for this response.
  - `code` integer: The generated response code.
  - `result` string

## Other responses

- `400`: Failed due to missing or malformed data. Verify that all parameters are complete.
- `401`: Failed because you do not have administrator permissions.
- `409`: Failed due to expiration of message by timestamp not issued on a topic.

---

[API](https://skmtc.dev/macrometa/apis/macrometa-api-reference.md) - [All operations](https://skmtc.dev/macrometa/apis/macrometa-api-reference/llms.txt) - [OpenAPI document](https://skmtc.dev/macrometa/apis/macrometa-api-reference/revisions/2006b6d7f31d?raw)
