# Create project

URL: https://docs.hanzo.ai/docs/openapi/project/post-project

> Creates a project — the handle a site is deployed and served under — and answers 201 with it in `draft`.

`POST /v1/project`

> [Project →](https://docs.hanzo.ai/docs/openapi/project) · [All API references →](https://docs.hanzo.ai/docs/openapi) · [Get started →](https://docs.hanzo.ai/docs/guides)

|               |                                        |
| ------------- | -------------------------------------- |
| **Address**   | `https://api.hanzo.ai/v1/project`      |
| **Method**    | `POST`                                 |
| **Operation** | `post_project`                         |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY` |

Creates a project — the handle a site is deployed and served
under — and answers 201 with it in `draft`.

`name` is required; `slug` is derived from the name when omitted and is the
identifier that matters — it becomes the S3 key segment, the public host
`<slug>.hanzo.app`, and the handle every later call addresses, so it must
match `^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$` and may not be a reserved label
such as `api` or `admin`. `framework` is a build hint from a closed set,
defaulting to `static`; it never gates a deploy, it only tells CI how to build
a linked repo.

Two defaults are worth knowing: the analytics beacon is ON unless `analytics`
is explicitly false, and `visibility` is `public` unless asked otherwise.
Publishing publicly is free; PRIVATE is the paid feature, and an unfunded org
asking for it is refused rather than quietly published as public. Creation
also provisions the project's data space and a canonical git repo, both
best-effort — neither can fail the create.

Scope: a validated principal is required (401 without one) and the project is
created in THAT principal's org. The slug is unique per org, so a slug already
used in the caller's own org is a 409 while the same slug in another org is
irrelevant.

## Request

11 fields, body `application/json` (required).

| Field         | In   | Type    | Required | Description                                                                                                                                                                       |
| ------------- | ---- | ------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `analytics`   | body | boolean | —        | Analytics is the opt-OUT for the wired-by-default analytics beacon: absent (nil) ⇒ ON (the default); explicit false ⇒ off.                                                        |
| `description` | body | string  | —        | Description is the one-line summary, copied onto anything forked from this project.                                                                                               |
| `framework`   | body | string  | —        | Framework is a BUILD HINT from a closed set, defaulting to static.                                                                                                                |
| `license`     | body | string  | —        | License is the terms that upstream work carries.                                                                                                                                  |
| `name`        | body | string  | —        | Name is the project's display name and the only REQUIRED field.                                                                                                                   |
| `repo`        | body | object  | —        | Repo links a git source, so pushes to it rebuild this project.                                                                                                                    |
| `repo.branch` | body | string  | —        |                                                                                                                                                                                   |
| `repo.url`    | body | string  | —        |                                                                                                                                                                                   |
| `slug`        | body | string  | —        | Slug is the handle everything else addresses this project by: the public host `&lt;slug&gt;.hanzo.app`, the object-store key segment, and the path parameter of every later call. |
| `upstream`    | body | string  | —        | Upstream credits the third-party work this project was published from.                                                                                                            |
| `visibility`  | body | string  | —        | Visibility is "public" (the default when absent) or "private".                                                                                                                    |

## Response

| Status    | Body                    | Meaning |
| --------- | ----------------------- | ------- |
| `201`     | project.projectsProject | created |
| `default` | problem-details         | refused |

`201` body — 32 fields.

| Field                 | In   | Type                 | Always | Description                                                                                                                                                                                                              |
| --------------------- | ---- | -------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `analytics`           | body | boolean              | —      | Analytics is whether the web-analytics beacon is injected into this site's pages.                                                                                                                                        |
| `bucket`              | body | string               | —      | Bucket is the object-store bucket the site's files are served out of.                                                                                                                                                    |
| `cacheControl`        | body | string               | —      | CacheControl is the Cache-Control policy the edge serves this site's HTML under — how long a reader may hold a stale page before asking again.                                                                           |
| `createdAt`           | body | integer (int64)      | —      | CreatedAt is when the project was created, as Unix seconds.                                                                                                                                                              |
| `currentDeploymentId` | body | string               | —      | CurrentDeploymentID names the deployment currently serving, so a caller can ask what is live without scanning the history.                                                                                               |
| `description`         | body | string               | —      | Description is the one-line summary, which is copied onto forks of this project and shown on a gallery card.                                                                                                             |
| `dropLocal`           | body | boolean              | —      | DropLocal is whether events a developer's own machine sends (localhost, 127.0.0.1, \*.local) are dropped at ingest.                                                                                                      |
| `forkedFrom`          | body | string               | —      | ForkedFrom is the parent this project was forked from ("\<org>/\<slug>" of a published project, or a catalog template slug) — the attribution edge a gallery credits.                                                    |
| `framework`           | body | string               | —      | Framework is a BUILD HINT from a closed set, defaulting to static.                                                                                                                                                       |
| `hidden`              | body | boolean              | —      | Hidden is PLATFORM MODERATION, and it is a different axis from visibility: it pulls a public project out of the catalogue without editing the publisher's own choice, so un-hiding restores exactly what they asked for. |
| `hiddenReason`        | body | string               | —      | HiddenReason is why moderation hid it.                                                                                                                                                                                   |
| `id`                  | body | string               | —      | ID is the project's internal identifier.                                                                                                                                                                                 |
| `internalNetworks`    | body | string\[]            | —      | InternalNetworks are the site's own addresses, as CIDRs ("203.0.113.0/24").                                                                                                                                              |
| `key`                 | body | string               | —      | Key is the project's publishable ingest key, minted at create.                                                                                                                                                           |
| `lastPurgeAt`         | body | integer (int64)      | —      | LastPurgeAt is when the edge cache was last cleared, as Unix seconds, so a console can say how fresh what readers see actually is.                                                                                       |
| `license`             | body | string               | —      | License is the terms that upstream work carries.                                                                                                                                                                         |
| `liveUrl`             | body | string               | —      | LiveURL is where the site answers today.                                                                                                                                                                                 |
| `name`                | body | string               | —      | Name is the project's display name, free text a person chose.                                                                                                                                                            |
| `org`                 | body | string               | —      | Org is the organisation that owns the project, and therefore who pays for it and who may change it.                                                                                                                      |
| `repo`                | body | project.projectsRepo | —      |                                                                                                                                                                                                                          |
| `repo.branch`         | body | string               | —      | Branch is the ref a push has to touch for this project to rebuild.                                                                                                                                                       |
| `repo.provider`       | body | string               | —      | Provider is the forge the URL was recognised as — it decides which webhook and which credential reach the repository, and is DERIVED from the URL rather than chosen by the caller.                                      |
| `repo.url`            | body | string               | —      | URL is the clone address of the repository this project builds from.                                                                                                                                                     |
| `slug`                | body | string               | —      | Slug is the identifier that MATTERS: the handle every later call addresses, the S3 key segment the site's objects live under, and the label of the public host `&lt;slug&gt;.hanzo.app`.                                 |
| `space`               | body | string               | —      | Space is the project's Base data space, which is where a deployed site's form, forum and data submissions land.                                                                                                          |
| `starred`             | body | boolean              | —      | Starred is THIS CALLER's star, not a property of the project — two people in the same org see different values for the same row, which is the whole point of it.                                                         |
| `status`              | body | string               | —      | Status is where the project stands — whether a build has ever succeeded and whether anything is serving right now.                                                                                                       |
| `tags`                | body | object               | —      | Tags is the site's browser tag config: platform slug → non-secret pixel id (GA measurement, Meta pixel, …) — what track.js injects and the server CAPI reads, per site.                                                  |
| `tags.*`              | body | string               | —      |                                                                                                                                                                                                                          |
| `updatedAt`           | body | integer (int64)      | —      | UpdatedAt is when the project's own record last changed, as Unix seconds.                                                                                                                                                |
| `upstream`            | body | string               | —      | Upstream credits the third-party work this project was published from — a free-text line, because the honest answer is a name and a title that no enum could hold.                                                       |
| `visibility`          | body | string               | —      | Visibility is "public" or "private", and Hidden reports platform moderation.                                                                                                                                             |

Failure carries the platform error shape — see [Errors](https://docs.hanzo.ai/docs/errors).

## Examples

**CLI**

```bash
hanzo project create
```

**SDK**

**.ts**

```ts
import { Configuration, ProjectApi } from 'hanzoai';

const api = new ProjectApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.postProject({ analytics: false, description: "<description>" });
```

**.py**

```python
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import ProjectApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = ProjectApi(client).post_project(analytics=False, description="<description>")
```

**.go**

```go
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.ProjectAPI.PostProject(context.Background()).Execute()
if err != nil {
	return err
}
```

**.rs**

```rust
use hanzo_client::apis::{configuration::Configuration, project_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = project_api::post_project(&cfg, Default::default()).await?;
```

**.java**

```java
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.ProjectApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new ProjectApi(client).postProject();
```

**HTTP**

```bash
curl -X POST https://api.hanzo.ai/v1/project \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "analytics": false,
       "description": "<description>"
     }'
```

**MCP**

Tool `project`, op `post_project` — POST the JSON-RPC envelope to `https://api.hanzo.ai/v1/mcp`.

```bash
curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "project",
         "arguments": {
           "op": "post_project",
           "input": {
             "analytics": false,
             "description": "<description>"
           }
         }
       }
     }'
```

---

[Project API](https://docs.hanzo.ai/docs/openapi/project) · [All Hanzo APIs](https://docs.hanzo.ai/docs/openapi) · [Interactive reference](https://docs.hanzo.ai/docs/openapi/reference)
