> 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

**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 iteration 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](/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`, `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). |
| `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"
    }
  ]
}
```
