# at.unthread.document.putDraft

> Published by [unthread.at](https://lexicon.garden/identity/did:plc:trxedfug5xlbw64ydrkv7cr2)

✓ This is the authoritative definition for this NSID.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:trxedfug5xlbw64ydrkv7cr2/at.unthread.document.putDraft)
- [Documentation](https://lexicon.garden/lexicon/did:plc:trxedfug5xlbw64ydrkv7cr2/at.unthread.document.putDraft/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:trxedfug5xlbw64ydrkv7cr2/at.unthread.document.putDraft/examples)

## Definitions

### `at.unthread.document.putDraft`

**Type**: `procedure`

Create or update a draft document.

#### Input

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `tid` | `string` | No | TID of an existing draft to update. Omit to create a new draft. |
| `content` | `string` | Yes | Markdown content of the draft. |

#### Output

**Encoding**: `application/json`

#### Errors

- **DraftNotFound**

### `at.unthread.document.putDraft#draftView`

**Type**: `object`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `tid` | `string` | Yes |  |
| `content` | `string` | Yes |  |
| `createdAt` | `string` (datetime) | Yes |  |
| `updatedAt` | `string` (datetime) | Yes |  |

## Raw Schema

```json
{
  "id": "at.unthread.document.putDraft",
  "defs": {
    "main": {
      "type": "procedure",
      "input": {
        "schema": {
          "type": "object",
          "required": [
            "content"
          ],
          "properties": {
            "tid": {
              "type": "string",
              "description": "TID of an existing draft to update. Omit to create a new draft."
            },
            "content": {
              "type": "string",
              "description": "Markdown content of the draft."
            }
          }
        },
        "encoding": "application/json"
      },
      "errors": [
        {
          "name": "DraftNotFound"
        }
      ],
      "output": {
        "schema": {
          "ref": "#defs/draftView",
          "type": "ref"
        },
        "encoding": "application/json"
      },
      "description": "Create or update a draft document."
    },
    "draftView": {
      "type": "object",
      "required": [
        "tid",
        "content",
        "createdAt",
        "updatedAt"
      ],
      "properties": {
        "tid": {
          "type": "string"
        },
        "content": {
          "type": "string"
        },
        "createdAt": {
          "type": "string",
          "format": "datetime"
        },
        "updatedAt": {
          "type": "string",
          "format": "datetime"
        }
      }
    }
  },
  "$type": "com.atproto.lexicon.schema",
  "lexicon": 1
}
```
