# at.protocube.saveDraft

> Create or replace the caller's working draft for one record. The owner is the service-auth token's issuer; a client never sends a DID.

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

## Links

- [Documentation](https://lexicon.garden/lexicon/did:plc:it2qbdcai2lchnnnt3caynqx/at.protocube.saveDraft)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:it2qbdcai2lchnnnt3caynqx/at.protocube.saveDraft/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:it2qbdcai2lchnnnt3caynqx/at.protocube.saveDraft/analytics)

## Procedure (`at.protocube.saveDraft`)

Type: procedure · POST

### Input (application/json)

- `baseCid` (string · cid): The PDS record CID this draft was loaded from, or absent.
- `collection` (string · nsid, required)
- `payload` (unknown, required): Editor-shaped JSON. It is not validated as a record and is capped at 256 KiB.
- `rkey` (string · record-key, required)

### Output (application/json)

- `updatedAt` (string · datetime, required)

### Errors

- `InvalidRequest`: No description in schema.
- `PayloadTooLarge`: No description in schema.
- `Unauthorized`: No description in schema.

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Create or replace the caller's working draft for one record. The owner is the service-auth token's issuer; a client never sends a DID.",
      "errors": [
        {
          "name": "InvalidRequest"
        },
        {
          "name": "PayloadTooLarge"
        },
        {
          "name": "Unauthorized"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "baseCid": {
              "description": "The PDS record CID this draft was loaded from, or absent.",
              "format": "cid",
              "type": "string"
            },
            "collection": {
              "format": "nsid",
              "type": "string"
            },
            "payload": {
              "description": "Editor-shaped JSON. It is not validated as a record and is capped at 256 KiB.",
              "type": "unknown"
            },
            "rkey": {
              "format": "record-key",
              "type": "string"
            }
          },
          "required": [
            "collection",
            "rkey",
            "payload"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "updatedAt": {
              "format": "datetime",
              "type": "string"
            }
          },
          "required": [
            "updatedAt"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "id": "at.protocube.saveDraft",
  "lexicon": 1
}
```
