# Create a project

`POST /v1/upload`

Upload a website, document, or collection of files and get a shareable hostname.

**Effect.** Creates a project and may publish files publicly. With a key and an existing owned `domain`, it replaces that project's files. Confirm what the user wants to publish before sending files.

## Authentication

Use exactly one header: `x-api-key: <key>` for an account upload, or `x-email: <address>` for a [temporary preview](../../guides/email-previews/) when the address has no account.

## Request

`Content-Type: multipart/form-data`. Let the HTTP client set the boundary.

| Field | Type | Required | Constraints |
| --- | --- | --- | --- |
| `files` | Repeated binary part | Yes | One part per nonempty file, with a filename. For a static ZIP, include a root `index.html`. |
| `domain` | String | No | Hostname only. Omit for an auto-generated name. An existing owned name selects replacement. |
| `settings` | JSON-encoded string | No | One multipart text part. See [Project settings](../../guides/project-settings/). |
| `ogImageFile` | Binary | No | JPG, JPEG, PNG, GIF, or WebP. Maximum 300 KiB. |
| `logoImageFile` | Binary | No | JPG, JPEG, PNG, GIF, or WebP. Maximum 64 × 64 pixels. |

Explore [Projects](../../sites/) for individual workflows, including [access control](../../sites/access-control/), [search indexing](../../sites/search-indexing/), [visitor comments](../../sites/comments/), [link appearance](../../sites/metadata/), and [custom domains](../../sites/domains/).

## Example

```bash
curl --fail-with-body https://ext.tiiny.host/v1/upload \
  -H "x-api-key: $TIINY_API_KEY" \
  -F 'files=@index.html' -F 'files=@styles.css'
```

## Success response

```json
{"success":true,"data":{"link":"example.tiiny.site","status":"active","inPreviewMode":false,"linkPreviewType":"NONE","profile":{"quotaUsed":524288,"projectLimit":5}}}
```

| Field | Meaning |
| --- | --- |
| `data.link` | Returned hostname. Prefix it with `https://` for the live URL. |
| `data.status` | Account status, when available. |
| `data.inPreviewMode`, `data.linkPreviewType` | Whether the link is temporary and why. |
| `data.profile` | In API-key responses, `quotaUsed` comes from before the upload. Solo returns `projectLimit`. Other plans return `accountLimit`. Email-only responses omit the profile. |

The large-upload worker can return `{"link":{…},"files":[…]}` instead of the usual envelope.

## Errors

| HTTP | Code or condition | What to do |
| --- | --- | --- |
| 400 | `INVALID_DOMAIN`, `FILES_REQUIRED`, `NO_INDEX_FILE` | Fix the hostname or multipart parts. For an archive, check the returned `htmlFileList` if present. |
| 400 | `INVALID_SITE_SETTINGS` | Inspect the field-level `errors` array. See [Settings reference](../../sites/settings/#validation-response). |
| 401 | Missing key, ineligible email, or unauthorized replacement | Check authentication and ownership. |
| 403 | Unknown or API-disabled key | Check the key and account eligibility. |
| 403 | `CUSTOM_DOMAIN_NOT_OWNED` | Connect the domain with `POST /v1/custom-domains` first. See [Custom domains](../../sites/domains/). |
| 413 | `FILE_SIZE_LIMIT_EXCEEDED`, `LINK_LIMIT_REACHED`, `SOLO_UPLOAD_LIMIT_REACHED`, `PRO_UPLOAD_LIMIT_REACHED`, or gateway request cap | Check [file, storage, and project limits](../../errors/). |
| 429 | `RATE_LIMIT_EXCEEDED` | Wait for the daily quota to reset. |

After an uncertain result, check [Fetch profile](../fetch-profile/) before creating again. An automatic retry without a domain can create a duplicate project.
