Snapvisor Docs

Create a media upload

Register a standalone image or video and receive a signed target to upload it to. Uploading takes three calls: 1. `POST /media` — declare the file and get back an `upload` target. 2. `POST` the file to `upload.url` as `multipart/form-data`, appending every entry of `upload.fields` **before** the `file` part. 3. `POST /media/{mediaId}/finalize` — confirm the bytes landed. When `upload` comes back `null`, Snapvisor already holds this exact file and steps 2 and 3 are unnecessary. Pass `prNumber` when the pull request already exists, or `branch` when it does not. A media uploaded against a branch is **staged**: it has its share URL immediately, and the moment a pull request opens for that branch Snapvisor attaches it and posts the comment — nothing has to come back and connect the two. Use it when you have a standalone screenshot or screen recording, outside a CI build, to attach to a branch or pull request.

POST
/media

Register a standalone image or video and receive a signed target to upload it to.

Uploading takes three calls:

  1. POST /media — declare the file and get back an upload target.
  2. POST the file to upload.url as multipart/form-data, appending every entry of upload.fields before the file part.
  3. POST /media/{mediaId}/finalize — confirm the bytes landed.

When upload comes back null, Snapvisor already holds this exact file and steps 2 and 3 are unnecessary.

Pass prNumber when the pull request already exists, or branch when it does not. A media uploaded against a branch is staged: it has its share URL immediately, and the moment a pull request opens for that branch Snapvisor attaches it and posts the comment — nothing has to come back and connect the two.

Use it when you have a standalone screenshot or screen recording, outside a CI build, to attach to a branch or pull request.

Authorization

AuthorizationBearer <token>

Authenticate as a project with a project token.

Send it as a bearer token in the Authorization header:

Authorization: Bearer <project-token>

You can find your project token in your Snapvisor project settings. Project tokens are used by CI and the SDK to create builds and deployments.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/media" \  -H "Content-Type: application/json" \  -d '{    "name": "before.png",    "contentType": "string",    "size": 1,    "hash": "string"  }'
{  "media": {    "id": "string",    "name": "string",    "state": "before",    "description": "string",    "stage": "staged",    "branch": "string",    "prNumber": 0,    "url": "http://example.com",    "markdown": "string",    "version": 0,    "versionCount": 0,    "fileUrl": "http://example.com",    "posterUrl": "http://example.com",    "contentType": "string",    "sizeBytes": 0,    "width": 0,    "height": 0,    "visibility": "team",    "status": "pending",    "expiresAt": "string",    "createdAt": "string"  },  "upload": {    "url": "http://example.com",    "fields": {      "property1": "string",      "property2": "string"    }  }}