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

# Trigger schema generation

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

## Request

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

Triggers a repository-based schema generation job for the target. Idempotent: returns the existing active job with 200 when one is already running, or the newly created job with 202. Responds with 400 when the target has no repository source configured. The optional `branch` field is deprecated and ignored.

## Path parameters

- `target_id` string, required

## Request body

- SchemaGenerationTrigger: Request body for the trigger (create) endpoint. ``branch`` is deprecated: it is still accepted for backwards compatibility but ignored. SGS resolves the repository's default branch itself, so no branch is ever sent to it.
  - `branch` string, nullable: [Deprecated] Optional branch override. Accepted for backwards compatibility but ignored: SGS resolves the repository's default branch itself, so this value has no effect on generation.

## Response `200`

- 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

- `202`
- `400`
- `401`
- `403`
- `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/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)
