# Create a security advisory

> Create a draft security advisory: title, description (Markdown), severity (critical, high, medium or low), and optionally cvss_vector and cvss_score, cve_id, the package affected (ecosystem, package, affected_versions, patched_versions) and credits.

<div class="g1t-endpoint"><span class="g1t-method" data-method="post">POST</span><code>/repos/{owner}/{name}/security/advisories</code></div>

Admin on the repository, or a security manager of its workspace. Nobody is told of a draft.

The advisory starts as a draft nobody but the maintainers sees; publish it with `POST …/advisories/{id}/state`. Takes the Admin role, or a security manager of the workspace. A title or severity that is missing, or a `cve_id` that is not of the form `CVE-2026-12345`, is `422`.

- **Authentication:** Required. Send an [access token](/reference/api/#authentication) as `Authorization: Bearer`.
- **MCP tool:** [`security`](/reference/mcp/#security) with `action` `create_advisory`, and the same inputs
- **Scope:** An access token needs [`security:write`](/guides/authentication/#scopes).

## Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `owner` | string | Yes | The workspace that owns the repository. |
| `name` | string | Yes | The repository's name. |

## Body parameters

Send a JSON object. Names are `snake_case`, as in responses; the `camelCase` spelling is accepted too.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `title` | string | Yes | One line: what the vulnerability is. At most 200 characters. |
| `description` | string | No | Markdown: what is affected, how it is exploited, what to do. At most 20,000 characters. |
| `severity` | string | Yes | How bad it is. One of `critical`, `high`, `medium`, `low`. |
| `cvss_vector` | string | No | A CVSS vector string, when scored: CVSS:3.1/AV:N/… |
| `cvss_score` | number | No | The CVSS base score, 0 to 10. |
| `cve_id` | string | No | CVE-2026-12345, when one was issued elsewhere. |
| `ecosystem` | string | No | How the affected package is distributed: npm, crates.io, Go, PyPI, or how the project ships. |
| `package` | string | No | The package affected. |
| `affected_versions` | string | No | The versions affected, as a range: >= 1.2.0, &lt; 1.4.1 |
| `patched_versions` | string | No | The versions that fix it: >= 1.4.1 |
| `credits` | array of strings | No | Who found or fixed it: usernames or names, up to 20. |

## Example request

```sh
curl -X POST https://api.g1t.sh/repos/flagon-io/hello/security/advisories \
  -H "Authorization: Bearer $G1T_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Path traversal in the archive reader",
    "description": "A crafted archive could write outside the directory it is extracted to.",
    "severity": "high",
    "ecosystem": "npm",
    "package": "@flagon/hello",
    "affected_versions": ">= 1.2.0, < 1.4.1",
    "patched_versions": ">= 1.4.1",
    "credits": [
      "ana"
    ]
  }'
```

## Example response

A successful request answers `200` with:

```json
{
  "id": "adv_01kq2p9f6g7h8j9k0m1n2p3q4r",
  "g1tsa_id": "G1TSA-2026-h7kd-3mqw",
  "repo_id": "rep_01kq2p9f6g7h8j9k0m1n2p3q4r",
  "repo": "flagon-io/hello",
  "title": "Path traversal in the archive reader",
  "description": "A crafted archive could write outside the directory it is extracted to.",
  "severity": "high",
  "cvss_vector": null,
  "cvss_score": null,
  "cve_id": null,
  "ecosystem": "npm",
  "package": "@flagon/hello",
  "affected_versions": ">= 1.2.0, < 1.4.1",
  "patched_versions": ">= 1.4.1",
  "state": "draft",
  "credits": [
    "ana"
  ],
  "report_id": null,
  "created_by": "syntaqx",
  "created_at": "2026-10-06T09:14:02.118Z",
  "updated_at": "2026-10-06T09:14:02.118Z",
  "published_at": null,
  "withdrawn_at": null
}
```

## Errors

A failed request answers with one of these statuses and a body like `{"error": {"code": "not_found", "message": "Repository not found."}}`. See [errors](/reference/api/#errors).

| Status | Code | When |
| --- | --- | --- |
| 401 | `unauthenticated` | A token is required, or the one sent is not valid. |
| 403 | `forbidden` | The token is valid but not allowed to do this, such as a member-only change, or a token without the scope it needs. |
| 404 | `not_found` | It does not exist, or you cannot see it. |
| 409 | `conflict` | The request conflicts with the current state. |
| 422 | `invalid` | The input is not valid. `message` says which field and why. |
