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

# Observe and roll back Flow

> Read logs, follow revisions, and recover deployments

Observability routes require `flow:read`. Rollback requires `flow:write`.

## Read logs

`GET /flow/functions/:name/logs`

| Query parameter | Description                                            |
| --------------- | ------------------------------------------------------ |
| `start`         | ISO timestamp; defaults to one hour before the request |
| `end`           | Optional ISO timestamp                                 |
| `limit`         | Optional result limit                                  |
| `query`         | Optional log query                                     |
| `level`         | Optional level filter                                  |
| `revision_id`   | Optional revision filter                               |

The JSON response is shaped like:

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "logs": [
    {
      "timestamp": "2026-08-09T12:00:00.000Z",
      "level": "info",
      "message": "request complete"
    }
  ],
  "next_cursor": null
}
```

Send `Accept: text/event-stream` for live logs. Use `revision_id` to isolate logs from one deployment.

## Follow deployment status

`GET /flow/functions/:name/status`

Without a query parameter, the endpoint returns up to ten recent revisions:

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "revisions": [
    {
      "id": "revision-id",
      "status": "succeeded",
      "failure_reason": null,
      "created_at": "2026-08-09T12:00:00.000Z"
    }
  ]
}
```

Add `?revision_id=REVISION_ID` to receive an SSE progress stream.

## Roll back

`POST /flow/functions/:name/rollback`

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "revision_id": "revision-id"
}
```

The response confirms that rollback has started:

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "status": "rolling_back",
  "revision_id": "revision-id"
}
```

Follow the revision status after requesting a rollback. Keep the revision ID of the last known-good deployment in your release record.

## Troubleshooting

| Symptom                        | What to check                                                  |
| ------------------------------ | -------------------------------------------------------------- |
| Function is still provisioning | Poll status with the returned revision ID.                     |
| Revision failed                | Filter logs by the revision ID and inspect the failure reason. |
| Invocation is denied           | Confirm the caller has `flow:invoke`.                          |
| Logs are too broad             | Add `start`, `end`, `level`, `query`, or `revision_id`.        |
