---
title: "Roll a container back"
method: POST
path: "/containers/{id}/rollback"
tags: ["Containers"]
---

# Roll a container back

`POST /containers/{id}/rollback`

## Request

- Base URL: `https://api.hypamoon.com/api/v1`
- URL: `https://api.hypamoon.com/api/v1/containers/{id}/rollback`
- Auth: one of:
  - HTTP bearer
  - OAuth 2 (authorization code, authorization URL `https://app.hypamoon.com/oauth/authorize`, token URL `https://api.hypamoon.com/oauth/token`, scopes: `sites:write`)

Puts an earlier version live again (same image and settings) as a new version, with the same health check as a deploy (202).

## Path parameters

- `id` string, uuid, required

## Request body

- object
  - `version` integer, required: The version to go back to (list_container_versions).

## Response `202`

The container and the rollback in the queue.

- object
  - `id` string, uuid, required
  - `site_id` string, uuid, required
  - `name` string, required
  - `url` string, required
  - `mode` 'live' | 'test', required
  - `status` 'deploying' | 'running' | 'failed' | 'suspended', required
  - `suspended` object
    - `reason` 'blocked' | 'site_offline' | 'plan' | 'balance', required
    - `since` string, required
    - `next_step` string, required
  - `version` integer, required: The live version; 0 until the first deploy is live.
  - `instance_type` string, required
  - `instances` integer, required
  - `always_on` boolean, required
  - `sleep_after` string, required
  - `port` integer, required
  - `health_path` string, required
  - `allowed_hosts` string[], required
  - `secrets` string[], required
  - `env_secrets` object[], required
    - `secret` string, required
    - `as` string, required
  - `env_names` string[], required: Names of the plain environment variables (never the values of secrets).
  - `created_at` string, required
  - `updated_at` string, required
  - `deploy` object, required
    - `version` integer, required
    - `status` 'queued' | 'deploying' | 'live' | 'previous' | 'failed', required: queued and deploying: still running; live: serving traffic; previous: an older live version; failed: see error.
    - `source` object, required
      - `kind` 'image' | 'build' | 'rollback' | 'settings', required
      - `image` string
      - `runtime` string
      - `from_version` integer
    - `created_at` string, required
    - `steps` object[]: How the rollout went, step by step.
      - `step` string, required
      - `ms` number, required
      - `ok` boolean, required
    - `error` object: Why it failed; log is the end of the build output.
      - `code` string, required
      - `message` string, required
      - `log` string
    - `build` object: For a build from source: the dependency scan. Known vulnerabilities are listed, not blocked; known malicious packages block the deploy.
      - `packages` integer, required
      - `vulnerable` object[], required
        - `package` string, required
        - `ids` string[], required
      - `scan_skipped` string
      - `seconds` number, required
  - `kept` string[]

## Other responses

- `400`: Bad Request: invalid_json.
- `401`: Unauthorized: unauthorized, missing_api_key, invalid_api_key, api_key_revoked, project_deleted.
- `403`: Forbidden: project_not_enabled, key_mode_mismatch, missing_scope, verification_required.
- `404`: Not Found: not_found.
- `409`: Conflict: conflict.
- `422`: Unprocessable Content: validation_failed.
- `429`: Too Many Requests: rate_limited.
- `500`: Internal Server Error: internal_error.
- `503`: Service Unavailable: service_unavailable.

---

[API](https://skmtc.dev/hypamoon/apis/hypamoon-api.md) · [All operations](https://skmtc.dev/hypamoon/apis/hypamoon-api/llms.txt) · [OpenAPI document](https://skmtc.dev/hypamoon/apis/hypamoon-api/revisions/9f0b90004c06?raw)
