{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/snapvisor-io/json-schema/snapvisor-io-media-schema.json",
  "title": "Media",
  "description": "A standalone image or video uploaded to Snapvisor",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/snapvisor-io-openapi.yml#/components/schemas/Media",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Unique identifier of the media"
    },
    "name": {
      "type": "string",
      "description": "The media's name, and its identity within its pull request. Uploading the same name again adds a version."
    },
    "state": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "before",
            "after"
          ],
          "description": "Which half of a before/after pair this media is, so the two can be shown side by side and compared. Inferred from a file name ending in `-before` or `-after`."
        },
        {
          "type": "null"
        }
      ]
    },
    "description": {
      "description": "Prose shown under the media in the pull request comment.",
      "type": [
        "string",
        "null"
      ]
    },
    "stage": {
      "type": "string",
      "enum": [
        "staged",
        "published"
      ],
      "description": "`staged` while the media is only attached to a branch, `published` once a pull request is attached and the media is listed in that pull request's comment. A media attached to neither is `staged`."
    },
    "branch": {
      "description": "Branch this media was uploaded for. Kept after publishing, as a record of where it came from.",
      "type": [
        "string",
        "null"
      ]
    },
    "prNumber": {
      "description": "Pull request this media is published to, or `null` while it is staged.",
      "type": [
        "number",
        "null"
      ]
    },
    "url": {
      "type": "string",
      "format": "uri",
      "description": "Share page URL. This is the link to put in a pull request or a chat message, and it keeps working across versions — it always shows the newest one."
    },
    "markdown": {
      "type": "string",
      "description": "Ready-to-paste Markdown: the picture — the image itself, or a video's poster frame — embedded from the CDN and linked to the share page. Embed this rather than building your own from `url`: that is an HTML page, and an image embed pointing at it renders as a broken image."
    },
    "version": {
      "type": "number",
      "description": "Which version this response describes: 1 for a first upload, incrementing each time the same name is uploaded again."
    },
    "versionCount": {
      "type": "number",
      "description": "How many uploaded versions this media has. Above 1, `GET /media/{mediaId}/versions` lists them — which is how a comment's `mediaVersionId` resolves to the file it was written against."
    },
    "fileUrl": {
      "type": "string",
      "format": "uri",
      "description": "URL of the image or video itself, for an agent that wants to look at it."
    },
    "posterUrl": {
      "anyOf": [
        {
          "type": "string",
          "format": "uri"
        },
        {
          "type": "null"
        }
      ],
      "description": "Poster frame of a video, derived by the image CDN. Always `null` for images."
    },
    "contentType": {
      "type": "string",
      "description": "Content type of the media"
    },
    "sizeBytes": {
      "type": "number",
      "description": "Size of the media, in bytes"
    },
    "width": {
      "description": "Width, in pixels",
      "type": [
        "number",
        "null"
      ]
    },
    "height": {
      "description": "Height, in pixels",
      "type": [
        "number",
        "null"
      ]
    },
    "visibility": {
      "type": "string",
      "enum": [
        "team",
        "public"
      ],
      "description": "Who can open the media share page. `team` requires a signed-in session with access to the owning account; `public` only requires the share URL."
    },
    "status": {
      "type": "string",
      "enum": [
        "pending",
        "ready"
      ],
      "description": "`pending` until the bytes are uploaded, then `ready`. There is no processing step — Snapvisor serves the bytes it was given."
    },
    "expiresAt": {
      "description": "When this version is deleted. Set from your plan's retention, counted from the upload rather than from the last view.",
      "type": [
        "string",
        "null"
      ]
    },
    "createdAt": {
      "type": "string"
    }
  },
  "required": [
    "id",
    "name",
    "state",
    "description",
    "stage",
    "branch",
    "prNumber",
    "url",
    "markdown",
    "version",
    "versionCount",
    "fileUrl",
    "posterUrl",
    "contentType",
    "sizeBytes",
    "width",
    "height",
    "visibility",
    "status",
    "expiresAt",
    "createdAt"
  ],
  "additionalProperties": false
}