Ayrshare API: Posting Videos to YouTube

We’re pleased to announce Aryshare‘s Social Media API now support posting videos to YouTube.

You can now upload a video directly to YouTube either from our API or Ayrshare’s Dashboard. And we’ve made it is simple as can be.

A JavaScript example is shown below. Or, check out other language examples:

const fetch = require("node-fetch");
const API_KEY = "API_KEY";
 
fetch("https://app.ayrshare.com/api/post", {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
        "Authorization": `Bearer ${API_KEY}`
      },
      body: JSON.stringify({
        title: "YouTube Post Title", 
        post: "YouTube Description",
        platforms: ["youtube"],
        media_urls: ["https://videourl"],              
        youTubeVisibility: "public"  
      }),
    })
      .then((res) => res.json())
      .then((json) => console.log(json))
      .catch(console.error);

You can set the visibility to public, private, or unlisted. And if you don’t want the video any more, simply delete it:

const fetch = require("node-fetch");
const API_KEY = "API_KEY";
const id = "Post ID";
 
fetch("https://app.ayrshare.com/api/delete", {
      method: "DELETE",
      headers: {
        "Content-Type": "application/json",
        "Authorization": `Bearer ${API_KEY}`
      },
      body: JSON.stringify({ id }),
    })
      .then((res) => res.json())
      .then((json) => console.log(json))
      .catch(console.error);

Watch Uploading a Video to YouTube with the API

Here is a short video on how to link your YouTube account and post via the API:

Posting to YouTube via the API

Let us know what you think or if you have questions.