{
  "topic": "rollback",
  "section": {
    "n": 5,
    "name": "Manage"
  },
  "title": "Undo a bad update",
  "covers": "Putting an earlier working version back, without a rebuild",
  "summary": "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.",
  "done_when": "The previous version is serving and works.",
  "available": true,
  "who": {
    "connector": "update_app · rollback; read_app · deployments",
    "api": "POST https://ship.embarko.ai/api/apps/{app-name}/rollback",
    "dashboard": "https://embarko.ai/app",
    "needs_human": null
  },
  "steps": {
    "connector": [
      "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.",
      "Anything added after that version (such as a login) disappears until you redeploy a fixed version: tell the person."
    ],
    "http_api": [
      "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).",
      "POST https://ship.embarko.ai/api/apps/{app-name}/rollback with {} or {\"deploymentId\": \"...\"}, the token and X-Agent-Name.",
      "The reply is 202 with statusUrl: poll it until terminal is true."
    ]
  },
  "limits": [
    "Only the last 5 builds are kept."
  ],
  "errors": [
    {
      "code": "no_rollback_target",
      "status": 422,
      "retry": "No",
      "do": "No earlier good deploy. Fix forward instead."
    },
    {
      "code": "rollback_image_unavailable",
      "status": 422,
      "retry": "No",
      "do": "That version is too old to restore; retainCount says how far back you can go."
    },
    {
      "code": "unauthorized",
      "status": 401,
      "retry": "No",
      "do": "Bad token."
    },
    {
      "code": "permission_denied",
      "status": 403,
      "retry": "No",
      "do": "The person who made this token is not allowed to do this. The reply names the permission and their access to the app (or their role). Nothing changed. Tell the person (say_to_user.no_permission); do not try another way round it."
    }
  ],
  "say_to_user": {
    "done": "I put the previous version back, so your app works again. I'll fix the new version next."
  },
  "prerequisites": {
    "read_first": "https://embarko.ai/docs/prerequisites",
    "user": "The person is usually not a developer. They want to know if the app is live, not how.",
    "talk": "Reply in 1-3 short plain sentences: what happened, and what the person needs to do only if something is needed. Do not show commands, API names, tokens, headers or logs, or describe the steps you took, unless the person asks for technical details. If the person is clearly a developer (uses technical terms, asks what you ran), talk to them that way for the rest of the conversation. Never show a token. Never invent a link, name or code: use only what Embarko's replies, this guide or the person give you.",
    "route": "Connector first if it is in your tools, then the HTTP API, then the upload page as a last resort.",
    "domains": "ship.embarko.ai (API), embarko.ai (website), {app-name}.embarko.app (apps): all Embarko.",
    "requires": [
      {
        "topic": "claim",
        "why": "Over HTTP the app must be claimed first; connector apps already are",
        "url": "https://embarko.ai/docs/claim",
        "only": "over HTTP only"
      }
    ]
  },
  "next": "Roll back when the app is down and the cause is not clear yet, then fix and redeploy.",
  "related": [
    {
      "topic": "logs",
      "why": "Find out what broke",
      "url": "https://embarko.ai/docs/logs"
    },
    {
      "topic": "deploy",
      "why": "Redeploy the fix",
      "url": "https://embarko.ai/docs/deploy"
    }
  ],
  "links": {
    "history": "https://ship.embarko.ai/api/apps/{app-name}/deployments",
    "rollback": "https://ship.embarko.ai/api/apps/{app-name}/rollback"
  },
  "url": "https://embarko.ai/docs/rollback",
  "contents": "https://embarko.ai/docs",
  "version": "2026-11-24"
}