---
title: "Cancel schema generation"
method: POST
path: "/targets/{target_id}/schema-generation/cancel/"
tags: ["Schema Generation"]
---

# Cancel schema generation

`POST /targets/{target_id}/schema-generation/cancel/`

## Request

- Base URL: `https://api.probely.com`
- URL: `https://api.probely.com/targets/{target_id}/schema-generation/cancel/`
- Auth: API key in header `Authorization`

Cancels the target's active schema generation job. Responds with 202 and the cancelled job, or 409 when there is no active job to cancel.

## Path parameters

- `target_id` string, required

## Response `202`

- SchemaGenerationJob: Read-only representation of a SchemaGenerationJob for the API. Flattens the job plus its related Snyk project and API scan settings into the response shape consumed by the frontend. Never used for writes.
  - `job_id` string, required
  - `status` string, required
  - `target_id` string, required
  - `target_type` string, required: Schema flavor the job was created for. Reports the job's snapshot (``schema_type``) so the API never shows a flavour the job is not actually generating after the target's settings change. Falls back to the current API scan settings for jobs created before the snapshot existed.
  - `project_id` string, required: Snyk project id, falling back to the snapshot when SET_NULL fired.
  - `repository_name` string, required: Repository full name (owner/repo) from the linked Snyk project.
  - `branch` string, required: [Deprecated] Retained for backwards compatibility; empty for new jobs because SGS resolves the repository's default branch.
  - `created_at` string, date-time, required
  - `started_at` string, date-time, required
  - `completed_at` string, date-time, required
  - `error_code` string, required
  - `error_message` string, required
  - `progress` SchemaGenerationProgress, required: Nested progress object reported by SGS for an in-flight job.
    - `stage` string, nullable, required
    - `message` string, nullable, required
    - `percentage` integer, nullable, required
    - `estimated_time_remaining_seconds` integer, nullable, required

## Other responses

- `401`
- `403`
- `404`
- `409`: No active generation job.
- `500`

## Changes

- **2026-11-03** `0b2f6cbe644d`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/probely/apis/snyk-api-web-s-api-reference-documentation/changes/targets/:target_id/schema-generation/cancel/post.md)

---

[API](https://skmtc.dev/probely/apis/snyk-api-web-s-api-reference-documentation.md) - [All operations](https://skmtc.dev/probely/apis/snyk-api-web-s-api-reference-documentation/llms.txt) - [OpenAPI document](https://skmtc.dev/probely/apis/snyk-api-web-s-api-reference-documentation/revisions/0b2f6cbe644d?raw)
