# Bringing your own footage

The user has the media on their own device, or you generated or already hold
it; HYVIRAL edits and renders it. Every door runs the same validation the app
uses: there is no separate agent path, which is exactly why it is safe to hand
you.

## Two ways in

Where the file is decides which. **The upload link is the default** for anything
the user has:

| The file is | Call | Then |
|---|---|---|
| the user's own, on their phone or computer (the default) | `upload_request {}`, with no file details | give the user `uploadLink`; `upload_complete { linkId }` once they say the page shows Done |
| in your sandbox (you made it, or it was attached to the chat) | `upload_request { fileName, mimeType, fileSizeBytes }` | the ticket steps below, then `upload_complete { uploadId }` |
| a clip from their connected Twitch or Kick channel | nothing to upload | the user picks it in the review, then `manage_stream_clips fetch` returns its `uploadId` (`playbooks/stream-clips.md`) |

## The upload link (the default)

```
1. upload_request {}
   → { linkId, uploadLink, linkExpiresAt }

2. Give the user uploadLink exactly as written. They open it on any device,
   with no sign-in and nothing to install or allow, pick up to 10 files,
   and their own browser uploads them one after another.

3. When they tell you the page says Done:
   upload_complete { linkId }
   → every file they sent: { files: [...], uploadId, ..., gcsPath, uploadedAt }
```

- **Up to 10 files per link, started within two hours.** An upload already
  started may still finish after that. For more files, call
  `upload_request {}` again; it is free.
- **A platform's export, not media:** `upload_request { purpose: "data" }`
  makes a link that takes `.xlsx` files only (up to 10 MB each), for
  `import_platform_export` (`playbooks/sales-by-post.md`). The import deletes
  the file once it has read it; a refusal that asks you to call again (a
  profile to choose, another import running) keeps it for that call.
- **The readback lists every file** in `files[]`, by slot: `status` is `done`
  (with its `uploadId`, `gcsPath`, `media` and `uploadedAt`, ISO 8601 UTC),
  `uploading`, or `refused`. With one file done, the answer is the same one a
  ticket gets. With several, the text reads "N files uploaded through link …",
  one line per file with "uploaded 2026-10-22 21:45 UTC", and the top-level
  fields describe the first done file. Use each file's own `uploadId`.
- **Some files still uploading:** the answer gives the done ones and
  `stillUploading`; call `upload_complete { linkId }` again once the user says
  the page shows Done. Before any file is done it answers
  `UPLOAD_NOT_FINISHED`. Neither is an error: wait for the user, and do not
  call it in a loop.
- **A file the page refused** (the wrong type, too large, over today's limit)
  is `refused` in `files[]`, or, when nothing else was sent, `UPLOAD_REFUSED`
  (`UPLOAD_NOT_FINISHED` for a limit). The page told the user why, and the
  same link still works.
- **Your sandbox needs no network access for this door.** It works in Claude's
  phone app, on Team and Enterprise accounts with network egress off, and for
  files far over the 30 MB Claude accepts in a chat (video up to 8 GB).

## The ticket: a file in your sandbox

For files you made yourself (a rendered asset, `purpose: "asset"`) or that were
attached to the chat. The user's own files take the link above.

```
1. upload_request { fileName, mimeType, fileSizeBytes }
   → { uploadId, ticketUrl, signedUploadUrl, requiredContentLengthRange, expiresInMs }

2. GET <ticketUrl>                     from your code
   → { start: { url, headers }, contentType, expiresAt, ... }

3. POST <start.url> with exactly <start.headers>
     (x-goog-resumable: start, x-goog-content-length-range, Content-Type)
   → 201, session URL in the Location header

4. PUT <session URL>  <the bytes>, Content-Type: <contentType>

5. upload_complete { uploadId }
   → { ..., gcsPath }   video_preview { gcsPath, sheet: true } looks at a video
                        or an image free, without opening a project
```

In Python:

```python
r = requests.get(TICKET_URL)
r.raise_for_status()
t = r.json()
assert t["start"]["url"].startswith("https://storage.googleapis.com/")
s = requests.post(t["start"]["url"], headers=t["start"]["headers"])
s.raise_for_status()
requests.put(s.headers["Location"], data=open(PATH, "rb"),
             headers={"Content-Type": t["contentType"]}).raise_for_status()
```

**Read the ticket from code; never retype the signed URL.** The signed URL is
about 600 characters, 344 of them a base64 signature, and one wrong character
fails the POST with `SignatureDoesNotMatch` while the request looks right in
every other way. The ticket link is about 70 characters and holds the same URL
and headers, so your code reads them instead of you copying them. A client that
can hand the answer's structured data to its code may use `signedUploadUrl`
with the three headers directly; the ticket carries the same values.

The text of `upload_request`'s answer spells out these steps with the ticket
link filled in, so a client that shows you text only can still upload. If the
answer has no ticket link, it carries the signed URL and the headers instead:
pass them to your code verbatim.

### Fallback: allow the storage domain

Every request in a ticket upload (the ticket, the POST and the PUT) goes to
`storage.googleapis.com`. If your code runs in a sandbox with an outbound
allowlist, the first GET fails with a proxy, DNS or connection error rather
than a storage answer. For a file the user has, give them the upload link
first: the same `upload_request` answer carries one (`uploadLink`, `linkId`),
and they upload from their own browser with nothing to allow.

Allowing the domain is the fallback, only if the link cannot be used, and the
one route for a file only your sandbox has: a motion graphic or a sound you
rendered yourself (`purpose: "asset"`, which never gets a link). Without the
domain, place the built-in graphics and library sounds instead. A user who
wants your custom pieces, or cannot use the link, can allow it:

- **Claude (claude.ai, desktop and phone apps), Free, Pro and Max:** Settings →
  Capabilities → turn on "Code execution and file creation" and "Allow network
  egress", choose access to specific domains (or all domains), and add
  `storage.googleapis.com`. If the phone app does not show the network
  options, do it once on claude.ai in a browser.
- **Claude Team and Enterprise:** an owner or admin adds it in Organization
  settings → Capabilities, under code execution.
- **Any other sandbox:** allow outbound HTTPS to `storage.googleapis.com`.

The finished file's download link is on the same host, but only your user's
browser opens it.

Send `requiredContentLengthRange` exactly as returned, and the `Content-Type`
you declared. Both are part of the URL's signature. Rebuilding the range from
the size you declared works until the server's policy changes and then fails
for reasons that look like nothing you did.

`upload_complete` is not a formality: the server verifies the object exists and
re-checks its real size and type before the file becomes usable. Until you call
it, the upload is not something the edit tools can see.

## What will be refused

- **Anything that is not audio, video or an image.** Those three are accepted on
  both doors.
- Anything over the per-type size cap. A ticket tells you the range it signed
  for; respect it rather than discovering the cap by failing. The upload link's
  page checks the cap before the user's upload starts.
- A file whose real contents do not match the type you declared. After the bytes
  land, the server reads the file's own magic numbers and re-checks the size; a
  mismatch is deleted rather than quietly accepted.
- **Any attempt to have the server fetch a URL for you. That does not exist.**
  Upload bytes you hold, or give the user an upload link for files they hold.
  This is the single most common wrong assumption an agent makes on this
  surface.

## Reading the words out of a long source

Long-form works over MCP, and it has two hard limits worth knowing before you
promise a user anything.

`video_ingest` reads a source's speech so the editing tools can work on words
rather than timestamps. It is what makes a paper edit, a filler-word trim and a
cut on a sentence possible, and every video needs it exactly once.

- **The intake ceiling is 90 minutes.** A longer source is refused, not
  truncated, with `EDIT_SOURCE_TOO_LONG`: `upload_complete` says so in `next`
  (with no ingest price), and every edit tool refuses it before a card is
  drawn, so nothing is charged. For clips or a shorter cut from a longer
  recording, split it first into parts under 90 minutes that overlap by about
  two minutes, so a moment at a seam is whole in one part, and ingest each part
  as its own source (with ffmpeg, `-ss` and `-t` with `-c copy` is fast and
  lossless; the refusal prints the exact numbers). Each part is priced by its
  length, so only the overlap is paid twice. For the best MOMENTS of a recording
  of up to 6 hours as clips, you need no split: `video_find_highlights` finds and
  cuts them without ingesting the whole (`playbooks/long-recording-highlights.md`).
  Splitting stays the way to edit the whole recording.
- **A file that is not plain H.264 must be under 6 GB.** Such a file (HEVC,
  VP9, AV1, 10-bit or HDR) is edited as it is only up to 6 GB; a bigger one is
  refused with `SOURCE_TOO_LARGE`. Re-export it as H.264 (8-bit) at about
  4 Mbit/s or less: an hour is then under 2 GB, well inside the 8 GB upload
  limit.
- **The export ceiling is 60 minutes, or 90 on Pro and Hype**
  (`features.render.longForm` on the surface names the plans by id, `pro` and
  `hype`). A longer
  project is refused at the quote with `EDIT_PROJECT_TOO_LONG`, before anything
  is charged, so trim it under the ceiling first.
- It runs as a background job, because a long recording takes minutes. You get a
  job id and poll `get_job_status`.
- The price comes from the source's length and is on the confirmation card before
  anything runs.
- **A source that has already been transcribed returns its words and costs
  nothing.** Do not re-ingest to be safe.
- You can point it at a project you already have, or hand it an upload id and it
  will start the project for you.

## Then edit it

Once complete, the upload behaves exactly like media HYVIRAL generated.
`list_user_uploads` lists the user's video and audio uploads with filename, type,
duration, status and the reference the clip and edit tools take as input.

```
video_project { action: "create", ... }        # free
video_ingest  { ... }                          # quoted job, once per source
video_cut / video_captions / video_look / ...  # free, applied to the project
video_preview                                  # free, look before you pay
video_export                                   # quote → confirm → job → the file
```

Sources are HYVIRAL uploads and assets only, never external URLs. The full edit
vocabulary is in `references/video.md`.

## Things worth telling the user

- The file is in THEIR library. They can see it and delete it, whether you put
  it there or they did.
- It counts against their storage allowance.
- Rendering is the expensive step and it quotes first, like everything else.
- Generated media expires after about 60 days. Anything they want to keep should
  be downloaded.
