
# Create a site

Create a site. A request beyond the sites your plan has paid for returns 402 with the current counts and charges nothing.

```sh
POST https://sitepaste.com/api/v1/public/sites
```

Requires the `settings` scope.

## Usage

```bash
curl -X POST "https://sitepaste.com/api/v1/public/sites" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Portfolio" }'
```

## Authorizations

| Header | Type | Required | Description |
|--------|------|----------|-------------|
| Authorization | string | Yes | Bearer token (`Authorization: Bearer sp_...`). Created in the dashboard under Account > Tokens. See [authentication](/api/authentication). |

## Body

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| name | string | Yes | The site's name, up to 100 characters. Leading and trailing spaces are removed. The new site is not made the default; use [set the default site](/api/workspace/patch-workspace) for that. |

## Errors

422 when `name` is missing, empty after trimming, or longer than 100 bytes; `fields` names it.

A 402 names the reason and the capacity, in the standard [error envelope](/api/overview#errors) with the counts alongside:

```json
{
  "error": "Site limit reached. Add more sites to your plan.",
  "code": "site_limit_reached",
  "limit": 2,
  "used": 2
}
```

Nothing is created when the request is refused. Buy the capacity in the dashboard, then retry.

## Response

201 Created with the new site's full settings document, in the same shape [read a site](/api/sites/get-sites-siteid) returns, and a `Location` header naming it.