
# Set the default site

Make a site the workspace default. The default is the site the username subdomain serves, and the one `default` names wherever a path takes a `{siteId}`, as in `GET /sites/default`.

```sh
PATCH https://sitepaste.com/api/v1/public/workspace
```

Requires the `settings` scope.

## Usage

```bash
curl -X PATCH "https://sitepaste.com/api/v1/public/workspace" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "defaultSiteId": "s7k2m0dq1p3z" }'
```

## 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 |
|-------|------|----------|-------------|
| defaultSiteId | string | Yes | The site to make the default, as a short ID. |

## Response

200 OK with the workspace as it now stands.

```json
{
  "id": "wsb347dq94u7",
  "username": "studio",
  "defaultSiteId": "s7k2m0dq1p3z"
}
```

To read the default site's settings, use [GET /sites/default](/api/sites/get-sites-siteid).

## Errors

| Code | Meaning |
|------|---------|
| 422 | `defaultSiteId` is missing or malformed |
| 404 | No site with that ID in your workspace |