# place.stream.media.createUpload

> 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.

- Kind: procedure
- Authority: media.stream.place
- Lexicon: 1
- Published by [stream.place](https://lexicon.garden/identity/did:plc:rbvrr34edl5ddpuwcubjiost), not the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:plc:rbvrr34edl5ddpuwcubjiost/place.stream.media.createUpload)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:rbvrr34edl5ddpuwcubjiost/place.stream.media.createUpload/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:rbvrr34edl5ddpuwcubjiost/place.stream.media.createUpload/analytics)

## Procedure (`place.stream.media.createUpload`)

Type: procedure · POST

### Input (application/json)

- `draftUri` (string): 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): Optional filename hint to attach as upload metadata.
- `mimeType` (string, required): MIME type of the content being uploaded (e.g. video/mp4).
- `size` (integer, required): Total size of the upload in bytes.

### Output (application/json)

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

### Errors

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

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "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.",
      "errors": [
        {
          "description": "The requested upload exceeds the server's maximum allowed size.",
          "name": "UploadTooLarge"
        },
        {
          "description": "The server does not accept this MIME type for upload.",
          "name": "UnsupportedMimeType"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "draftUri": {
              "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.",
              "type": "string"
            },
            "filename": {
              "description": "Optional filename hint to attach as upload metadata.",
              "type": "string"
            },
            "mimeType": {
              "description": "MIME type of the content being uploaded (e.g. video/mp4).",
              "type": "string"
            },
            "size": {
              "description": "Total size of the upload in bytes.",
              "type": "integer"
            }
          },
          "required": [
            "size",
            "mimeType"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "expiresAt": {
              "description": "When the upload token expires.",
              "format": "datetime",
              "type": "string"
            },
            "uploadId": {
              "description": "Server-side identifier for this upload.",
              "type": "string"
            },
            "uploadToken": {
              "description": "Short-lived bearer token bound to this upload. Send as 'Authorization: Bearer <token>' on TUS requests.",
              "type": "string"
            },
            "uploadUrl": {
              "description": "Absolute URL to PATCH/HEAD per the TUS protocol.",
              "format": "uri",
              "type": "string"
            }
          },
          "required": [
            "uploadUrl",
            "uploadToken",
            "expiresAt",
            "uploadId"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "id": "place.stream.media.createUpload",
  "lexicon": 1
}
```
