# Actions

Cedana API for actions

## GET /v2/actions

> List actions

```json
{"openapi":"3.1.0","info":{"title":"Cedana API","version":"0.0.0-staging"},"tags":[{"name":"Actions","description":"Cedana API for actions"}],"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"http","scheme":"bearer"}},"schemas":{"Action":{"type":"object","required":["action_id","checkpoint_id","status","type","details","gpu","platform"],"properties":{"action_id":{"type":"string","format":"uuid"},"action_timestamp":{"type":["string","null"],"format":"date-time"},"checkpoint_completed_timestamp":{"type":["string","null"],"format":"date-time"},"checkpoint_id":{"type":"string","format":"uuid"},"details":{},"gpu":{"type":"string"},"node_name":{"type":["string","null"]},"platform":{"type":"string"},"reason":{"type":["string","null"]},"status":{"type":"string"},"total_duration":{"type":["integer","null"],"format":"int64"},"total_io":{"type":["integer","null"],"format":"int64"},"type":{"type":"string"}}},"ApiError":{"type":"object","description":"Standard error response for API endpoints","required":["message"],"properties":{"code":{"type":["string","null"],"description":"HTTP status code"},"details":{"description":"Optional additional error details"},"message":{"type":"string","description":"Error message describing what went wrong"}}}}},"paths":{"/v2/actions":{"get":{"tags":["Actions"],"summary":"List actions","operationId":"list","parameters":[{"name":"type","in":"query","required":false,"schema":{"type":["string","null"]}}],"responses":{"200":{"description":"Returns the actions with status","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Action"}}}}},"400":{"description":"Failed list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Failed to connect/fetch from jobs table from database","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}}}}
```

## GET /v2/actions/from\_pod/{id}

> Get latest action belonging to a pod

```json
{"openapi":"3.1.0","info":{"title":"Cedana API","version":"0.0.0-staging"},"tags":[{"name":"Actions","description":"Cedana API for actions"}],"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"http","scheme":"bearer"}},"schemas":{"ApiError":{"type":"object","description":"Standard error response for API endpoints","required":["message"],"properties":{"code":{"type":["string","null"],"description":"HTTP status code"},"details":{"description":"Optional additional error details"},"message":{"type":"string","description":"Error message describing what went wrong"}}}}},"paths":{"/v2/actions/from_pod/{id}":{"get":{"tags":["Actions"],"summary":"Get latest action belonging to a pod","operationId":"latest_pod_action_id","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The action_id of the given pod_id has been fetched successfully","content":{"text/plain":{"schema":{"type":"string"}}}},"404":{"description":"Failed to get action_id for the given pod_id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Failed to connect/fetch from pods_to_actions table from database","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}}}}
```

## POST /v2/actions/upload

> Upload pod spec

```json
{"openapi":"3.1.0","info":{"title":"Cedana API","version":"0.0.0-staging"},"tags":[{"name":"Actions","description":"Cedana API for actions"}],"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"http","scheme":"bearer"}},"schemas":{"CheckpointStatusWithPodSpec":{"type":"object","required":["status","action_id"],"properties":{"action_id":{"type":"string"},"persistent_volume_claim":{},"pod_id":{"type":["string","null"]},"pod_metadata_spec":{},"pod_spec":{},"status":{"type":"string"}}},"ApiError":{"type":"object","description":"Standard error response for API endpoints","required":["message"],"properties":{"code":{"type":["string","null"],"description":"HTTP status code"},"details":{"description":"Optional additional error details"},"message":{"type":"string","description":"Error message describing what went wrong"}}}}},"paths":{"/v2/actions/upload":{"post":{"tags":["Actions"],"summary":"Upload pod spec","operationId":"upload_podspec","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckpointStatusWithPodSpec"}}},"required":true},"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string"}}}},"404":{"description":"Failed to get action_id within the db","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Failed to connect/fetch from pods_to_actions table from database","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}}}}
```

## Get path of latest checkpoint

> Returns the path of the latest successful checkpoint for a given checkpoint name

```json
{"openapi":"3.1.0","info":{"title":"Cedana API","version":"0.0.0-staging"},"tags":[{"name":"Actions","description":"Cedana API for actions"}],"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"http","scheme":"bearer"}},"schemas":{"ApiError":{"type":"object","description":"Standard error response for API endpoints","required":["message"],"properties":{"code":{"type":["string","null"],"description":"HTTP status code"},"details":{"description":"Optional additional error details"},"message":{"type":"string","description":"Error message describing what went wrong"}}}}},"paths":{"/v2/checkpoint/path":{"get":{"tags":["Actions"],"summary":"Get path of latest checkpoint","description":"Returns the path of the latest successful checkpoint for a given checkpoint name","operationId":"get_latest_checkpoint_for_container_in_action","responses":{"200":{"description":"Returns the restore path","content":{"text/plain":{"schema":{"type":"string"}}}},"400":{"description":"Failed to get action for request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Failed to connect/fetch from jobs table from database","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}}}}
```

## POST /v2/checkpoint/pod

> Checkpoint pod

```json
{"openapi":"3.1.0","info":{"title":"Cedana API","version":"0.0.0-staging"},"tags":[{"name":"Actions","description":"Cedana API for actions"}],"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"http","scheme":"bearer"}},"schemas":{"CheckpointPod":{"type":"object","properties":{"action_id":{"type":["string","null"],"readOnly":true},"cluster_id":{"type":["string","null"]},"kind":{"$ref":"#/components/schemas/CheckpointKind"},"namespace":{"type":["string","null"]},"overrides":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/CheckpointOverrides"}]},"pod_id":{"type":["string","null"]},"pod_name":{"type":["string","null"]},"reason":{"$ref":"#/components/schemas/CheckpointReason"}}},"CheckpointKind":{"type":"string","enum":["simple","rootfs","rootfsonly"]},"CheckpointOverrides":{"type":"object","properties":{"asynchronous":{"type":"boolean"},"compression":{"type":["string","null"]},"criu_opts":{"type":["string","null"]},"directory":{"type":["string","null"]},"streams":{"type":"integer","format":"int32"}}},"CheckpointReason":{"type":"string","enum":["heartbeat","manual"]},"ApiError":{"type":"object","description":"Standard error response for API endpoints","required":["message"],"properties":{"code":{"type":["string","null"],"description":"HTTP status code"},"details":{"description":"Optional additional error details"},"message":{"type":"string","description":"Error message describing what went wrong"}}}}},"paths":{"/v2/checkpoint/pod":{"post":{"tags":["Actions"],"summary":"Checkpoint pod","operationId":"checkpoint_pod","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckpointPod"}}},"required":true},"responses":{"200":{"description":"Returns the ID for the task","content":{"text/plain":{"schema":{"type":"string"}}}},"400":{"description":"Invalid request parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Failed to find checkpointable resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Failed to create checkpoint or connect to eventstream","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}}}}
```

## Get status of checkpoint action

> Returns the current status of a checkpoint action

```json
{"openapi":"3.1.0","info":{"title":"Cedana API","version":"0.0.0-staging"},"tags":[{"name":"Actions","description":"Cedana API for actions"}],"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"http","scheme":"bearer"}},"schemas":{"StatusResponse":{"type":"object","required":["status"],"properties":{"details":{"type":["string","null"]},"status":{"$ref":"#/components/schemas/CheckpointOperationStatus"}}},"CheckpointOperationStatus":{"type":"string","enum":["initialized","processing","checkpoint_created","ready","error","not_found"]},"ApiError":{"type":"object","description":"Standard error response for API endpoints","required":["message"],"properties":{"code":{"type":["string","null"],"description":"HTTP status code"},"details":{"description":"Optional additional error details"},"message":{"type":"string","description":"Error message describing what went wrong"}}}}},"paths":{"/v2/checkpoint/status/{action_id}":{"get":{"tags":["Actions"],"summary":"Get status of checkpoint action","description":"Returns the current status of a checkpoint action","operationId":"get_checkpoint_status","parameters":[{"name":"action_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Returns the current status of the checkpoint operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponse"}}}},"404":{"description":"Action ID not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Failed to retrieve status from database","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}}}}
```

## POST /v2/restore/pod

> Restore pod

```json
{"openapi":"3.1.0","info":{"title":"Cedana API","version":"0.0.0-staging"},"tags":[{"name":"Actions","description":"Cedana API for actions"}],"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"http","scheme":"bearer"}},"schemas":{"RestorePod":{"type":"object","required":["action_id","reason"],"properties":{"action_id":{"type":"string"},"cluster_id":{"type":"string"},"overrides":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/RestoreOverrides"}]},"reason":{"$ref":"#/components/schemas/RestoreReason"}}},"RestoreOverrides":{"type":"object","properties":{"criu_opts":{"type":["string","null"]},"pod_name":{"type":["string","null"]}}},"RestoreReason":{"type":"string","enum":["nodeTermination","nodeUnschedulable","manual"]},"ApiError":{"type":"object","description":"Standard error response for API endpoints","required":["message"],"properties":{"code":{"type":["string","null"],"description":"HTTP status code"},"details":{"description":"Optional additional error details"},"message":{"type":"string","description":"Error message describing what went wrong"}}}}},"paths":{"/v2/restore/pod":{"post":{"tags":["Actions"],"summary":"Restore pod","operationId":"restore_pod","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RestorePod"}}},"required":true},"responses":{"200":{"description":"Returns the action ID for the new restore","content":{"text/plain":{"schema":{"type":"string"}}}},"400":{"description":"Invalid action_id or request parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Failed to create restore or connect to eventstream","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cedana.ai/references/api/actions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
