# Container Snapshots

**Page:** api/container-snapshots

[Download Raw Markdown](./api/container-snapshots.md)

---

{/* AUTO-GENERATED — Do not edit manually. Regenerate with: npm run docs:api:generate */}



## Container Snapshots

Use these endpoints to manage point-in-time snapshots of a container's filesystem. You can create new snapshots with an optional alias and expiry, list existing snapshots, restore a container to a previous snapshot state, update snapshot aliases, and delete snapshots that are no longer needed.

---

### `GET /api/v1/containers/{id}/snapshots`

Get all snapshots for a container.

#### Parameters

| Name | In | Type | Required | Description |
|------|-----|------|----------|-------------|
| `id` | path | string | Yes | Unique identifier of the container to retrieve snapshots for |



```bash
curl -X GET "https://api.hoody.com/api/v1/containers/507f1f77bcf86cd799439011/snapshots" \
  -H "Authorization: Bearer <token>"
```


```ts
const { data } = await client.api.containers.listSnapshotsIterator({
  id: "507f1f77bcf86cd799439011"
});
```


```json
{
  "statusCode": 200,
  "message": "Snapshots retrieved successfully",
  "data": {
    "container_id": "507f1f77bcf86cd799439011",
    "project_id": "507f1f77bcf86cd799439033",
    "snapshots": [
      {
        "name": "snap-20250115-103000",
        "alias": "backup-2025-01-15",
        "created_at": "2025-01-15T10:30:00.000Z",
        "last_used_at": "2025-01-15T14:00:00.000Z",
        "expires_at": "2025-02-15T10:30:00.000Z",
        "stateful": false,
        "size": 2147483648
      },
      {
        "name": "snap-20250110-080000",
        "alias": "weekly-backup",
        "created_at": "2025-01-10T08:00:00.000Z",
        "last_used_at": null,
        "expires_at": null,
        "stateful": false,
        "size": 1073741824
      }
    ]
  }
}
```


```json
{
  "statusCode": 400,
  "error": "Bad Request",
  "message": "Invalid container ID format"
}
```


```json
{
  "statusCode": 401,
  "error": "Unauthorized",
  "message": "Authentication required"
}
```


```json
{
  "statusCode": 403,
  "error": "Forbidden",
  "message": "You do not have permission to access this container"
}
```


```json
{
  "statusCode": 404,
  "error": "Not Found",
  "message": "Container not found"
}
```


```json
{
  "statusCode": 500,
  "error": "Internal Server Error",
  "message": "An unexpected error occurred"
}
```



---

### `POST /api/v1/containers/{id}/snapshots`

Create a new snapshot for a container. You can optionally provide a human-readable alias and an expiry in days.

#### Parameters

| Name | In | Type | Required | Description |
|------|-----|------|----------|-------------|
| `id` | path | string | Yes | Unique identifier of the container to create snapshot for |

#### Request Body

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `alias` | string | No | Optional user-friendly alias for the snapshot (max 100 characters) |
| `expiry` | number | No | Expiry in days |



```bash
curl -X POST "https://api.hoody.com/api/v1/containers/507f1f77bcf86cd799439011/snapshots" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "alias": "pre-deployment-backup",
    "expiry": 30
  }'
```


```ts
const { data } = await client.api.containers.createSnapshot({
  id: "507f1f77bcf86cd799439011",
  data: {
    alias: "pre-deployment-backup",
    expiry: 30
  }
});
```


```json
{
  "statusCode": 200,
  "message": "Snapshot created successfully",
  "data": {
    "container_id": "507f1f77bcf86cd799439011",
    "project_id": "507f1f77bcf86cd799439033",
    "snapshot": {
      "name": "snap-20250115-145500",
      "alias": "pre-deployment-backup",
      "created_at": "2025-01-15T14:55:00.000Z",
      "last_used_at": null,
      "expires_at": "2025-02-14T14:55:00.000Z",
      "stateful": false,
      "size": 2147483648
    }
  }
}
```


```json
{
  "statusCode": 400,
  "error": "Bad Request",
  "message": "Invalid request payload"
}
```


```json
{
  "statusCode": 401,
  "error": "Unauthorized",
  "message": "Authentication required"
}
```


```json
{
  "statusCode": 403,
  "error": "Forbidden",
  "message": "You do not have permission to create snapshots for this container"
}
```


```json
{
  "statusCode": 404,
  "error": "Not Found",
  "message": "Container not found"
}
```


```json
{
  "statusCode": 500,
  "error": "Internal Server Error",
  "message": "An unexpected error occurred"
}
```



---

### `PATCH /api/v1/containers/{id}/snapshots/{name}`

Restore a container from a snapshot. The container's filesystem state is rolled back to the point in time the snapshot was taken.

#### Parameters

| Name | In | Type | Required | Description |
|------|-----|------|----------|-------------|
| `id` | path | string | Yes | Unique identifier of the container to restore |
| `name` | path | string | Yes | Name of the snapshot to restore from |



```bash
curl -X PATCH "https://api.hoody.com/api/v1/containers/507f1f77bcf86cd799439011/snapshots/snap-20250115-103000" \
  -H "Authorization: Bearer <token>"
```


```ts
const { data } = await client.api.containers.restoreSnapshot({
  id: "507f1f77bcf86cd799439011",
  name: "snap-20250115-103000"
});
```


```json
{
  "statusCode": 200,
  "message": "Container restored from snapshot successfully",
  "data": {
    "success": true,
    "message": "Container restored from snapshot successfully",
    "snapshot": {}
  }
}
```


```json
{
  "statusCode": 400,
  "error": "Bad Request",
  "message": "Invalid snapshot name or container ID"
}
```


```json
{
  "statusCode": 401,
  "error": "Unauthorized",
  "message": "Authentication required"
}
```


```json
{
  "statusCode": 403,
  "error": "Forbidden",
  "message": "You do not have permission to restore this container"
}
```


```json
{
  "statusCode": 404,
  "error": "Not Found",
  "message": "Container or snapshot not found"
}
```


```json
{
  "statusCode": 500,
  "error": "Internal Server Error",
  "message": "An unexpected error occurred"
}
```



---

### `PATCH /api/v1/containers/{id}/snapshots/{name}/alias`

Update the alias of an existing snapshot. Set the alias to `null` to remove the existing alias.

#### Parameters

| Name | In | Type | Required | Description |
|------|-----|------|----------|-------------|
| `id` | path | string | Yes | Unique identifier of the container |
| `name` | path | string | Yes | Name of the snapshot |

#### Request Body

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `alias` | string \| null | Yes | New alias for the snapshot (set to null to remove alias; max 100 characters) |



```bash
curl -X PATCH "https://api.hoody.com/api/v1/containers/507f1f77bcf86cd799439011/snapshots/snap-20250115-103000/alias" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "alias": "production-baseline"
  }'
```


```ts
const { data } = await client.api.containers.updateSnapshotAlias({
  id: "507f1f77bcf86cd799439011",
  name: "snap-20250115-103000",
  data: {
    alias: "production-baseline"
  }
});
```


```json
{
  "statusCode": 200,
  "message": "Snapshot alias updated successfully",
  "data": {
    "container_id": "507f1f77bcf86cd799439011",
    "project_id": "507f1f77bcf86cd799439033",
    "snapshot": {
      "name": "snap-20250115-103000",
      "alias": "production-baseline",
      "created_at": "2025-01-15T10:30:00.000Z",
      "last_used_at": "2025-01-15T14:00:00.000Z",
      "expires_at": "2025-02-15T10:30:00.000Z",
      "stateful": false,
      "size": 2147483648
    }
  }
}
```


```json
{
  "statusCode": 400,
  "error": "Bad Request",
  "message": "Invalid alias value"
}
```


```json
{
  "statusCode": 401,
  "error": "Unauthorized",
  "message": "Authentication required"
}
```


```json
{
  "statusCode": 403,
  "error": "Forbidden",
  "message": "You do not have permission to update snapshots for this container"
}
```


```json
{
  "statusCode": 404,
  "error": "Not Found",
  "message": "Container or snapshot not found"
}
```


```json
{
  "statusCode": 500,
  "error": "Internal Server Error",
  "message": "An unexpected error occurred"
}
```



---

### `DELETE /api/v1/containers/{id}/snapshots/{name}`

Delete a snapshot from a container. This action is irreversible.

#### Parameters

| Name | In | Type | Required | Description |
|------|-----|------|----------|-------------|
| `id` | path | string | Yes | Unique identifier of the container |
| `name` | path | string | Yes | Name of the snapshot to delete |



```bash
curl -X DELETE "https://api.hoody.com/api/v1/containers/507f1f77bcf86cd799439011/snapshots/snap-20250110-080000" \
  -H "Authorization: Bearer <token>"
```


```ts
const { data } = await client.api.containers.deleteSnapshot({
  id: "507f1f77bcf86cd799439011",
  name: "snap-20250110-080000"
});
```


```json
{
  "statusCode": 200,
  "message": "Snapshot deleted successfully",
  "data": {
    "container_id": "507f1f77bcf86cd799439011",
    "project_id": "507f1f77bcf86cd799439033",
    "snapshot_name": "snap-20250110-080000"
  }
}
```


```json
{
  "statusCode": 400,
  "error": "Bad Request",
  "message": "Invalid snapshot name or container ID"
}
```


```json
{
  "statusCode": 401,
  "error": "Unauthorized",
  "message": "Authentication required"
}
```


```json
{
  "statusCode": 403,
  "error": "Forbidden",
  "message": "You do not have permission to delete snapshots for this container"
}
```


```json
{
  "statusCode": 404,
  "error": "Not Found",
  "message": "Container or snapshot not found"
}
```


```json
{
  "statusCode": 500,
  "error": "Internal Server Error",
  "message": "An unexpected error occurred"
}
```




Deleting a snapshot permanently removes the captured state. The container itself is not affected, but you will no longer be able to restore to that point in time.