---
title: "Snapshot a machine"
method: POST
path: "/v1/machines/{machine_id}/snapshot"
tags: ["machines"]
---

# Snapshot a machine

`POST /v1/machines/{machine_id}/snapshot`

## Request

- Base URL: `https://coasty.ai`
- URL: `https://coasty.ai/v1/machines/{machine_id}/snapshot`
- Auth: one of:
  - API key in header `X-API-Key`
  - HTTP bearer
- TypeScript: <https://skmtc.dev/coasty/apis/coasty-public-api/docs/v1/machines/:machine_id/snapshot/post.ts> (a function with typed inputs; its response is checked against the schema)

Managed machines only. External machines return 400 UNSUPPORTED_MACHINE_KIND because Coasty does not own their disks. For managed machines, captures a restorable image and requires `snapshots:write`. The configured one-time fee is charged before dispatch. A conclusive pre-creation rejection is refunded; a timeout, 5xx, or malformed post-dispatch result may already have created the image and returns terminal 503 SNAPSHOT_OUTCOME_UNKNOWN without a blind refund/re-execution.

## Headers

- `Idempotency-Key` string

## Response `200`

Snapshot created.

- SnapshotResponse
  - `machine_id` string, required
  - `snapshot_id` string, required
  - `name` string, required
  - `created_at` string, date-time, required
  - `credits_charged` integer, required
  - `request_id` string, required

## Other responses

- `400`: Invalid request body or parameters.
- `401`: Missing, invalid, or revoked API key. Pass `X-API-Key: sk-coasty-live-...` (or test).
- `402`: Insufficient balance for this operation. Direct metered API calls and managed-machine runtime use the prepaid Developer API wallet; scheduled execution is the documented consumer subscription-credit exception. Follow the operation's billing fields and top up the matching balance in the dashboard.
- `403`: API key lacks the required scope or tier-feature is unavailable on the caller's plan.
- `404`: Resource not found in this key's namespace.
- `409`: The resource state conflicts with this operation.
- `413`: The request body exceeds the endpoint limit.
- `422`: The JSON shape is valid but one or more values violate the endpoint contract.
- `429`: Rate or concurrency limit exceeded.
- `500`: Unexpected server error. Retry with exponential backoff.
- `502`: An upstream dependency returned an invalid response.
- `503`: A required service is temporarily unavailable.
- `504`: An upstream dependency timed out.

---

[API](https://skmtc.dev/coasty/apis/coasty-public-api.md) - [All operations](https://skmtc.dev/coasty/apis/coasty-public-api/llms.txt) - [OpenAPI document](https://skmtc.dev/coasty/apis/coasty-public-api/revisions/f50d93b0d8a1?raw)
