# Apply a plan

> Open a plan's issues, each blocked by the ones it depends on.

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

With assign, g1t agents start at once on every issue that depends on nothing, working in parallel, and on the others as what they depend on merges. keep limits it to some of the proposed issues, by their positions counting from 1. A plan is applied once. Needs the Write role or higher.

Each opened issue's `number` is filled in. Issues left out with `keep` stay `null`.

- **Authentication:** Required. Send an [access token](/reference/api/#authentication) as `Authorization: Bearer`.
- **MCP tool:** [`plan`](/reference/mcp/#plan) with `action` `apply`, and the same inputs
- **Scope:** An access token needs [`issues: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. |
| `plan` | string | Yes | The plan's id. |

## Body parameters

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

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `assign` | boolean | No | Put g1t agents on the issues, in dependency order. |
| `keep` | array of integers | No | Positions, counting from 1, of the proposed issues to open. All of them if left out. |

## Example request

```sh
curl -X POST https://api.g1t.sh/repos/flagon-io/hello/plans/pln_01m43s9c4e8g2j6m0q4t8x2b6d/apply \
  -H "Authorization: Bearer $G1T_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "assign": true
  }'
```

## Example response

A successful request answers `200` with:

```json
{
  "id": "pln_01m43s9c4e8g2j6m0q4t8x2b6d",
  "repo_id": "rep_01m3m5q6p0e2qaw6mmjahk0qrr",
  "brief": "Greet people by name, from the command line and the web page.",
  "status": "applied",
  "summary": "Name parsing first, then the two places that print the greeting.",
  "issues": [
    {
      "title": "Greeting should name the caller",
      "body": "Accept an optional name in `greet()` and use it.",
      "labels": [
        "feature"
      ],
      "checks": [
        "cargo test"
      ],
      "files": [
        "src/greet.rs"
      ],
      "depends_on": [],
      "number": 12
    },
    {
      "title": "Show the caller's name on the web page",
      "body": "Read `?name=` and pass it to `greet()`.",
      "labels": [
        "feature"
      ],
      "checks": [
        "cargo test"
      ],
      "files": [
        "src/web.rs"
      ],
      "depends_on": [
        1
      ],
      "number": 13
    }
  ],
  "error": null,
  "author": {
    "id": "usr_01kkntcg1eeb98j62xjm7eh09p",
    "username": "syntaqx",
    "kind": "user",
    "verified": false,
    "workspaces": []
  },
  "created_at": "2026-10-01T17:58:40.006Z",
  "finished_at": "2026-10-01T18:01:12.774Z",
  "progress": [],
  "exchanges": []
}
```

## 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. |
| 402 | `payment_required` | The workspace cannot start this work: it needs the g1t plan or a card check, or it is at a limit. See [usage and billing](/guides/usage-and-billing/#when-work-is-stopped). |
| 403 | `forbidden` | The token is valid but not allowed to do this, such as a member-only change or an agent token outside its repository. |
| 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. |
