# Write the first commit on an empty repository's default branch.

> For a GitHub repository with no commits: Koidog writes one commit (empty, or holding the `files` you give) on the default branch and pushes it, so crews can branch from it.
> https://koi.dog/docs/api/projects/seed-project/

`POST /api/v1/projects/{id}/seed` · Scope: `approve`

Koidog never writes to a default branch on its own; this is that request, recorded with who made it. A project with no remote repository is seeded by Koidog when it is created; calling this for one answers its seed. The launch blocker `repo_empty` names this action. The timeline records the key ID, action and outcome.

## Path parameters.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | yes | The project's id. |

## Headers.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `Idempotency-Key` | `string` | no | Retry the same request with the same key. [Retry rules](https://koi.dog/docs/api/#retries). |

## Body.

An omitted body is read as `{}`.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `files` | `array` | no | Files the first commit holds, written exactly as given. Empty (the default): an empty commit with no files. At most 10 files of 64 KB each; no path under `.github/` (a workflow would run with the repository's secrets). At most 10 items. Default empty. |
| `files[].path` | `string` | yes | Where the file goes, relative to the repository's root, such as `README.md` or `koidog.json`. 1 to 200 characters. |
| `files[].content` | `string` | yes | The file's text, written exactly as given. At most 65536 characters. |
| `message` | `string` | no | The commit message. Default: "Start <project name>". 1 to 200 characters. |

## Response.

200 OK · JSON object

- **409 already_seeded**: Refused with `409 already_seeded` when the branch has a commit.
- **422 validation_failed**: Each schema error appears in `details`.

## Request.

```sh
curl -X POST "https://api.koi.dog/api/v1/projects/$ID/seed" \
    -H "Authorization: Bearer $KOIDOG_API_KEY" \
    -H "Idempotency-Key: $(uuidgen)"
```

```js
const res = await fetch(`https://api.koi.dog/api/v1/projects/${process.env.ID}/seed`, {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.KOIDOG_API_KEY}`,
    "Idempotency-Key": crypto.randomUUID(),
  },
});
console.log(await res.json());
```

```python
import os
import uuid

import requests

r = requests.post(
    f"https://api.koi.dog/api/v1/projects/{os.environ['ID']}/seed",
    headers={
        "Authorization": f"Bearer {os.environ['KOIDOG_API_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
)
r.raise_for_status()
print(r.json())
```

## Response example.

```json
{
  "project": {
    "id": "string",
    "name": "string",
    "repo": "string",
    "defaultBranch": "string",
    "instructions": "string",
    "validation": { … },
    …
  },
  "sha": "string",
  "pushed": false
}
```
