# place.hud.createAppRecord

> Write a record of one of the collections a frame app names in its writes in the person's own repository (com.atproto.repo.createRecord), its $type set by HUD and the record checked against the collection's lexicon first, once they have allowed the app (place.hud.allowAppEntries) and signed in asking to write that collection. Never in a private instance: in one, the app writes to the public network as outside it. 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.createAppRecord)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:3tzbz4pml36u4mkresb6pdhv/place.hud.createAppRecord/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:3tzbz4pml36u4mkresb6pdhv/place.hud.createAppRecord/analytics)

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

Type: procedure · POST

### Input (application/json)

- `app` (string · at-uri, required): The app's place.hud.app record.
- `collection` (string · nsid, required): Which of the collections it writes.
- `record` (unknown, required): The record, an object as the collection's lexicon describes it; its $type left out or the collection.

### Output (application/json)

- `cid` (string · cid, required)
- `uri` (string · at-uri, required)

### Errors

- `NotFound`: HUD has no frame app of this id.
- `InvalidRequest`: The collection is not one the app names in its writes, the record does not match its lexicon, or the input is not what the method takes.
- `ConsentRequired`: The person has not allowed this app to save for them: ask them, then place.hud.allowAppEntries.
- `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 the app asked to write this collection, which the message says: sign in again.

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Write a record of one of the collections a frame app names in its writes in the person's own repository (com.atproto.repo.createRecord), its $type set by HUD and the record checked against the collection's lexicon first, once they have allowed the app (place.hud.allowAppEntries) and signed in asking to write that collection. Never in a private instance: in one, the app writes to the public network as outside it. 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": "HUD has no frame app of this id.",
          "name": "NotFound"
        },
        {
          "description": "The collection is not one the app names in its writes, the record does not match its lexicon, or the input is not what the method takes.",
          "name": "InvalidRequest"
        },
        {
          "description": "The person has not allowed this app to save for them: ask them, then place.hud.allowAppEntries.",
          "name": "ConsentRequired"
        },
        {
          "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 the app asked to write this collection, which the message says: sign in again.",
          "name": "UpstreamFailure"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "app": {
              "description": "The app's place.hud.app record.",
              "format": "at-uri",
              "type": "string"
            },
            "collection": {
              "description": "Which of the collections it writes.",
              "format": "nsid",
              "type": "string"
            },
            "record": {
              "description": "The record, an object as the collection's lexicon describes it; its $type left out or the collection.",
              "type": "unknown"
            }
          },
          "required": [
            "app",
            "collection",
            "record"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "cid": {
              "format": "cid",
              "type": "string"
            },
            "uri": {
              "format": "at-uri",
              "type": "string"
            }
          },
          "required": [
            "uri",
            "cid"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "description": "Write a record a frame app makes in the person's own repository.",
  "id": "place.hud.createAppRecord",
  "lexicon": 1
}
```
