---
title: "POST /v2/costformation/publish-jobs/{jobId}/cancel"
method: POST
path: "/v2/costformation/publish-jobs/{jobId}/cancel"
tags: ["costformation"]
---

# POST /v2/costformation/publish-jobs/{jobId}/cancel

`POST /v2/costformation/publish-jobs/{jobId}/cancel`

## Request

- Base URL: `https://api.cloudzero.com`
- URL: `https://api.cloudzero.com/v2/costformation/publish-jobs/{jobId}/cancel`
- Auth: API key in header `Authorization`
- TypeScript: <https://skmtc.dev/cloudzero/apis/cloudzero-api-v2-resources/docs/v2/costformation/publish-jobs/:jobId/cancel/post.ts> (a function with typed inputs; its response is checked against the schema)

Cancel a `pending` CostFormation publish job. Jobs that have already started processing (`in_progress`) or reached a terminal state cannot be cancelled.

## Path parameters

- `jobId` string, required

## Response `200`

Successful Operation

- CostformationPublishJobDetail: Detailed status and result information for a publish job.
  - `job_id` string: Unique identifier for the publish job.
  - `cz_organization_id` string: The organization that owns this job.
  - `status` string: Current status of the publish job. One of: `pending`, `in_progress`, `completed`, `failed`, `superseded`, `cancelled`.
  - `created_at` string, date-time: ISO 8601 timestamp when the job was created.
  - `updated_at` string, date-time: ISO 8601 timestamp of the last status update.
  - `attempt_count` integer: Number of processing attempts made.
  - `max_attempts` integer: Maximum number of processing attempts allowed.
  - `completed_at` string, date-time, nullable: ISO 8601 timestamp when the job reached a terminal state.
  - `error_message` string, nullable: Error details if the job failed.
  - `error_code` string, nullable: Error classification code if the job failed. One of: `TRANSIENT`, `VALIDATION`, `RESOURCE_NOT_FOUND`, `RATE_LIMITED`, `SYSTEM_ERROR`.
  - `definition_version` string, nullable: The version of the definition created by this job (set on completion).
  - `validation_errors` object, nullable: Validation error details when a job fails with error_code VALIDATION.

## Other responses

- `403`: Forbidden
- `404`: Not Found Error
- `409`: Job cannot be cancelled because it is not in `pending` status.

---

[API](https://skmtc.dev/cloudzero/apis/cloudzero-api-v2-resources.md) - [All operations](https://skmtc.dev/cloudzero/apis/cloudzero-api-v2-resources/llms.txt) - [OpenAPI document](https://skmtc.dev/cloudzero/apis/cloudzero-api-v2-resources/revisions/56a692cf51b1?raw)
