# PUT /v1/ui

Set an app's page: field, response and errors.

With `PUT /v1/ui`, your tool tells Packlets which web page an app shows. This call only exists for packlets of the app type.

The guide for this: [Build your own app](https://packlets.app/en/docs/apps.md).

## PUT /v1/ui

```http
PUT https://api.packlets.app/v1/ui
Authorization: Bearer <PACKLETS_KEY>
Content-Type: application/json
```

| Field | Type | Required | Meaning |
|---|---|---|---|
| `page` | `https` address, up to 2,048 characters | yes | The page the app shows. |

```json
{ "page": "https://your-server.com/invoices" }
```

What a `PUT` does:

- The app shows this page from now on. You set a different address with a new `PUT`.
- The first successful `PUT` connects the packlet: the app shows "Connected!".
- If the address changes to a different host or port, Packlets asks the next time you open it, before loading the page.

Once is enough. What the page shows is up to your server from then on.

### Response

```json
{ "ok": true, "page": "https://your-server.com/invoices" }
```

## Errors

| Status | `error` | When |
|---|---|---|
| 400 | `invalid_body` | `page` is missing, isn't an `https` address or is too long. `details` names the field and the reason. |
| 401 | `missing_key`, `invalid_key` | Key is missing or wrong. |
| 409 | `wrong_kind` | The packlet is a channel, not an app. |
| 429 | `rate_limited` | More than 60 calls in a minute. |

What you can do in each case is covered under [Error codes](https://packlets.app/en/docs/fehler.md).
