# Quickstart

Publish a local file and open the link returned by Tiiny Host.

## Connect an agent

Paste this prompt into your agent.

```text
Help me set up Tiiny Host so you can publish files and websites for me.
If npm and Agent Skills are available, install the official Tiiny Host skill:
npx skills add tiiny-host/skills -y -g
Otherwise, read the publishing skill at https://raw.githubusercontent.com/Tiiny-Host/skills/main/skills/SKILL.md and use the REST API, or connect to https://mcp.tiiny.host if you support remote MCP.
Read the API documentation at https://tiiny.host/docs/ and ask me what I'd like to publish. Wait for my answer before uploading anything.
```

## Get an API key

| Workflow | Credential |
| --- | --- |
| Account upload, update, list, delete | `x-api-key: <key>`. Generate it in [Manage Account → API Key](https://tiiny.host/manage) on Solo or above. Store it as `TIINY_API_KEY` in your environment. |
| Temporary upload | `x-email: <address>` on POST upload only, for an address without an account. See [email-only previews](../guides/email-previews/). |
| Remote agent tools | [MCP](../guides/mcp/) supports API-key and email sign-in modes, with a separate OAuth endpoint. |

## Publish a file

`POST https://ext.tiiny.host/v1/upload` takes `multipart/form-data`. Repeat `files` once per nonempty file. For a ZIP containing a static site, put `index.html` at the archive root. Leave `domain` out to generate a hostname.

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

## Open the link

`200 OK` normally returns this shape for a Solo account:

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

Open `https://` + `data.link`. If `inPreviewMode` is `true`, tell the user it is temporary and report `linkPreviewType`. See [Create a project](../reference/create-project/#success-response) for the large-upload response.

## Manage the project

| Intent | Operation | What to verify |
| --- | --- | --- |
| Find an owned project | [GET /v1/profile](../reference/fetch-profile/) | Read `data.links[].subdomain`. |
| Replace project files | [PUT /v1/upload](../reference/update-project/) | Confirm the hostname and send the complete file set. |
| Delete an entire project | [DELETE /v1/delete](../reference/delete-project/) | Confirm the exact hostname and deletion with the user. |
| Recover after a timeout | [Errors and limits](../errors/#recover-from-an-uncertain-upload) | Check whether the write completed before sending it again. |

## If the first request fails

| Result | Next step |
| --- | --- |
| `FILES_REQUIRED` | Check that `index.html` exists locally, is not empty, and is sent as a `files` multipart part. |
| `NO_INDEX_FILE` | Check that a static site's ZIP has `index.html` at its root; inspect `htmlFileList` if the response includes it. |
| `401` or `403` | Check the chosen credential and account eligibility in [Authentication](../authentication/). |
| `413` | Check account file and project limits, and the total request size in [Errors and limits](../errors/#limits-at-a-glance). |
| Timeout | Check the project list before retrying. A repeated create without a hostname can create another project. |

For other errors, read the response body and follow [Errors and limits](../errors/). Never put the API key in a shared example or log.
