Notion API - How do I resolve a 400 Error saying non-valid URL for video blocks?

111 Views Asked by At

I am using the Notion API to copy page contents from one page to another, using the code described here to append blocks to page contents, and here to correctly structure the data for each content block. My implementation works for every block type I need except videos - it works for content like text, quotes, images, etc. For video blocks, I consistently get 400 errors stating that the URLs provided for video blocks are invalid. The only URLs it will pass are the embed URLs for YouTube videos. I'm trying to get URLs from Loom to work, specifically.

My syntax and structuring for the content blocks seems correct, since it will accept the YouTube embed URLs. I have tried regular and embed URLs for Google Drive, Loom, YouTube, and Vimeo, and the only URL that passes is the YouTube embed URL.

Neither Loom's shareable URLs nor their embed URLs are accepted as valid by the Notion API.

Here is an example of the data object for my PATCH request, with a video that works (a YouTube embed URL):

{
  children: [
    {
      object: 'block',
      type: 'video',
      video: {
        type: 'external',
        external: {
          url: 'https://www.youtube.com/embed/VjE0Kdfos4Y?si=xyA8USjhij-HiegA'
        }
      }
    }
  ]
}

And here is an example of the data object with a URL that doesn't work:

{
  children: [
    {
      object: 'block',
      type: 'video',
      video: {
        type: 'external',
        external: {
          url: 'https://www.loom.com/embed/14815426651d474eb1a7eb6262cd47de?sid=d9443817-0836-4d48-8074-1b4506bd681b'
        }
      }
    }
  ]
}```
0

There are 0 best solutions below