> For the complete documentation index, see [llms.txt](https://docs.cedana.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cedana.ai/references/api/policy.md).

# Policy

Cedana API for policies

## DELETE /v1/policy/delete

> Delete policy

```json
{"openapi":"3.1.0","info":{"title":"Cedana API","version":"0.0.0-dev"},"tags":[{"description":"Cedana API for policies","name":"Policy"}],"security":[{"api_key":[]}],"components":{"securitySchemes":{},"schemas":{"PolicyDeleteRequest":{"properties":{"id":{"format":"uuid","type":"string"}},"required":["id"],"type":"object"},"HttpError":{"description":"Standard JSON error body for all 4xx/5xx responses.\n\nHandlers return plain-text errors internally; [`normalize_error_response`]\nconverts anything the stack produces (handlers, extractors, the auth layer)\nto this shape, so generated SDK clients can rely on a single error schema.","properties":{"message":{"description":"Human-readable description of what went wrong","type":"string"}},"required":["message"],"type":"object"}}},"paths":{"/v1/policy/delete":{"delete":{"operationId":"policy_delete","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PolicyDeleteRequest"}}},"required":true},"responses":{"200":{"content":{"text/plain":{"schema":{"type":"string"}}},"description":"Policy deleted successfully"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}},"description":"Invalid request body"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}},"description":"Policy not found"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}},"description":"Failed to delete policy from policy table"},"4XX":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}},"description":"Client error"},"5XX":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}},"description":"Server error"}},"summary":"Delete policy","tags":["Policy"]}}}}
```

## GET /v1/policy/list

> List policies with pagination

```json
{"openapi":"3.1.0","info":{"title":"Cedana API","version":"0.0.0-dev"},"tags":[{"description":"Cedana API for policies","name":"Policy"}],"security":[{"api_key":[]}],"components":{"securitySchemes":{},"schemas":{"PaginatedPolicyResponse":{"properties":{"automatic_policies":{"description":"Auto-restore policies (only included when include_automatic=true)","items":{"$ref":"#/components/schemas/AutoRestorePolicyInfo"},"type":["array","null"]},"policies":{"items":{"$ref":"#/components/schemas/PolicyResponse"},"type":"array"},"total_count":{"format":"int64","type":"integer"}},"required":["policies","total_count"],"type":"object"},"AutoRestorePolicyInfo":{"description":"Auto-restore policy info - represents pods/jobs with CEDANA_CHECKPOINT env var","properties":{"checkpoint_id":{"description":"The CEDANA_CHECKPOINT value (checkpoint name)","type":"string"},"cluster_id":{"description":"Cluster ID","type":"string"},"created_at":{"description":"When the resource was created","type":["string","null"]},"id":{"description":"Virtual ID based on the job/pod ID","type":"string"},"name":{"description":"The job or pod name","type":"string"},"namespace":{"description":"Namespace of the resource","type":"string"},"pod_count":{"description":"Number of pods (1 for pods, count for jobs)","format":"int32","type":"integer"},"policy_status":{"description":"Mapped policy status: \"active\", \"completed\", or \"disabled\"","type":"string"},"resource_type":{"description":"Type of resource: \"job\" or \"pod\"","type":"string"},"status":{"description":"Original job/pod status","type":"string"}},"required":["id","name","namespace","cluster_id","resource_type","checkpoint_id","pod_count","status","policy_status"],"type":"object"},"PolicyResponse":{"properties":{"id":{"type":"string"},"input":{"format":"int64","type":"integer"},"job_count":{"format":"int64","type":["integer","null"]},"pod_count":{"format":"int64","type":"integer"},"policy_type":{"type":"string"},"resource":{"type":"string"},"resource_list":{"items":{"type":"string"},"type":"array"},"status":{"type":"string"},"timestamp":{"format":"date-time","type":["string","null"]}},"required":["id","status","policy_type","input","resource","resource_list","pod_count"],"type":"object"},"HttpError":{"description":"Standard JSON error body for all 4xx/5xx responses.\n\nHandlers return plain-text errors internally; [`normalize_error_response`]\nconverts anything the stack produces (handlers, extractors, the auth layer)\nto this shape, so generated SDK clients can rely on a single error schema.","properties":{"message":{"description":"Human-readable description of what went wrong","type":"string"}},"required":["message"],"type":"object"}}},"paths":{"/v1/policy/list":{"get":{"operationId":"policy_list","parameters":[{"description":"Number of results per page (default 50, max 100)","in":"query","name":"limit","required":false,"schema":{"format":"int64","type":["integer","null"]}},{"description":"Offset for pagination (default 0)","in":"query","name":"offset","required":false,"schema":{"format":"int64","type":["integer","null"]}},{"description":"Filter to show only policies with this status (e.g., \"active\", \"creating\", \"disabled\").\nIf not provided, defaults to excluding \"disabled\" policies.","in":"query","name":"status","required":false,"schema":{"type":["string","null"]}},{"description":"Filter by resource type (e.g., \"namespace\", \"pods\", \"jobs\")","in":"query","name":"resource","required":false,"schema":{"type":["string","null"]}},{"description":"Include automatic restore policies (jobs/pods with CEDANA_CHECKPOINT env var)","in":"query","name":"include_automatic","required":false,"schema":{"type":["boolean","null"]}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedPolicyResponse"}}},"description":"Policies retrieved successfully"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}},"description":"Invalid request body"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}},"description":"Failed to retrieve policies from policy table"},"4XX":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}},"description":"Client error"},"5XX":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}},"description":"Server error"}},"summary":"List policies with pagination","tags":["Policy"]}}}}
```

## POST /v1/policy/pipeline/create

> Create a policy using the pipeline format (Trigger -> Filter -> Action)

```json
{"openapi":"3.1.0","info":{"title":"Cedana API","version":"0.0.0-dev"},"tags":[{"description":"Cedana API for policies","name":"Policy"}],"security":[{"api_key":[]}],"components":{"securitySchemes":{},"schemas":{"PipelinePolicyRequest":{"description":"Request to create a policy using the pipeline format","properties":{"name":{"type":["string","null"]},"pipeline":{"$ref":"#/components/schemas/PolicyPipeline"}},"required":["pipeline"],"type":"object"},"PolicyPipeline":{"description":"Complete policy pipeline definition","properties":{"action":{"$ref":"#/components/schemas/PipelineAction"},"filter":{"$ref":"#/components/schemas/PipelineFilter"},"trigger":{"$ref":"#/components/schemas/PipelineTrigger"}},"required":["trigger","filter","action"],"type":"object"},"PipelineAction":{"description":"Action defines WHAT to do when triggered","oneOf":[{"properties":{"config":{"$ref":"#/components/schemas/CheckpointActionConfig"},"type":{"enum":["checkpoint"],"type":"string"}},"required":["config","type"],"type":"object"}]},"CheckpointActionConfig":{"properties":{"kind":{"type":"string"},"runc_root":{"type":["string","null"]}},"required":["kind"],"type":"object"},"PipelineFilter":{"description":"Filter defines WHAT resources are targeted","oneOf":[{"properties":{"config":{"$ref":"#/components/schemas/NamespaceFilterConfig"},"type":{"enum":["namespace"],"type":"string"}},"required":["config","type"],"type":"object"},{"properties":{"config":{"$ref":"#/components/schemas/PodsFilterConfig"},"type":{"enum":["pods"],"type":"string"}},"required":["config","type"],"type":"object"},{"properties":{"config":{"$ref":"#/components/schemas/JobsFilterConfig"},"type":{"enum":["jobs"],"type":"string"}},"required":["config","type"],"type":"object"},{"properties":{"config":{"$ref":"#/components/schemas/SlurmJobsFilterConfig"},"type":{"enum":["slurm_jobs"],"type":"string"}},"required":["config","type"],"type":"object"}]},"NamespaceFilterConfig":{"properties":{"cluster_id":{"type":"string"},"namespace":{"type":"string"}},"required":["cluster_id","namespace"],"type":"object"},"PodsFilterConfig":{"properties":{"cluster_id":{"type":"string"},"pod_ids":{"items":{"type":"string"},"type":"array"}},"required":["cluster_id"],"type":"object"},"JobsFilterConfig":{"properties":{"cluster_id":{"type":"string"},"namespace":{"type":["string","null"]},"priority":{"format":"int32","type":["integer","null"]}},"required":["cluster_id"],"type":"object"},"SlurmJobsFilterConfig":{"description":"Filter config for targeting explicit SLURM jobs by their numeric `slurm_job_id`\n(the value the UI's `SlurmJob` exposes). These are resolved to `slurm_jobs.id` UUIDs\nat policy-creation time and stored in `policy.resource_id`.","properties":{"cluster_id":{"type":"string"},"job_ids":{"items":{"type":"string"},"type":"array"}},"required":["cluster_id"],"type":"object"},"PipelineTrigger":{"description":"Trigger defines WHEN a policy activates","oneOf":[{"properties":{"config":{"$ref":"#/components/schemas/HeartbeatTriggerConfig"},"type":{"enum":["heartbeat"],"type":"string"}},"required":["config","type"],"type":"object"}]},"HeartbeatTriggerConfig":{"properties":{"interval_seconds":{"format":"int32","minimum":0,"type":"integer"},"max_checkpoints":{"description":"Cap on successful checkpoints before auto-disable. Absent = run forever;\nwhen present must be `> 0` (rejected with 400 at creation, not stored).\n`i32` (not u32) bounds an oversized value at deserialization; matches cedana-ui.","format":"int32","type":["integer","null"]}},"required":["interval_seconds"],"type":"object"},"HttpError":{"description":"Standard JSON error body for all 4xx/5xx responses.\n\nHandlers return plain-text errors internally; [`normalize_error_response`]\nconverts anything the stack produces (handlers, extractors, the auth layer)\nto this shape, so generated SDK clients can rely on a single error schema.","properties":{"message":{"description":"Human-readable description of what went wrong","type":"string"}},"required":["message"],"type":"object"}}},"paths":{"/v1/policy/pipeline/create":{"post":{"operationId":"pipeline_policy_create","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PipelinePolicyRequest"}}},"required":true},"responses":{"200":{"content":{"text/plain":{"schema":{"type":"string"}}},"description":"Policy created successfully"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}},"description":"Invalid request body"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}},"description":"Failed to create policy"},"4XX":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}},"description":"Client error"},"5XX":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}},"description":"Server error"}},"summary":"Create a policy using the pipeline format (Trigger -> Filter -> Action)","tags":["Policy"]}}}}
```

## GET /v1/policy/pipeline/list

> List all policies with pipeline definitions (paginated)

```json
{"openapi":"3.1.0","info":{"title":"Cedana API","version":"0.0.0-dev"},"tags":[{"description":"Cedana API for policies","name":"Policy"}],"security":[{"api_key":[]}],"components":{"securitySchemes":{},"schemas":{"PaginatedPipelinePolicyResponse":{"properties":{"policies":{"items":{"$ref":"#/components/schemas/PipelinePolicyResponse"},"type":"array"},"total_count":{"format":"int64","type":"integer"}},"required":["policies","total_count"],"type":"object"},"PipelinePolicyResponse":{"description":"Response for pipeline-based policies","properties":{"id":{"type":"string"},"job_count":{"format":"int32","type":["integer","null"]},"name":{"type":["string","null"]},"pipeline":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/PolicyPipeline"}]},"pod_count":{"format":"int32","type":"integer"},"status":{"type":"string"},"timestamp":{"type":["string","null"]}},"required":["id","status","pod_count"],"type":"object"},"PolicyPipeline":{"description":"Complete policy pipeline definition","properties":{"action":{"$ref":"#/components/schemas/PipelineAction"},"filter":{"$ref":"#/components/schemas/PipelineFilter"},"trigger":{"$ref":"#/components/schemas/PipelineTrigger"}},"required":["trigger","filter","action"],"type":"object"},"PipelineAction":{"description":"Action defines WHAT to do when triggered","oneOf":[{"properties":{"config":{"$ref":"#/components/schemas/CheckpointActionConfig"},"type":{"enum":["checkpoint"],"type":"string"}},"required":["config","type"],"type":"object"}]},"CheckpointActionConfig":{"properties":{"kind":{"type":"string"},"runc_root":{"type":["string","null"]}},"required":["kind"],"type":"object"},"PipelineFilter":{"description":"Filter defines WHAT resources are targeted","oneOf":[{"properties":{"config":{"$ref":"#/components/schemas/NamespaceFilterConfig"},"type":{"enum":["namespace"],"type":"string"}},"required":["config","type"],"type":"object"},{"properties":{"config":{"$ref":"#/components/schemas/PodsFilterConfig"},"type":{"enum":["pods"],"type":"string"}},"required":["config","type"],"type":"object"},{"properties":{"config":{"$ref":"#/components/schemas/JobsFilterConfig"},"type":{"enum":["jobs"],"type":"string"}},"required":["config","type"],"type":"object"},{"properties":{"config":{"$ref":"#/components/schemas/SlurmJobsFilterConfig"},"type":{"enum":["slurm_jobs"],"type":"string"}},"required":["config","type"],"type":"object"}]},"NamespaceFilterConfig":{"properties":{"cluster_id":{"type":"string"},"namespace":{"type":"string"}},"required":["cluster_id","namespace"],"type":"object"},"PodsFilterConfig":{"properties":{"cluster_id":{"type":"string"},"pod_ids":{"items":{"type":"string"},"type":"array"}},"required":["cluster_id"],"type":"object"},"JobsFilterConfig":{"properties":{"cluster_id":{"type":"string"},"namespace":{"type":["string","null"]},"priority":{"format":"int32","type":["integer","null"]}},"required":["cluster_id"],"type":"object"},"SlurmJobsFilterConfig":{"description":"Filter config for targeting explicit SLURM jobs by their numeric `slurm_job_id`\n(the value the UI's `SlurmJob` exposes). These are resolved to `slurm_jobs.id` UUIDs\nat policy-creation time and stored in `policy.resource_id`.","properties":{"cluster_id":{"type":"string"},"job_ids":{"items":{"type":"string"},"type":"array"}},"required":["cluster_id"],"type":"object"},"PipelineTrigger":{"description":"Trigger defines WHEN a policy activates","oneOf":[{"properties":{"config":{"$ref":"#/components/schemas/HeartbeatTriggerConfig"},"type":{"enum":["heartbeat"],"type":"string"}},"required":["config","type"],"type":"object"}]},"HeartbeatTriggerConfig":{"properties":{"interval_seconds":{"format":"int32","minimum":0,"type":"integer"},"max_checkpoints":{"description":"Cap on successful checkpoints before auto-disable. Absent = run forever;\nwhen present must be `> 0` (rejected with 400 at creation, not stored).\n`i32` (not u32) bounds an oversized value at deserialization; matches cedana-ui.","format":"int32","type":["integer","null"]}},"required":["interval_seconds"],"type":"object"},"HttpError":{"description":"Standard JSON error body for all 4xx/5xx responses.\n\nHandlers return plain-text errors internally; [`normalize_error_response`]\nconverts anything the stack produces (handlers, extractors, the auth layer)\nto this shape, so generated SDK clients can rely on a single error schema.","properties":{"message":{"description":"Human-readable description of what went wrong","type":"string"}},"required":["message"],"type":"object"}}},"paths":{"/v1/policy/pipeline/list":{"get":{"operationId":"pipeline_policy_list","parameters":[{"description":"Number of results per page (default 50, max 100)","in":"query","name":"limit","required":false,"schema":{"format":"int64","type":["integer","null"]}},{"description":"Offset for pagination (default 0)","in":"query","name":"offset","required":false,"schema":{"format":"int64","type":["integer","null"]}},{"description":"Filter to show only policies with this status (e.g., \"active\", \"creating\", \"disabled\").\nIf not provided, defaults to excluding \"disabled\" policies.","in":"query","name":"status","required":false,"schema":{"type":["string","null"]}},{"description":"Filter by resource type (e.g., \"namespace\", \"pods\", \"jobs\")","in":"query","name":"resource","required":false,"schema":{"type":["string","null"]}},{"description":"Include automatic restore policies (jobs/pods with CEDANA_CHECKPOINT env var)","in":"query","name":"include_automatic","required":false,"schema":{"type":["boolean","null"]}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedPipelinePolicyResponse"}}},"description":"Policies retrieved successfully"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}},"description":"Failed to retrieve policies"},"4XX":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}},"description":"Client error"},"5XX":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}},"description":"Server error"}},"summary":"List all policies with pipeline definitions (paginated)","tags":["Policy"]}}}}
```

## GET /v1/policy/pipeline/{policy\_id}

> Get a single policy with its pipeline definition

```json
{"openapi":"3.1.0","info":{"title":"Cedana API","version":"0.0.0-dev"},"tags":[{"description":"Cedana API for policies","name":"Policy"}],"security":[{"api_key":[]}],"components":{"securitySchemes":{},"schemas":{"PipelinePolicyResponse":{"description":"Response for pipeline-based policies","properties":{"id":{"type":"string"},"job_count":{"format":"int32","type":["integer","null"]},"name":{"type":["string","null"]},"pipeline":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/PolicyPipeline"}]},"pod_count":{"format":"int32","type":"integer"},"status":{"type":"string"},"timestamp":{"type":["string","null"]}},"required":["id","status","pod_count"],"type":"object"},"PolicyPipeline":{"description":"Complete policy pipeline definition","properties":{"action":{"$ref":"#/components/schemas/PipelineAction"},"filter":{"$ref":"#/components/schemas/PipelineFilter"},"trigger":{"$ref":"#/components/schemas/PipelineTrigger"}},"required":["trigger","filter","action"],"type":"object"},"PipelineAction":{"description":"Action defines WHAT to do when triggered","oneOf":[{"properties":{"config":{"$ref":"#/components/schemas/CheckpointActionConfig"},"type":{"enum":["checkpoint"],"type":"string"}},"required":["config","type"],"type":"object"}]},"CheckpointActionConfig":{"properties":{"kind":{"type":"string"},"runc_root":{"type":["string","null"]}},"required":["kind"],"type":"object"},"PipelineFilter":{"description":"Filter defines WHAT resources are targeted","oneOf":[{"properties":{"config":{"$ref":"#/components/schemas/NamespaceFilterConfig"},"type":{"enum":["namespace"],"type":"string"}},"required":["config","type"],"type":"object"},{"properties":{"config":{"$ref":"#/components/schemas/PodsFilterConfig"},"type":{"enum":["pods"],"type":"string"}},"required":["config","type"],"type":"object"},{"properties":{"config":{"$ref":"#/components/schemas/JobsFilterConfig"},"type":{"enum":["jobs"],"type":"string"}},"required":["config","type"],"type":"object"},{"properties":{"config":{"$ref":"#/components/schemas/SlurmJobsFilterConfig"},"type":{"enum":["slurm_jobs"],"type":"string"}},"required":["config","type"],"type":"object"}]},"NamespaceFilterConfig":{"properties":{"cluster_id":{"type":"string"},"namespace":{"type":"string"}},"required":["cluster_id","namespace"],"type":"object"},"PodsFilterConfig":{"properties":{"cluster_id":{"type":"string"},"pod_ids":{"items":{"type":"string"},"type":"array"}},"required":["cluster_id"],"type":"object"},"JobsFilterConfig":{"properties":{"cluster_id":{"type":"string"},"namespace":{"type":["string","null"]},"priority":{"format":"int32","type":["integer","null"]}},"required":["cluster_id"],"type":"object"},"SlurmJobsFilterConfig":{"description":"Filter config for targeting explicit SLURM jobs by their numeric `slurm_job_id`\n(the value the UI's `SlurmJob` exposes). These are resolved to `slurm_jobs.id` UUIDs\nat policy-creation time and stored in `policy.resource_id`.","properties":{"cluster_id":{"type":"string"},"job_ids":{"items":{"type":"string"},"type":"array"}},"required":["cluster_id"],"type":"object"},"PipelineTrigger":{"description":"Trigger defines WHEN a policy activates","oneOf":[{"properties":{"config":{"$ref":"#/components/schemas/HeartbeatTriggerConfig"},"type":{"enum":["heartbeat"],"type":"string"}},"required":["config","type"],"type":"object"}]},"HeartbeatTriggerConfig":{"properties":{"interval_seconds":{"format":"int32","minimum":0,"type":"integer"},"max_checkpoints":{"description":"Cap on successful checkpoints before auto-disable. Absent = run forever;\nwhen present must be `> 0` (rejected with 400 at creation, not stored).\n`i32` (not u32) bounds an oversized value at deserialization; matches cedana-ui.","format":"int32","type":["integer","null"]}},"required":["interval_seconds"],"type":"object"},"HttpError":{"description":"Standard JSON error body for all 4xx/5xx responses.\n\nHandlers return plain-text errors internally; [`normalize_error_response`]\nconverts anything the stack produces (handlers, extractors, the auth layer)\nto this shape, so generated SDK clients can rely on a single error schema.","properties":{"message":{"description":"Human-readable description of what went wrong","type":"string"}},"required":["message"],"type":"object"}}},"paths":{"/v1/policy/pipeline/{policy_id}":{"get":{"operationId":"pipeline_policy_get","parameters":[{"description":"Policy UUID","in":"path","name":"policy_id","required":true,"schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PipelinePolicyResponse"}}},"description":"Policy retrieved successfully"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}},"description":"Policy not found"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}},"description":"Failed to retrieve policy"},"4XX":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}},"description":"Client error"},"5XX":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}},"description":"Server error"}},"summary":"Get a single policy with its pipeline definition","tags":["Policy"]}}}}
```

## POST /v1/policy/sync-jobs

> Sync job policies manually

```json
{"openapi":"3.1.0","info":{"title":"Cedana API","version":"0.0.0-dev"},"tags":[{"description":"Cedana API for policies","name":"Policy"}],"security":[{"api_key":[]}],"components":{"securitySchemes":{},"schemas":{"HttpError":{"description":"Standard JSON error body for all 4xx/5xx responses.\n\nHandlers return plain-text errors internally; [`normalize_error_response`]\nconverts anything the stack produces (handlers, extractors, the auth layer)\nto this shape, so generated SDK clients can rely on a single error schema.","properties":{"message":{"description":"Human-readable description of what went wrong","type":"string"}},"required":["message"],"type":"object"}}},"paths":{"/v1/policy/sync-jobs":{"post":{"operationId":"sync_job_policies","responses":{"200":{"content":{"text/plain":{"schema":{"type":"string"}}},"description":"Job policies synced successfully"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}},"description":"Failed to sync job policies"},"4XX":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}},"description":"Client error"},"5XX":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}},"description":"Server error"}},"summary":"Sync job policies manually","tags":["Policy"]}}}}
```

## GET /v1/policy/{policy\_id}/activity

> Get checkpoint activity for a policy

```json
{"openapi":"3.1.0","info":{"title":"Cedana API","version":"0.0.0-dev"},"tags":[{"description":"Cedana API for policies","name":"Policy"}],"security":[{"api_key":[]}],"components":{"securitySchemes":{},"schemas":{"PolicyActivityResponse":{"properties":{"failed_checkpoints":{"format":"int64","type":"integer"},"last_checkpoint_at":{"type":["string","null"]},"policy_id":{"type":"string"},"recent_checkpoints":{"items":{"$ref":"#/components/schemas/PolicyCheckpointInfo"},"type":"array"},"successful_checkpoints":{"format":"int64","type":"integer"},"total_checkpoints":{"format":"int64","type":"integer"}},"required":["policy_id","total_checkpoints","successful_checkpoints","failed_checkpoints","recent_checkpoints"],"type":"object"},"PolicyCheckpointInfo":{"properties":{"action_id":{"type":"string"},"checkpoint_id":{"type":"string"},"completed_at":{"type":["string","null"]},"duration_ms":{"format":"int64","type":["integer","null"]},"namespace":{"type":"string"},"pod_name":{"type":"string"},"size_bytes":{"format":"int64","type":["integer","null"]},"status":{"type":"string"}},"required":["checkpoint_id","action_id","pod_name","namespace","status"],"type":"object"},"HttpError":{"description":"Standard JSON error body for all 4xx/5xx responses.\n\nHandlers return plain-text errors internally; [`normalize_error_response`]\nconverts anything the stack produces (handlers, extractors, the auth layer)\nto this shape, so generated SDK clients can rely on a single error schema.","properties":{"message":{"description":"Human-readable description of what went wrong","type":"string"}},"required":["message"],"type":"object"}}},"paths":{"/v1/policy/{policy_id}/activity":{"get":{"operationId":"policy_activity","parameters":[{"description":"Policy ID to get activity for","in":"path","name":"policy_id","required":true,"schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PolicyActivityResponse"}}},"description":"Policy checkpoint activity"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}},"description":"Policy not found"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}},"description":"Internal server error"},"4XX":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}},"description":"Client error"},"5XX":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}},"description":"Server error"}},"summary":"Get checkpoint activity for a policy","tags":["Policy"]}}}}
```

## GET /v1/policy/{policy\_id}/job-status

> Get job policy tracking status

```json
{"openapi":"3.1.0","info":{"title":"Cedana API","version":"0.0.0-dev"},"tags":[{"description":"Cedana API for policies","name":"Policy"}],"security":[{"api_key":[]}],"components":{"securitySchemes":{},"schemas":{"JobPolicyStatus":{"properties":{"job_ids":{"items":{"type":"string"},"type":"array"},"job_status":{"type":["string","null"]},"last_updated":{"type":["string","null"]},"pod_count":{"format":"int64","type":"integer"},"policy_id":{"type":"string"},"tracked_pods":{"items":{"type":"string"},"type":"array"}},"required":["policy_id","job_ids","tracked_pods","pod_count"],"type":"object"},"HttpError":{"description":"Standard JSON error body for all 4xx/5xx responses.\n\nHandlers return plain-text errors internally; [`normalize_error_response`]\nconverts anything the stack produces (handlers, extractors, the auth layer)\nto this shape, so generated SDK clients can rely on a single error schema.","properties":{"message":{"description":"Human-readable description of what went wrong","type":"string"}},"required":["message"],"type":"object"}}},"paths":{"/v1/policy/{policy_id}/job-status":{"get":{"operationId":"get_job_policy_status","parameters":[{"description":"Policy ID to get status for","in":"path","name":"policy_id","required":true,"schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobPolicyStatus"}}},"description":"Job policy status"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}},"description":"Policy not found"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}},"description":"Internal server error"},"4XX":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}},"description":"Client error"},"5XX":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}},"description":"Server error"}},"summary":"Get job policy tracking status","tags":["Policy"]}}}}
```

## GET /v1/policy/{policy\_id}/jobs

> Get jobs affected by a policy

```json
{"openapi":"3.1.0","info":{"title":"Cedana API","version":"0.0.0-dev"},"tags":[{"description":"Cedana API for policies","name":"Policy"}],"security":[{"api_key":[]}],"components":{"securitySchemes":{},"schemas":{"PolicyJobsResponse":{"properties":{"affected_jobs":{"items":{"$ref":"#/components/schemas/PolicyJobInfo"},"type":"array"},"count":{"format":"int64","type":"integer"},"policy_id":{"type":"string"}},"required":["policy_id","affected_jobs","count"],"type":"object"},"PolicyJobInfo":{"properties":{"id":{"type":"string"},"name":{"type":"string"},"namespace":{"type":"string"},"pod_count":{"format":"int64","type":"integer"},"priority":{"format":"int32","type":["integer","null"]},"status":{"type":"string"}},"required":["id","name","namespace","status","pod_count"],"type":"object"},"HttpError":{"description":"Standard JSON error body for all 4xx/5xx responses.\n\nHandlers return plain-text errors internally; [`normalize_error_response`]\nconverts anything the stack produces (handlers, extractors, the auth layer)\nto this shape, so generated SDK clients can rely on a single error schema.","properties":{"message":{"description":"Human-readable description of what went wrong","type":"string"}},"required":["message"],"type":"object"}}},"paths":{"/v1/policy/{policy_id}/jobs":{"get":{"operationId":"policy_jobs","parameters":[{"description":"Policy ID to get affected jobs for","in":"path","name":"policy_id","required":true,"schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PolicyJobsResponse"}}},"description":"Jobs affected by the policy"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}},"description":"Policy not found or not a job policy"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}},"description":"Internal server error"},"4XX":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}},"description":"Client error"},"5XX":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}},"description":"Server error"}},"summary":"Get jobs affected by a policy","tags":["Policy"]}}}}
```

## Get pods monitored by a specific policy

> For namespace/pods policies, returns pods directly tracked by the policy.\
> For job policies, returns pods belonging to the jobs tracked by the policy.

```json
{"openapi":"3.1.0","info":{"title":"Cedana API","version":"0.0.0-dev"},"tags":[{"description":"Cedana API for policies","name":"Policy"}],"security":[{"api_key":[]}],"components":{"securitySchemes":{},"schemas":{"PolicyPodResponse":{"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"},"namespace":{"type":"string"},"status":{"type":"string"}},"required":["id","name","namespace","status"],"type":"object"},"HttpError":{"description":"Standard JSON error body for all 4xx/5xx responses.\n\nHandlers return plain-text errors internally; [`normalize_error_response`]\nconverts anything the stack produces (handlers, extractors, the auth layer)\nto this shape, so generated SDK clients can rely on a single error schema.","properties":{"message":{"description":"Human-readable description of what went wrong","type":"string"}},"required":["message"],"type":"object"}}},"paths":{"/v1/policy/{policy_id}/pods":{"get":{"description":"For namespace/pods policies, returns pods directly tracked by the policy.\nFor job policies, returns pods belonging to the jobs tracked by the policy.","operationId":"policy_pods","parameters":[{"description":"Policy UUID","in":"path","name":"policy_id","required":true,"schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/PolicyPodResponse"},"type":"array"}}},"description":"Returns pods currently monitored by the policy"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}},"description":"Invalid policy_id format"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}},"description":"Policy not found"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}},"description":"Failed to connect/fetch from database"},"4XX":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}},"description":"Client error"},"5XX":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}},"description":"Server error"}},"summary":"Get pods monitored by a specific policy","tags":["Policy"]}}}}
```
