# place.stream.media.createUpload

> Published by [did:web:stream.place](https://lexicon.garden/identity/did:web:stream.place)

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:web:stream.place/place.stream.media.createUpload)
- [Documentation](https://lexicon.garden/lexicon/did:web:stream.place/place.stream.media.createUpload/docs)
- [Examples](https://lexicon.garden/lexicon/did:web:stream.place/place.stream.media.createUpload/examples)

## Definitions

### `place.stream.media.createUpload`

**Type**: `procedure`

Start a resumable upload of arbitrary media content. Returns a TUS upload URL and a short-lived bearer token used to authenticate subsequent chunk requests (no DPoP required on chunks). The DID of the authenticated user is recorded against the upload; on completion a VOD processing task is enqueued.

#### Input

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `size` | `integer` | Yes | Total size of the upload in bytes. |
| `draftUri` | `string` | No | Optional ats:// URI of a draft VOD created via place.stream.vod.createDraft. When supplied, the upload's processing fills that draft (rather than creating a new one), so the user can edit metadata while the upload runs and re-upload if it fails. The draft's origin_upload_id is set to this upload. |
| `filename` | `string` | No | Optional filename hint to attach as upload metadata. |
| `mimeType` | `string` | Yes | MIME type of the content being uploaded (e.g. video/mp4). |

#### Output

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `uploadId` | `string` | Yes | Server-side identifier for this upload. |
| `expiresAt` | `string` (datetime) | Yes | When the upload token expires. |
| `uploadUrl` | `string` (uri) | Yes | Absolute URL to PATCH/HEAD per the TUS protocol. |
| `uploadToken` | `string` | Yes | Short-lived bearer token bound to this upload. Send as 'Authorization: Bearer <token>' on TUS requests. |

#### Errors

- **UploadTooLarge**: The requested upload exceeds the server's maximum allowed size.
- **UnsupportedMimeType**: The server does not accept this MIME type for upload.

## Raw Schema

```json
{
  "id": "place.stream.media.createUpload",
  "defs": {
    "main": {
      "type": "procedure",
      "input": {
        "schema": {
          "type": "object",
          "required": [
            "size",
            "mimeType"
          ],
          "properties": {
            "size": {
              "type": "integer",
              "description": "Total size of the upload in bytes."
            },
            "draftUri": {
              "type": "string",
              "description": "Optional ats:// URI of a draft VOD created via place.stream.vod.createDraft. When supplied, the upload's processing fills that draft (rather than creating a new one), so the user can edit metadata while the upload runs and re-upload if it fails. The draft's origin_upload_id is set to this upload."
            },
            "filename": {
              "type": "string",
              "description": "Optional filename hint to attach as upload metadata."
            },
            "mimeType": {
              "type": "string",
              "description": "MIME type of the content being uploaded (e.g. video/mp4)."
            }
          }
        },
        "encoding": "application/json"
      },
      "errors": [
        {
          "name": "UploadTooLarge",
          "description": "The requested upload exceeds the server's maximum allowed size."
        },
        {
          "name": "UnsupportedMimeType",
          "description": "The server does not accept this MIME type for upload."
        }
      ],
      "output": {
        "schema": {
          "type": "object",
          "required": [
            "uploadUrl",
            "uploadToken",
            "expiresAt",
            "uploadId"
          ],
          "properties": {
            "uploadId": {
              "type": "string",
              "description": "Server-side identifier for this upload."
            },
            "expiresAt": {
              "type": "string",
              "format": "datetime",
              "description": "When the upload token expires."
            },
            "uploadUrl": {
              "type": "string",
              "format": "uri",
              "description": "Absolute URL to PATCH/HEAD per the TUS protocol."
            },
            "uploadToken": {
              "type": "string",
              "description": "Short-lived bearer token bound to this upload. Send as 'Authorization: Bearer <token>' on TUS requests."
            }
          }
        },
        "encoding": "application/json"
      },
      "parameters": null,
      "description": "Start a resumable upload of arbitrary media content. Returns a TUS upload URL and a short-lived bearer token used to authenticate subsequent chunk requests (no DPoP required on chunks). The DID of the authenticated user is recorded against the upload; on completion a VOD processing task is enqueued."
    }
  },
  "$type": "com.atproto.lexicon.schema",
  "lexicon": 1
}
```
