# Rollbacks and history

Source: https://openpanel.sh/docs/deploy/rollbacks

A service's deployment history, and rolling back to an earlier deployment's image with today's settings.

Every service keeps its [deployments](/docs/concepts/deployments). A rollback makes a new deployment that runs an earlier deployment's image again.

## See the history [#see-the-history]

<Tabs items={["Console","CLI","API"]}>
<Tab value="Console">
Open the project and click the service on the canvas. Its **Deployments** tab lists every deployment, newest first, with its state, who or what started it, when, and how long it took. Click one to see its image or commit, the servers it ran on, and when it started and finished.
</Tab>

<Tab value="CLI">
```sh
openpanel deployments web --project shop
```

```
   ID                                    STATUS      IMAGE       ROLLBACK OF  CREATED
*  01a23328-fac0-7005-82e3-8b074df35cdc  running     nginx:1.28  -            2026-12-01 19:50
   01a23328-eb7e-7005-9836-5fd13a13143f  superseded  nginx:1.27  -            2026-12-01 19:48
```

`*` marks the deployment the service runs now.
</Tab>

<Tab value="API">
```sh
curl "https://openpanel.sh/api/v1/services/$SERVICE_ID/deployments" \
  -H "Authorization: Bearer $OPENPANEL_TOKEN"
```

The newest 100, newest first, in pages of `{ data, nextCursor }`. The service's `deploymentId` names the one it runs now.
</Tab>
</Tabs>

## Roll back [#roll-back]

<Tabs items={["Console","CLI","API"]}>
<Tab value="Console">
Open the project and click the service on the canvas. On its **Deployments** tab, click **Roll back** beside an earlier deployment, then **Roll back** in the dialog. Only a deployment that has an image can be rolled back to.
</Tab>

<Tab value="CLI">
```sh
openpanel rollback --project shop --service web
```

Without an id, the CLI picks the newest deployment before the current one that has an image and did not fail or get cancelled, and asks before it goes on. To pick one yourself, give its id: `openpanel rollback <deployment id>`. Add `--yes` where no one can answer, as in CI.
</Tab>

<Tab value="API">
```sh
curl -X POST "https://openpanel.sh/api/v1/deployments/$DEPLOYMENT_ID/rollback" \
  -H "Authorization: Bearer $OPENPANEL_TOKEN"
```

`$DEPLOYMENT_ID` is the earlier deployment to go back to. The answer is the new deployment, with `rollbackOf` set to it.
</Tab>
</Tabs>

You need deploy access to the project. A rollback rolls out like any deploy: the version that runs now keeps serving until the earlier one is ready.

## The rule: the earlier image, today's settings [#the-rule-the-earlier-image-todays-settings]

A rollback runs the earlier deployment's **image** with the service's **settings and variables of today**: its ports, replicas, health check, limits, start command and secrets as they are set now.

- **Settings are not rolled back.** If a setting broke the service, change it back, then deploy. Rolling back would carry the broken setting along.
- **The service's own source is not changed.** An image service still names its current tag, and a Git service still builds its branch. The next ordinary deploy runs that again. To stay on the earlier version, change the service's tag, or deploy the earlier commit with `--commit`.

## What can be rolled back to [#what-can-be-rolled-back-to]

| Earlier deployment | Rollback |
|---|---|
| An image deployment | Works. Your servers pull the image by its tag again, so if someone has moved the tag since, they get what it points to now. Tags you never move avoid this. |
| A Git deployment whose build succeeded | Works while the image is still on the server that built it: each server keeps the images of the newest five deployments of each service. An older image is gone, the server cannot start it, and the rollback fails after 15 minutes. Deploy that commit again with `--commit` instead. |
| A Git deployment whose build never finished | Refused: "That deployment was never built, so there is no image to go back to." |

## When a deploy fails on its own [#when-a-deploy-fails-on-its-own]

You do not need to roll back after a failed deploy. When a rollout fails, the service goes back to the deployment that was running before it, and on each server the old containers keep serving throughout. See [A deploy or a health check fails](/docs/troubleshooting/deploy-fails).