# games.cavu.createPostDraft

> Draft a Bluesky post for the bound player (bound session + DPoP; the game needs games.cavu.defs#bskyPost). Returns a link to the host's composer: show it in an iframe on the game's page. The player edits the post and sends it, or cancels; the composer tells the page by postMessage({type: 'cavu.compose', status: 'open' | 'posted' | 'cancelled' | 'expired', uri?, url?}, <game origin>). A game can't post without the player sending it from the composer.

- Kind: procedure
- Authority: cavu.games
- Lexicon: 1
- Published by [pardy.at](https://lexicon.garden/identity/did:plc:dp7v5b5kejmmzzpwmqyf5wj6), the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:plc:dp7v5b5kejmmzzpwmqyf5wj6/games.cavu.createPostDraft)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:dp7v5b5kejmmzzpwmqyf5wj6/games.cavu.createPostDraft/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:dp7v5b5kejmmzzpwmqyf5wj6/games.cavu.createPostDraft/analytics)

## Procedure (`games.cavu.createPostDraft`)

Type: procedure · POST

### Input (application/json)

- `image` (object)
- `text` (string): The post's text to start from; the player can change it.
  - Constraints: maxLength: 3000, maxGraphemes: 300

### Output (application/json)

- `expiresAt` (string · datetime, required)
- `url` (string · uri, required): The composer for this draft (only the player's own browser can post from it; only the game's page origin may frame it).

### Errors

- `CapabilityRequired`: The game doesn't declare games.cavu.defs#bskyPost.
- `InvalidImage`: No description in schema.
- `InvalidRequest`: No description in schema.

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Draft a Bluesky post for the bound player (bound session + DPoP; the game needs games.cavu.defs#bskyPost). Returns a link to the host's composer: show it in an iframe on the game's page. The player edits the post and sends it, or cancels; the composer tells the page by postMessage({type: 'cavu.compose', status: 'open' | 'posted' | 'cancelled' | 'expired', uri?, url?}, <game origin>). A game can't post without the player sending it from the composer.",
      "errors": [
        {
          "description": "The game doesn't declare games.cavu.defs#bskyPost.",
          "name": "CapabilityRequired"
        },
        {
          "name": "InvalidImage"
        },
        {
          "name": "InvalidRequest"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "image": {
              "properties": {
                "alt": {
                  "description": "Starting alt text; the player can change it.",
                  "maxLength": 2000,
                  "type": "string"
                },
                "data": {
                  "description": "Base64 (standard alphabet) of a JPEG, PNG or WebP, at most 1,000,000 bytes.",
                  "type": "string"
                },
                "height": {
                  "minimum": 1,
                  "type": "integer"
                },
                "width": {
                  "minimum": 1,
                  "type": "integer"
                }
              },
              "required": [
                "data"
              ],
              "type": "object"
            },
            "text": {
              "description": "The post's text to start from; the player can change it.",
              "maxGraphemes": 300,
              "maxLength": 3000,
              "type": "string"
            }
          },
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "expiresAt": {
              "format": "datetime",
              "type": "string"
            },
            "url": {
              "description": "The composer for this draft (only the player's own browser can post from it; only the game's page origin may frame it).",
              "format": "uri",
              "type": "string"
            }
          },
          "required": [
            "url",
            "expiresAt"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "id": "games.cavu.createPostDraft",
  "lexicon": 1
}
```
