> For the complete documentation index, see [llms.txt](https://docs.sealsecurity.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sealsecurity.io/reference/public-api/generate-fix.md).

# Generate fix

Trigger Generate fix in bulk for one or more packages.

**Description:** Triggers Seal's Generate fix flow for one or more packages in a single call. The flow queues a build pipeline on Seal's side; the sealed version appears on the Protection page when the build completes.

**Path:** `https://external.sealsecurity.io/authenticated/api/v1/generate-fix`

**Method:** POST

**Authentication:** Bearer token. See [Authentication](https://docs.sealsecurity.io/reference/public-api.md#authentication).

#### Request body

```json
{
  "packages": [
    {
      "library_name": "string",
      "library_version": "string",
      "ecosystem": "string"
    }
  ]
}
```

| Field      | Type                                | Required | Description                                                |
| ---------- | ----------------------------------- | -------- | ---------------------------------------------------------- |
| `packages` | array of package identifier objects | yes      | The packages to trigger Generate fix for. 1 to 50 entries. |

Each package identifier object:

| Field             | Type   | Required | Description                                                                                                               |
| ----------------- | ------ | -------- | ------------------------------------------------------------------------------------------------------------------------- |
| `library_name`    | string | yes      | The package name as the package manager identifies it.                                                                    |
| `library_version` | string | yes      | The vulnerable version to seal.                                                                                           |
| `ecosystem`       | string | yes      | The package manager (for example, `NPM`, `PyPI`, `Maven`, `RPM`, `DEB`, `APK`). Must be a value accepted by the platform. |

#### Response

```json
{
  "results": [
    {
      "library_name": "string",
      "library_version": "string",
      "ecosystem": "string",
      "status": "string",
      "message": "string"
    }
  ]
}
```

**Response Fields:**

| Field     | Type                    | Description                                                                        |
| --------- | ----------------------- | ---------------------------------------------------------------------------------- |
| `results` | array of result objects | One result per input package, in the same order as the request's `packages` array. |

Each result object:

| Field             | Type           | Description                                                                                                                                          |
| ----------------- | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| `library_name`    | string         | The package name from the request.                                                                                                                   |
| `library_version` | string         | The vulnerable version from the request.                                                                                                             |
| `ecosystem`       | string         | The ecosystem from the request.                                                                                                                      |
| `status`          | string         | The trigger result. One of: `triggered`, `not_found`, `unfixable`, `no_open_vulnerabilities`, `sealed_version_available`, `quota_exceeded`, `error`. |
| `message`         | string or null | Human-readable detail. `null` when not applicable.                                                                                                   |

**Status values:**

| Value                      | Meaning                                                                                                                                                                                                                                                                           |
| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `triggered`                | Generate fix was queued for this package.                                                                                                                                                                                                                                         |
| `not_found`                | The package and version are not known to Seal.                                                                                                                                                                                                                                    |
| `unfixable`                | Seal cannot generate a sealed version for this package (for example, the patch would inherently introduce breaking changes).                                                                                                                                                      |
| `no_open_vulnerabilities`  | Generate fix was not triggered because the version a fix would target has no open vulnerabilities. That is the safest sealed version of the requested version when one exists, otherwise the requested version itself. The `message` field names that version.                    |
| `sealed_version_available` | Generate fix was not triggered because a newer version of the same package already fixes every open vulnerability of the requested version. That version can be a public version or a sealed version. Use it instead of requesting a fix. The `message` field names that version. |
| `quota_exceeded`           | Generate fix was not triggered because your tenant has reached its fix request quota. The `message` field carries the detail.                                                                                                                                                     |
| `error`                    | An unexpected error occurred while triggering Generate fix. The `message` field carries the detail.                                                                                                                                                                               |

#### Example

**Request (cURL):**

```bash
curl -X POST \
  'https://external.sealsecurity.io/authenticated/api/v1/generate-fix' \
  -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "packages": [
      { "library_name": "ejs",     "library_version": "2.7.4",  "ecosystem": "NPM"   },
      { "library_name": "requests","library_version": "2.31.0", "ecosystem": "PyPI" },
      { "library_name": "no-such-pkg","library_version": "1.0.0","ecosystem": "NPM" }
    ]
  }'
```

**Example Response:**

```json
{
  "results": [
    {
      "library_name": "ejs",
      "library_version": "2.7.4",
      "ecosystem": "NPM",
      "status": "triggered",
      "message": null
    },
    {
      "library_name": "requests",
      "library_version": "2.31.0",
      "ecosystem": "PyPI",
      "status": "triggered",
      "message": null
    },
    {
      "library_name": "no-such-pkg",
      "library_version": "1.0.0",
      "ecosystem": "NPM",
      "status": "not_found",
      "message": "Package not found in Seal's database"
    }
  ]
}
```
