Skip to main content
First month 50% off for new accounts, in their first 48 hoursStart free

Add or remove media and graphics

Adds or removes stock media from find_media or animated HTML graphics over a video while the speech continues underneath. Media and graphics can be on screen for at most 60 seconds of a video in all. The video can play up to 5 minutes of its recording, counted from the first moment used to the last.

MCP tooledit_layers
APIPOST /api/v1/videos/{clipId}/layers
CreditsFree

When to use it

  • Call after get_script and any cut_video edits, because cuts shift script timestamps.
  • Add up to 10 items in add and list layer IDs in remove in one call. Each add item takes either mediaId or html.
  • Show one photo or video at a time, and one graphic at a time; a graphic can sit over a photo or video. Each must end before the video does.
  • New music replaces the music that was there.
  • Search for stock media first with find_media, and inspect placement afterward with show_frames.

Parameters

NameTypeRequiredWhat it is
clipIdstringYesThe clipId from open_video, or a clip ID from list_clips.
versionintegerYesThe version the script was read at.
addlistNoWhat to add, up to 10 at a time.
add[].mediaIdstringNoMedia from find_media. An item has this or html.
add[].htmlstringNoA graphic, up to 60,000 characters: one HTML page the size of the frame, transparent where it paints nothing. It sets window.film = { ready: document.fonts.ready, frame(t) { } }, where frame draws the whole picture at t seconds after the graphic appears, always the same for the same t. Up to 8 font styles can come from fonts.googleapis.com/css2; nothing else loads from the web.
add[].namestringNoFor a graphic, and required there: what it is, in up to 60 characters.
add[].startnumberNoWhen it appears, in seconds of the video as the script has them. Music plays through the whole video and needs none.
add[].secondsnumberNoHow long it stays. For media 1.5 to 15, default 3. A graphic needs it: 1 to 30.
add[].viewstringNoFor a photo: "card" (default) sits in free space, off the face and the captions; "full" fills the frame. Footage always fills the frame. One of card, full.
add[].volumestringNoFor music. Default "normal", under the speech. One of quiet, normal, loud.
removelistNoIDs of layers to take out.

Call it from an AI agent

{
  "name": "edit_layers",
  "arguments": {
    "clipId": "f8669b08",
    "version": 2,
    "add": [
      {
        "mediaId": "photo-1132528",
        "start": 8.2,
        "seconds": 3
      }
    ]
  }
}

A graphic that fades in:

{
  "name": "edit_layers",
  "arguments": {
    "clipId": "f8669b08",
    "version": 3,
    "add": [
      {
        "html": "<!doctype html><style>body{margin:0}div{position:absolute;left:6vw;top:18vh;padding:2vw 3vw;background:#101418;color:#fff;font:800 8vw sans-serif}</style><div>3 months</div><script>const box=document.querySelector('div');window.film={ready:document.fonts.ready,frame(t){box.style.opacity=Math.min(1,t/0.3)}}</script>",
        "name": "3 months",
        "start": 12.4,
        "seconds": 3
      }
    ]
  }
}

Call it from your code

curl -X POST https://pogclip.com/api/v1/videos/f8669b08/layers \
  -H "Authorization: Bearer $POGCLIP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"version": 2, "add": [{"mediaId": "photo-1132528", "start": 8.2, "seconds": 3}]}'

What you get back

{
  "clipId": "f8669b08",
  "name": "Why I started filming again",
  "pageUrl": "https://pogclip.com/dashboard/projects/8e4ed643?clip=f8669b08",
  "downloadPageUrl": "https://pogclip.com/dashboard/projects/8e4ed643?download=f8669b08",
  "status": "ready",
  "version": 3,
  "durationSeconds": 194.5,
  "script": [
    {
      "line": 1,
      "start": 0.1,
      "end": 2,
      "text": "Okay, here's the deal."
    },
    {
      "line": 2,
      "start": 2.3,
      "end": 8.1,
      "text": "I want to show you what I got wrong."
    }
  ],
  "layers": [
    {
      "id": "b669a5e4",
      "name": "microphone, studio",
      "start": 8.2,
      "end": 11.2
    }
  ],
  "previousVersion": 2,
  "next": "Saved. Version 2 can be put back."
}

The example above shows only the first two lines of script.

  • version: the new version after saving; use it for any follow-up edits.
  • previousVersion: pass this to restore_video to undo the layer change.
  • layers: lists every active media, music and graphic layer; pass a layer's id in remove to take it out later.
  • next: confirms the change was saved and notes which version you can restore.

Errors

CodeWhat it means
video_changedThe video has a newer version than the one you sent. Read the script again and use its version.
invalid_requestA field is missing or wrong, the video has no transcript yet, the media could not be fetched, two items overlap, or a limit above is passed. The message says which.
not_foundThere is no such video or media.
unauthorizedThe API key or sign-in is missing, wrong or revoked.
rate_limitedMore than 60 requests in a minute. Wait for retryAfterSeconds.