# place.hud.publishApp

> Write a place.hud.app record in the person's own repository at rkey, a new one or in place of the one there, its blobs uploaded before (place.hud.uploadBlob with purpose app), checked as HUD checks an app it runs: its lexicon, its kinds' defs and its words. Requires auth: the workspace's web session (its cookie, with X-HUD: 1 and the server's own Origin) or a HUD access token as Bearer.

- Kind: procedure
- Authority: hud.place
- Lexicon: 1
- Published by [lexicons.hud.place](https://lexicon.garden/identity/did:plc:3tzbz4pml36u4mkresb6pdhv), the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:plc:3tzbz4pml36u4mkresb6pdhv/place.hud.publishApp)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:3tzbz4pml36u4mkresb6pdhv/place.hud.publishApp/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:3tzbz4pml36u4mkresb6pdhv/place.hud.publishApp/analytics)

## Procedure (`place.hud.publishApp`)

Type: procedure · POST

### Input (application/json)

- `html` (blob, required): Its document, uploaded first (place.hud.uploadBlob with purpose app).
  - Constraints: maxSize: 2000000, accept: text/html
- `icon` (blob): Its icon, uploaded first.
  - Constraints: maxSize: 256000, accept: image/png, image/webp
- `kinds` (array, required): Its kinds of entry, each a name (1 to 64 letters and digits in lowerCamelCase) and a lexicon object def.
  - Constraints: minLength: 1, maxLength: 16
  - `items` (ref)
    - Reference: `place.hud.app#kind`
- `name` (string, required): What the app is called.
  - Constraints: maxLength: 640, maxGraphemes: 64
- `origins` (array): The https origins it loads pictures and audio from, as place.hud.app holds them: each one a view HUD trusts names.
  - Constraints: maxLength: 8
  - `items` (ref)
    - Reference: `place.hud.app#origin`
- `reads` (array): Public collections it reads beyond its entries, as place.hud.app holds them.
  - Constraints: maxLength: 16
  - `items` (ref)
    - Reference: `place.hud.app#collection`
- `rkey` (string, required): The app's record key, its address's last part: 1 to 64 of a-z, 0-9 and -.
  - Constraints: minLength: 1, maxLength: 64
- `summary` (string): What it is.
  - Constraints: maxLength: 3000, maxGraphemes: 300
- `words` (blob): Its words by language, uploaded first.
  - Constraints: maxSize: 512000, accept: application/json
- `writers` (array): Who alone may write its entries: anyone where it is left out.
  - Constraints: maxLength: 200
  - `items` (ref)
    - Reference: `place.hud.app#writer`
- `writes` (array): Collections it writes in the person's repository beyond its entries, as place.hud.app holds them: each one whose record lexicon HUD bundles.
  - Constraints: maxLength: 8
  - `items` (ref)
    - Reference: `place.hud.app#collection`

### Output (application/json)

- `cid` (string · cid, required)
- `uri` (string · at-uri, required)
- `url` (string · uri, required): The app's page, to share: /a/<handle>/<rkey> on this server.

### Errors

- `InvalidRequest`: The app is not one HUD runs: what is wrong is named.
- `AuthRequired`: No live web session or HUD access token, or the person's sign-in at their PDS ended: sign in.
- `UpstreamFailure`: Their PDS refused the write; or they signed in before HUD asked to publish apps, which the message says: sign in again.

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Write a place.hud.app record in the person's own repository at rkey, a new one or in place of the one there, its blobs uploaded before (place.hud.uploadBlob with purpose app), checked as HUD checks an app it runs: its lexicon, its kinds' defs and its words. Requires auth: the workspace's web session (its cookie, with X-HUD: 1 and the server's own Origin) or a HUD access token as Bearer.",
      "errors": [
        {
          "description": "The app is not one HUD runs: what is wrong is named.",
          "name": "InvalidRequest"
        },
        {
          "description": "No live web session or HUD access token, or the person's sign-in at their PDS ended: sign in.",
          "name": "AuthRequired"
        },
        {
          "description": "Their PDS refused the write; or they signed in before HUD asked to publish apps, which the message says: sign in again.",
          "name": "UpstreamFailure"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "html": {
              "accept": [
                "text/html"
              ],
              "description": "Its document, uploaded first (place.hud.uploadBlob with purpose app).",
              "maxSize": 2000000,
              "type": "blob"
            },
            "icon": {
              "accept": [
                "image/png",
                "image/webp"
              ],
              "description": "Its icon, uploaded first.",
              "maxSize": 256000,
              "type": "blob"
            },
            "kinds": {
              "description": "Its kinds of entry, each a name (1 to 64 letters and digits in lowerCamelCase) and a lexicon object def.",
              "items": {
                "ref": "place.hud.app#kind",
                "type": "ref"
              },
              "maxLength": 16,
              "minLength": 1,
              "type": "array"
            },
            "name": {
              "description": "What the app is called.",
              "maxGraphemes": 64,
              "maxLength": 640,
              "type": "string"
            },
            "origins": {
              "description": "The https origins it loads pictures and audio from, as place.hud.app holds them: each one a view HUD trusts names.",
              "items": {
                "ref": "place.hud.app#origin",
                "type": "ref"
              },
              "maxLength": 8,
              "type": "array"
            },
            "reads": {
              "description": "Public collections it reads beyond its entries, as place.hud.app holds them.",
              "items": {
                "ref": "place.hud.app#collection",
                "type": "ref"
              },
              "maxLength": 16,
              "type": "array"
            },
            "rkey": {
              "description": "The app's record key, its address's last part: 1 to 64 of a-z, 0-9 and -.",
              "maxLength": 64,
              "minLength": 1,
              "type": "string"
            },
            "summary": {
              "description": "What it is.",
              "maxGraphemes": 300,
              "maxLength": 3000,
              "type": "string"
            },
            "words": {
              "accept": [
                "application/json"
              ],
              "description": "Its words by language, uploaded first.",
              "maxSize": 512000,
              "type": "blob"
            },
            "writers": {
              "description": "Who alone may write its entries: anyone where it is left out.",
              "items": {
                "ref": "place.hud.app#writer",
                "type": "ref"
              },
              "maxLength": 200,
              "type": "array"
            },
            "writes": {
              "description": "Collections it writes in the person's repository beyond its entries, as place.hud.app holds them: each one whose record lexicon HUD bundles.",
              "items": {
                "ref": "place.hud.app#collection",
                "type": "ref"
              },
              "maxLength": 8,
              "type": "array"
            }
          },
          "required": [
            "rkey",
            "name",
            "html",
            "kinds"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "cid": {
              "format": "cid",
              "type": "string"
            },
            "uri": {
              "format": "at-uri",
              "type": "string"
            },
            "url": {
              "description": "The app's page, to share: /a/<handle>/<rkey> on this server.",
              "format": "uri",
              "type": "string"
            }
          },
          "required": [
            "uri",
            "cid",
            "url"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "description": "Publish a frame app.",
  "id": "place.hud.publishApp",
  "lexicon": 1
}
```
