---
topic: rollback
connector: "update_app · rollback; read_app · deployments"
api: "POST https://ship.embarko.ai/api/apps/{app-name}/rollback"
requires: [claim]
---

[← Guide home](https://embarko.ai/docs)

# Undo a bad update

**On this page:** With the connector, Over HTTP, Limits, Errors, What to tell the person

> Plain words unless the person is a developer. Never invent a link, name or code. [Rules](https://embarko.ai/docs/prerequisites) Needs first: [claim](https://embarko.ai/docs/claim) (over HTTP only).

Switch the app back to an earlier successful deploy, with no rebuild. With no deploymentId it goes to the most recent successful deploy that is not the current one. It keeps today's env vars and domains, and DATA_DIR is not rolled back: older code runs against today's data. A feature added after that version (such as a login) is gone until you redeploy.

**Connector:** update_app · rollback; read_app · deployments

**Done when:** The previous version is serving and works.

**With the connector**

1. Call update_app { action: "rollback", appName } for the previous version. If the newest successful deploy is itself the broken one, call read_app { action: "deployments", appName } and pass the deploymentId of the last deploy before the problem started.
2. Anything added after that version (such as a login) disappears until you redeploy a fixed version: tell the person.

**Over HTTP**

1. Optional: GET https://ship.embarko.ai/api/apps/{app-name}/deployments to pick one (rollbackTarget: true marks valid ones). If the latest successful deploy is itself the broken one, pick the one before it: deploys are newest first, so take the first rollbackTarget entry older than the deploy where the problem started (compare times and versions).
2. POST https://ship.embarko.ai/api/apps/{app-name}/rollback with {} or {"deploymentId": "..."}, the token and X-Agent-Name.
3. The reply is 202 with statusUrl: poll it until terminal is true.

**Limits**

- Only the last 5 builds are kept.

**Errors**

| Code | Status | Retry | What to do |
| --- | --- | --- | --- |
| `no_rollback_target` | 422 | No | No earlier good deploy. Fix forward instead. |
| `rollback_image_unavailable` | 422 | No | That version is too old to restore; retainCount says how far back you can go. |
| `unauthorized` | 401 | No | Bad token. |

**What to tell the person**

- done: "I put the previous version back, so your app works again. I'll fix the new version next."

**Next:** Roll back when the app is down and the cause is not clear yet, then fix and redeploy.

**Related:** [logs](https://embarko.ai/docs/logs) · [deploy](https://embarko.ai/docs/deploy)

---

[Guide home](https://embarko.ai/docs) · JSON: add .json