curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"post": "Today is a great day!",
"platforms": ["twitter", "facebook", "instagram", "linkedin"],
"mediaUrls": ["https://img.ayrshare.com/012/gb.jpg"]
}' \
-X POST https://api.ayrshare.com/api/post
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/post", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${API_KEY}`
},
body: JSON.stringify({
post: "Today is a great day!", // required
platforms: ["bluesky", "facebook", "instagram", "linkedin", "twitter"], // required
mediaUrls: ["https://img.ayrshare.com/012/gb.jpg"] //optional
}),
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
payload = {'post': 'Today is a great day!',
'platforms': ['bluesky', 'facebook', 'instagram', 'linkedin', 'twitter'],
'mediaUrls': ['https://img.ayrshare.com/012/gb.jpg']}
headers = {'Content-Type': 'application/json',
'Authorization': 'Bearer API_KEY'}
r = requests.post('https://api.ayrshare.com/api/post',
json=payload,
headers=headers)
print(r.json())
<?php
$curl = curl_init();
$data = [
"post" => "Today is a great day!",
"platforms" => ["bluesky", "facebook", "instagram", "linkedin", "pinterest", "twitter"],
"mediaUrls" => ["https://img.ayrshare.com/012/gb.jpg"]
];
curl_setopt_array($curl, [
CURLOPT_URL => 'https://api.ayrshare.com/api/post',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($data),
CURLOPT_HTTPHEADER => [
'Authorization: Bearer API_KEY', // Replace 'API_KEY' with your actual API key
'Content-Type: application/json'
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
package main
import (
"bytes"
"encoding/json"
"log"
"net/http"
)
func main() {
message := map[string]interface{}{
"post": "Today is a great day!",
"platforms": []string{"bluesky", "facebook", "instagram", "linkedin", "twitter"},
"mediaUrls": []string{"https://img.ayrshare.com/012/gb.jpg"}
}
bytesRepresentation, err := json.Marshal(message)
if err != nil {
log.Fatalln(err)
}
req, _ := http.NewRequest("POST", "https://api.ayrshare.com/api/post",
bytes.NewBuffer(bytesRepresentation))
req.Header.Add("Content-Type", "application/json; charset=UTF-8")
req.Header.Add("Authorization", "Bearer API_KEY")
res, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal("Error:", err)
}
res.Body.Close()
}
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace PostPOSTRequest_csharp
{
class Post
{
private static readonly HttpClient client = new HttpClient();
static async Task Main(string[] args)
{
string API_KEY = "API_KEY";
string url = "https://api.ayrshare.com/api/post";
// Set up request headers
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY);
// Prepare JSON content
string json = "{\"post\" : \"Today is a great day!\","
+ "\"platforms\" : [ \"bluesky\", \"facebook\", \"instagram\", \"linkedin\", \"twitter\" ],"
+ "\"mediaUrls\" : [ \"https://img.ayrshare.com/012/gb.jpg\" ]}";
var content = new StringContent(json, Encoding.UTF8, "application/json");
try
{
// Send POST request
HttpResponseMessage response = await client.PostAsync(url, content);
response.EnsureSuccessStatusCode();
// Read response
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
}
catch (HttpRequestException e)
{
Console.WriteLine($"Error: {e.Message}");
}
}
}
}
require 'httparty' # gem install httparty
res = HTTParty.post("https://api.ayrshare.com/api/post",
headers: {Authorization: "Bearer API_KEY"},
body: {
post: "Today is a great day!",
platforms: ['bluesky', 'facebook', 'instagram', 'linkedin', 'twitter'],
mediaUrls: ["https://img.ayrshare.com/012/gb.jpg"]
}).body
puts res
{
"status": "success",
"errors": [],
"postIds": [
{
// Details at https://www.ayrshare.com/docs/apis/post/social-networks/bluesky
"status": "success",
"id": "at://did:plc:n7atrjd22xgkmgwig6dzlhzd/app.bsky.feed.post/3lez7fwx452", // Bluesky Social Post ID
"cid": "bafyreie6n475cd3ynr6sfacvohu5qgjibcooxnug6zcbghkwnrwi5stafy", // Bluesky Content ID
"postUrl": "https://bsky.app/profile/madworlds.bsky.social/post/3lez7fwx4572",
"platform": "bluesky"
},
{
// Details at https://www.ayrshare.com/docs/apis/post/social-networks/facebook
"status": "success",
"id": "104923907983682_108329000309742", // Facebook Social Post ID
"platform": "facebook",
"postUrl": "https://www.facebook.com/104923907983682_108329000309742",
},
{
// Details at https://www.ayrshare.com/docs/apis/post/social-networks/google
"status": "success",
"id": "3837985438581442258", // Google Business Profile Social Post ID
"postUrl": "https://local.google.com/place?id=5229466225881728772&use=posts&lpsid=CM",
"type": "localPosts",
"platform": "gmb"
},
{
// Details at https://www.ayrshare.com/docs/apis/post/social-networks/instagram
"status": "success",
"platform": "instagram", // Instagram Social Post ID
"id": "17878176260289172",
"postUrl": "https://www.instagram.com/p/CP1dI9Hp_WO/",
"usedQuota": 12,
"contentIssues": { // Optional — only present when Ayrshare detected and resolved a content issue
"originMediaHostFailed": true,
"details": ["Media URL could not be retrieved by the social network. Successfully posted using Ayrshare automated media protection."]
}
},
{
// Details at https://www.ayrshare.com/docs/apis/post/social-networks/linkedin
"status": "success",
"id": "urn:li:share:7282181682126807041", // LinkedIn Social Post ID
"postUrl": "https://www.linkedin.com/feed/update/urn:li:share:7282181682126807041",
"owner": "urn:li:organization:77682157",
"platform": "linkedin"
},
{
// Details at https://www.ayrshare.com/docs/apis/post/social-networks/pinterest
"status": "success",
"id": "42995371460659062", // Pinterest Social Post ID
"postUrl": "https://www.pinterest.com/pin/429953714606062/",
"platform": "pinterest"
},
{
// Details at https://www.ayrshare.com/docs/apis/post/social-networks/reddit
"status": "success",
"id": "1hvdvof", // Reddit Social Post ID
"postUrl": "https://www.reddit.com/r/test/comments/1hvdvof/reddit_post_title/",
"platform": "reddit"
},
{
// Details at https://www.ayrshare.com/docs/apis/post/social-networks/snapchat
"status": "success",
"id": "921ed204-e123-5b08-a9ce-zx489f1f38c5", // Snapchat Social Post ID
"mediaId": "V6noC6UOQgOcABCDEgFZEwAAgd3F0cnp1eWtxZAb9PsH-MXb9PsIWAAAAAA", // Snapchat Media ID
"postUrl": "https://www.snapchat.com/add/samsmith1920/921ed204-e123-5b08-a9ce-zx489f1f38c5",
"type": "stories",
"ended": "2025-05-23T13:04:30.545Z",
"platform": "snapchat"
},
{
// Details at https://www.ayrshare.com/docs/apis/post/social-networks/telegram
"status": "success",
"id": 635, // Telegram Social Post ID
"postUrl": "https://t.me/c/1424847122/635",
"platform": "telegram"
},
{
// Details at https://www.ayrshare.com/docs/apis/post/social-networks/tiktok
"status": "success",
"idShare": "v_pub_url~v2.7456954878846683182",
"id": "pending", // TikTok Social Post ID - see https://www.ayrshare.com/docs/apis/post/social-networks/tiktok
"isVideo": true,
"platform": "tiktok"
},
{
// Details at https://www.ayrshare.com/docs/apis/post/social-networks/twitter
"status": "success",
"id": "1288899996423983105", // X/Twitter Social Post ID
"platform": "twitter",
"postUrl": "https://x.com/handle/status/1288899996423983105"
},
{
// Details at https://www.ayrshare.com/docs/apis/post/social-networks/youtube
"status": "success",
"id": "3oQeP-kTsbo", // YouTube Social Post ID
"postUrl": "https://youtu.be/3oQeP-kTo",
"platform": "youtube"
}
],
"id": "RhrbDtYh7hdSMc67zC8H" // Ayrshare Post ID used for delete, analytics, comments, etc.
}
{
"status": "scheduled",
"scheduleDate": "2023-04-01T10:04:12Z",
"id": "IUiaqFkQP96UJJXYjRpv", // Ayrshare Post ID used for delete, comment, analytics, etc.
"refId": "9abf1426d6ce9122effdeeddfdfdfd",
"post": "Genius is eternal patience. - Michelangelo"
}
{
"status": "success",
"posts": [
{
"status": "success",
"errors": [],
"postIds": [
{
"status": "success",
"id": "1869166036466991888",
"postUrl": "https://twitter.com/wondrouswaffles/status/1869",
"platform": "twitter"
},
{
"status": "success",
"id": "106638148652344_601623445855888",
"postUrl": "https://www.facebook.com/106638148652329/posts/6016",
"platform": "facebook"
}
],
"id": "bVQotNtxgXAUmLtqmw2",
"refId": "b68bdcabb379be2cf1186c1e595449804b232sa",
"profileTitle": "The Best Profile",
"post": "Formal education will make you a living. Self education will make you a fortune. - Jim Rohn"
}
]
}
{
"status": "success",
"posts": [
{
"status": "scheduled",
"scheduleDate": "2023-04-01T10:04:12Z",
"id": "qvu8gysraodz2WFZgRX7", // Ayrshare Post ID used for delete, comment, analytics, etc.
"refId": "9abf1426d6ce9122effdeeddfdfdfd",
"profileTitle": "Best Profile",
"post": "I never thought of myself as being handsome or good-looking or whatever. I always felt like an outsider. - Elton John"
}
]
}
{
"status": "error",
"errors": [
{
"action": "post",
"status": "error",
"code": 156,
"message": "Youtube does not seem to be linked with Ayrshare. Please confirm the linkage on the Social Accounts page in your dashboard. .../ayrshare.com/additional-info/troubleshooting",
"platform": "youtube"
},
{
"action": "post",
"status": "error",
"code": 110,
"message": "Status is a duplicate.",
"post": "Today is a great day",
"platform": "twitter"
}
],
"postIds": [],
"id": "0OGBzZssN5hxy8dMSRaD" // Ayrshare Post ID used for delete, comment, analytics, etc.
}
{
"status": "error",
"posts": [
{
"status": "error",
"errors": [
{
"action": "post",
"status": "error",
"code": 156,
"message": "Instagram is not linked.
Please confirm the linkage on the Social Accounts page in the dashboard. https://www.ayrshare.com/docs/help-center/overview",
"platform": "instagram"
}
],
"postIds": [],
"id": "ekftQJ0hFB1Fx6bnM33",
"refId": "9abf1426d6ce9122effdeeddfdfdfd",
"profileTitle": "Best Profile",
"post": "The most common way people give up their power is by thinking they don't have any. - Alice Walker"
}
]
}
{
"status": "error",
"errors": [
{
"action": "post",
"status": "error",
"code": 107,
"message": "Facebook Error: This status update is identical to the last one you posted. Try posting something different, or delete your previous update.",
"platform": "facebook"
}
],
"postIds": [],
"id": "6APU4qqI7XO7JM3BOy6B" // Ayrshare Post ID used for delete, comment, analytics, etc.
}
Post
投稿を公開する API: 任意のソーシャルネットワークに投稿 | Ayrshare Docs
Ayrshare の API 呼び出し 1 回で、Facebook、Instagram、X、LinkedIn、TikTok、YouTube などに投稿できます。パラメータ、コード例、対応メディアをご覧ください。
POST
/
post
curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"post": "Today is a great day!",
"platforms": ["twitter", "facebook", "instagram", "linkedin"],
"mediaUrls": ["https://img.ayrshare.com/012/gb.jpg"]
}' \
-X POST https://api.ayrshare.com/api/post
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/post", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${API_KEY}`
},
body: JSON.stringify({
post: "Today is a great day!", // required
platforms: ["bluesky", "facebook", "instagram", "linkedin", "twitter"], // required
mediaUrls: ["https://img.ayrshare.com/012/gb.jpg"] //optional
}),
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
payload = {'post': 'Today is a great day!',
'platforms': ['bluesky', 'facebook', 'instagram', 'linkedin', 'twitter'],
'mediaUrls': ['https://img.ayrshare.com/012/gb.jpg']}
headers = {'Content-Type': 'application/json',
'Authorization': 'Bearer API_KEY'}
r = requests.post('https://api.ayrshare.com/api/post',
json=payload,
headers=headers)
print(r.json())
<?php
$curl = curl_init();
$data = [
"post" => "Today is a great day!",
"platforms" => ["bluesky", "facebook", "instagram", "linkedin", "pinterest", "twitter"],
"mediaUrls" => ["https://img.ayrshare.com/012/gb.jpg"]
];
curl_setopt_array($curl, [
CURLOPT_URL => 'https://api.ayrshare.com/api/post',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($data),
CURLOPT_HTTPHEADER => [
'Authorization: Bearer API_KEY', // Replace 'API_KEY' with your actual API key
'Content-Type: application/json'
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
package main
import (
"bytes"
"encoding/json"
"log"
"net/http"
)
func main() {
message := map[string]interface{}{
"post": "Today is a great day!",
"platforms": []string{"bluesky", "facebook", "instagram", "linkedin", "twitter"},
"mediaUrls": []string{"https://img.ayrshare.com/012/gb.jpg"}
}
bytesRepresentation, err := json.Marshal(message)
if err != nil {
log.Fatalln(err)
}
req, _ := http.NewRequest("POST", "https://api.ayrshare.com/api/post",
bytes.NewBuffer(bytesRepresentation))
req.Header.Add("Content-Type", "application/json; charset=UTF-8")
req.Header.Add("Authorization", "Bearer API_KEY")
res, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal("Error:", err)
}
res.Body.Close()
}
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace PostPOSTRequest_csharp
{
class Post
{
private static readonly HttpClient client = new HttpClient();
static async Task Main(string[] args)
{
string API_KEY = "API_KEY";
string url = "https://api.ayrshare.com/api/post";
// Set up request headers
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY);
// Prepare JSON content
string json = "{\"post\" : \"Today is a great day!\","
+ "\"platforms\" : [ \"bluesky\", \"facebook\", \"instagram\", \"linkedin\", \"twitter\" ],"
+ "\"mediaUrls\" : [ \"https://img.ayrshare.com/012/gb.jpg\" ]}";
var content = new StringContent(json, Encoding.UTF8, "application/json");
try
{
// Send POST request
HttpResponseMessage response = await client.PostAsync(url, content);
response.EnsureSuccessStatusCode();
// Read response
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
}
catch (HttpRequestException e)
{
Console.WriteLine($"Error: {e.Message}");
}
}
}
}
require 'httparty' # gem install httparty
res = HTTParty.post("https://api.ayrshare.com/api/post",
headers: {Authorization: "Bearer API_KEY"},
body: {
post: "Today is a great day!",
platforms: ['bluesky', 'facebook', 'instagram', 'linkedin', 'twitter'],
mediaUrls: ["https://img.ayrshare.com/012/gb.jpg"]
}).body
puts res
{
"status": "success",
"errors": [],
"postIds": [
{
// Details at https://www.ayrshare.com/docs/apis/post/social-networks/bluesky
"status": "success",
"id": "at://did:plc:n7atrjd22xgkmgwig6dzlhzd/app.bsky.feed.post/3lez7fwx452", // Bluesky Social Post ID
"cid": "bafyreie6n475cd3ynr6sfacvohu5qgjibcooxnug6zcbghkwnrwi5stafy", // Bluesky Content ID
"postUrl": "https://bsky.app/profile/madworlds.bsky.social/post/3lez7fwx4572",
"platform": "bluesky"
},
{
// Details at https://www.ayrshare.com/docs/apis/post/social-networks/facebook
"status": "success",
"id": "104923907983682_108329000309742", // Facebook Social Post ID
"platform": "facebook",
"postUrl": "https://www.facebook.com/104923907983682_108329000309742",
},
{
// Details at https://www.ayrshare.com/docs/apis/post/social-networks/google
"status": "success",
"id": "3837985438581442258", // Google Business Profile Social Post ID
"postUrl": "https://local.google.com/place?id=5229466225881728772&use=posts&lpsid=CM",
"type": "localPosts",
"platform": "gmb"
},
{
// Details at https://www.ayrshare.com/docs/apis/post/social-networks/instagram
"status": "success",
"platform": "instagram", // Instagram Social Post ID
"id": "17878176260289172",
"postUrl": "https://www.instagram.com/p/CP1dI9Hp_WO/",
"usedQuota": 12,
"contentIssues": { // Optional — only present when Ayrshare detected and resolved a content issue
"originMediaHostFailed": true,
"details": ["Media URL could not be retrieved by the social network. Successfully posted using Ayrshare automated media protection."]
}
},
{
// Details at https://www.ayrshare.com/docs/apis/post/social-networks/linkedin
"status": "success",
"id": "urn:li:share:7282181682126807041", // LinkedIn Social Post ID
"postUrl": "https://www.linkedin.com/feed/update/urn:li:share:7282181682126807041",
"owner": "urn:li:organization:77682157",
"platform": "linkedin"
},
{
// Details at https://www.ayrshare.com/docs/apis/post/social-networks/pinterest
"status": "success",
"id": "42995371460659062", // Pinterest Social Post ID
"postUrl": "https://www.pinterest.com/pin/429953714606062/",
"platform": "pinterest"
},
{
// Details at https://www.ayrshare.com/docs/apis/post/social-networks/reddit
"status": "success",
"id": "1hvdvof", // Reddit Social Post ID
"postUrl": "https://www.reddit.com/r/test/comments/1hvdvof/reddit_post_title/",
"platform": "reddit"
},
{
// Details at https://www.ayrshare.com/docs/apis/post/social-networks/snapchat
"status": "success",
"id": "921ed204-e123-5b08-a9ce-zx489f1f38c5", // Snapchat Social Post ID
"mediaId": "V6noC6UOQgOcABCDEgFZEwAAgd3F0cnp1eWtxZAb9PsH-MXb9PsIWAAAAAA", // Snapchat Media ID
"postUrl": "https://www.snapchat.com/add/samsmith1920/921ed204-e123-5b08-a9ce-zx489f1f38c5",
"type": "stories",
"ended": "2025-05-23T13:04:30.545Z",
"platform": "snapchat"
},
{
// Details at https://www.ayrshare.com/docs/apis/post/social-networks/telegram
"status": "success",
"id": 635, // Telegram Social Post ID
"postUrl": "https://t.me/c/1424847122/635",
"platform": "telegram"
},
{
// Details at https://www.ayrshare.com/docs/apis/post/social-networks/tiktok
"status": "success",
"idShare": "v_pub_url~v2.7456954878846683182",
"id": "pending", // TikTok Social Post ID - see https://www.ayrshare.com/docs/apis/post/social-networks/tiktok
"isVideo": true,
"platform": "tiktok"
},
{
// Details at https://www.ayrshare.com/docs/apis/post/social-networks/twitter
"status": "success",
"id": "1288899996423983105", // X/Twitter Social Post ID
"platform": "twitter",
"postUrl": "https://x.com/handle/status/1288899996423983105"
},
{
// Details at https://www.ayrshare.com/docs/apis/post/social-networks/youtube
"status": "success",
"id": "3oQeP-kTsbo", // YouTube Social Post ID
"postUrl": "https://youtu.be/3oQeP-kTo",
"platform": "youtube"
}
],
"id": "RhrbDtYh7hdSMc67zC8H" // Ayrshare Post ID used for delete, analytics, comments, etc.
}
{
"status": "scheduled",
"scheduleDate": "2023-04-01T10:04:12Z",
"id": "IUiaqFkQP96UJJXYjRpv", // Ayrshare Post ID used for delete, comment, analytics, etc.
"refId": "9abf1426d6ce9122effdeeddfdfdfd",
"post": "Genius is eternal patience. - Michelangelo"
}
{
"status": "success",
"posts": [
{
"status": "success",
"errors": [],
"postIds": [
{
"status": "success",
"id": "1869166036466991888",
"postUrl": "https://twitter.com/wondrouswaffles/status/1869",
"platform": "twitter"
},
{
"status": "success",
"id": "106638148652344_601623445855888",
"postUrl": "https://www.facebook.com/106638148652329/posts/6016",
"platform": "facebook"
}
],
"id": "bVQotNtxgXAUmLtqmw2",
"refId": "b68bdcabb379be2cf1186c1e595449804b232sa",
"profileTitle": "The Best Profile",
"post": "Formal education will make you a living. Self education will make you a fortune. - Jim Rohn"
}
]
}
{
"status": "success",
"posts": [
{
"status": "scheduled",
"scheduleDate": "2023-04-01T10:04:12Z",
"id": "qvu8gysraodz2WFZgRX7", // Ayrshare Post ID used for delete, comment, analytics, etc.
"refId": "9abf1426d6ce9122effdeeddfdfdfd",
"profileTitle": "Best Profile",
"post": "I never thought of myself as being handsome or good-looking or whatever. I always felt like an outsider. - Elton John"
}
]
}
{
"status": "error",
"errors": [
{
"action": "post",
"status": "error",
"code": 156,
"message": "Youtube does not seem to be linked with Ayrshare. Please confirm the linkage on the Social Accounts page in your dashboard. .../ayrshare.com/additional-info/troubleshooting",
"platform": "youtube"
},
{
"action": "post",
"status": "error",
"code": 110,
"message": "Status is a duplicate.",
"post": "Today is a great day",
"platform": "twitter"
}
],
"postIds": [],
"id": "0OGBzZssN5hxy8dMSRaD" // Ayrshare Post ID used for delete, comment, analytics, etc.
}
{
"status": "error",
"posts": [
{
"status": "error",
"errors": [
{
"action": "post",
"status": "error",
"code": 156,
"message": "Instagram is not linked.
Please confirm the linkage on the Social Accounts page in the dashboard. https://www.ayrshare.com/docs/help-center/overview",
"platform": "instagram"
}
],
"postIds": [],
"id": "ekftQJ0hFB1Fx6bnM33",
"refId": "9abf1426d6ce9122effdeeddfdfdfd",
"profileTitle": "Best Profile",
"post": "The most common way people give up their power is by thinking they don't have any. - Alice Walker"
}
]
}
{
"status": "error",
"errors": [
{
"action": "post",
"status": "error",
"code": 107,
"message": "Facebook Error: This status update is identical to the last one you posted. Try posting something different, or delete your previous update.",
"platform": "facebook"
}
],
"postIds": [],
"id": "6APU4qqI7XO7JM3BOy6B" // Ayrshare Post ID used for delete, comment, analytics, etc.
}
あなたやあなたのユーザーが連携しているソーシャルネットワークに投稿を公開します。
User Profiles に投稿を公開したい場合は、詳細を /profiles endpoint でご覧ください。
Authorization ヘッダー に
API_KEY を、User Profile に投稿する場合は PROFILE_KEY も必ず追加してください。
API Key は Ayrshare Developer Dashboard の API Key ページで確認できます。
投稿オプションの詳細については Post API Overview をご覧ください。
ヘッダーパラメータ
ボディパラメータ
platforms パラメータで指定したソーシャルネットワークに送信する投稿テキスト。
URL やリッチテキストの含め方など、高度なオプションはこちらをご覧ください。テキストなしで公開するには、空文字列
"" を送信できます。投稿するソーシャルメディアプラットフォーム。次のいずれかの値を持つ文字列の配列を受け付けます:
bluesky、facebook、gmb、instagram、linkedin、pinterest、reddit、snapchat、telegram、threads、tiktok、twitter、または youtube。注意: Facebook ページには facebook、Google Business Profile には gmb を使用してください。all を使用すると、連携されているすべてのソーシャルネットワークに投稿します。また、各ソーシャルネットワークで必須のフィールドを必ず含めてください。
例: youtube が連携されている場合、youTubeOptions に title を含める必要があります。投稿に含める画像または動画 URL の配列。詳細は /media endpoint をご覧ください。URL はセキュアである必要があり、
https:// で始まる必要があります。URL に特殊文字(例: ñ)が含まれる場合は、送信前に特殊文字をエンコードしてください。動画は有料プランが必要です。画像および動画の要件 とその他の高度なオプションはこちらをご覧ください。Ayrshare は URL のファイル拡張子(.mp4)に基づいてメディアタイプを判定しようとします。URL が既知の動画拡張子で終わらない場合(アニメーション GIF など)には、メディアが動画であることを明示的に設定できます。詳細は video extension をご覧ください。
将来の投稿をスケジュールする日時。UTC 日時を受け付けます。例えば
YYYY-MM-DDThh:mm:ssZ 形式を使用し、2026-07-08T12:30:00Z のように送信します。
追加の例は utctime をご覧ください。詳細は schedule posts もご覧ください。既定では、スケジュール済み投稿は受け入れ前にメディア要件などの問題について事前検証されます。
Ayrshare のチェックで問題が見つかると、即座にエラーレスポンスが返され、投稿はスケジュールされません。
スケジュール日時に到達すると投稿が公開され、その時点で最終的な成功またはエラーレスポンスが Webhook または /history endpoint 経由で送信されます。この事前検証ステップをスキップするには、
validateScheduled を false に設定します。エラーを早期に検出するため、スケジュール済み投稿では検証を有効のままにしておくことを推奨します。
そうしないと投稿がスケジュールされ、公開時にのみエラーを受け取ることになります。詳細は scheduled webhook actions をご覧ください。投稿後に自動的に最初のコメントを追加します。詳細は first comment をご覧ください。
投稿のコメントを無効にします。Instagram、LinkedIn、TikTok でのみ利用可能です。
Ayrshare のリンク短縮機能 を使用して、すべてのプラットフォームで投稿内のリンクを短縮します。https で始まる URL のみが短縮されます。リンク短縮には Max Pack が必要です。サードパーティのリンク短縮サービス の使用については、こちらをご覧ください。
詳細は auto-schedule をご覧ください。
一定の間隔でコンテンツを複数回自動的に再投稿し、常に新鮮で視認性の高いエバーグリーンなコンテンツを作成します。詳細は auto repost をご覧ください。
詳細は auto hashtags をご覧ください。
Bluesky details をご覧ください。
Facebook details をご覧ください。
Google Business Profile details をご覧ください。
Instagram details をご覧ください。
LinkedIn details をご覧ください。
Pinterest details をご覧ください。
Reddit details をご覧ください。
Snapchat details をご覧ください。
Telegram details をご覧ください。
Threads details をご覧ください。
TikTok details をご覧ください。
X/Twitter details をご覧ください。
YouTube details をご覧ください。
詳細は approval workflow をご覧ください。
テスト用にランダムな投稿テキストを生成 します。
randomPost: true は post フィールドを無視します。テスト用にランダムなメディア画像を生成 します。
randomMediaUrl: true は mediaUrls フィールドを無視します。投稿に関連付けるオプションの一意 ID。重複した ID は拒否されます。詳細は idempotency をご覧ください。
/history endpoint 経由で取得可能な投稿のメモを設定します。メモは参照専用であり、投稿には影響しません。
curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"post": "Today is a great day!",
"platforms": ["twitter", "facebook", "instagram", "linkedin"],
"mediaUrls": ["https://img.ayrshare.com/012/gb.jpg"]
}' \
-X POST https://api.ayrshare.com/api/post
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/post", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${API_KEY}`
},
body: JSON.stringify({
post: "Today is a great day!", // required
platforms: ["bluesky", "facebook", "instagram", "linkedin", "twitter"], // required
mediaUrls: ["https://img.ayrshare.com/012/gb.jpg"] //optional
}),
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
payload = {'post': 'Today is a great day!',
'platforms': ['bluesky', 'facebook', 'instagram', 'linkedin', 'twitter'],
'mediaUrls': ['https://img.ayrshare.com/012/gb.jpg']}
headers = {'Content-Type': 'application/json',
'Authorization': 'Bearer API_KEY'}
r = requests.post('https://api.ayrshare.com/api/post',
json=payload,
headers=headers)
print(r.json())
<?php
$curl = curl_init();
$data = [
"post" => "Today is a great day!",
"platforms" => ["bluesky", "facebook", "instagram", "linkedin", "pinterest", "twitter"],
"mediaUrls" => ["https://img.ayrshare.com/012/gb.jpg"]
];
curl_setopt_array($curl, [
CURLOPT_URL => 'https://api.ayrshare.com/api/post',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($data),
CURLOPT_HTTPHEADER => [
'Authorization: Bearer API_KEY', // Replace 'API_KEY' with your actual API key
'Content-Type: application/json'
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
package main
import (
"bytes"
"encoding/json"
"log"
"net/http"
)
func main() {
message := map[string]interface{}{
"post": "Today is a great day!",
"platforms": []string{"bluesky", "facebook", "instagram", "linkedin", "twitter"},
"mediaUrls": []string{"https://img.ayrshare.com/012/gb.jpg"}
}
bytesRepresentation, err := json.Marshal(message)
if err != nil {
log.Fatalln(err)
}
req, _ := http.NewRequest("POST", "https://api.ayrshare.com/api/post",
bytes.NewBuffer(bytesRepresentation))
req.Header.Add("Content-Type", "application/json; charset=UTF-8")
req.Header.Add("Authorization", "Bearer API_KEY")
res, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal("Error:", err)
}
res.Body.Close()
}
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace PostPOSTRequest_csharp
{
class Post
{
private static readonly HttpClient client = new HttpClient();
static async Task Main(string[] args)
{
string API_KEY = "API_KEY";
string url = "https://api.ayrshare.com/api/post";
// Set up request headers
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY);
// Prepare JSON content
string json = "{\"post\" : \"Today is a great day!\","
+ "\"platforms\" : [ \"bluesky\", \"facebook\", \"instagram\", \"linkedin\", \"twitter\" ],"
+ "\"mediaUrls\" : [ \"https://img.ayrshare.com/012/gb.jpg\" ]}";
var content = new StringContent(json, Encoding.UTF8, "application/json");
try
{
// Send POST request
HttpResponseMessage response = await client.PostAsync(url, content);
response.EnsureSuccessStatusCode();
// Read response
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
}
catch (HttpRequestException e)
{
Console.WriteLine($"Error: {e.Message}");
}
}
}
}
require 'httparty' # gem install httparty
res = HTTParty.post("https://api.ayrshare.com/api/post",
headers: {Authorization: "Bearer API_KEY"},
body: {
post: "Today is a great day!",
platforms: ['bluesky', 'facebook', 'instagram', 'linkedin', 'twitter'],
mediaUrls: ["https://img.ayrshare.com/012/gb.jpg"]
}).body
puts res
{
"status": "success",
"errors": [],
"postIds": [
{
// Details at https://www.ayrshare.com/docs/apis/post/social-networks/bluesky
"status": "success",
"id": "at://did:plc:n7atrjd22xgkmgwig6dzlhzd/app.bsky.feed.post/3lez7fwx452", // Bluesky Social Post ID
"cid": "bafyreie6n475cd3ynr6sfacvohu5qgjibcooxnug6zcbghkwnrwi5stafy", // Bluesky Content ID
"postUrl": "https://bsky.app/profile/madworlds.bsky.social/post/3lez7fwx4572",
"platform": "bluesky"
},
{
// Details at https://www.ayrshare.com/docs/apis/post/social-networks/facebook
"status": "success",
"id": "104923907983682_108329000309742", // Facebook Social Post ID
"platform": "facebook",
"postUrl": "https://www.facebook.com/104923907983682_108329000309742",
},
{
// Details at https://www.ayrshare.com/docs/apis/post/social-networks/google
"status": "success",
"id": "3837985438581442258", // Google Business Profile Social Post ID
"postUrl": "https://local.google.com/place?id=5229466225881728772&use=posts&lpsid=CM",
"type": "localPosts",
"platform": "gmb"
},
{
// Details at https://www.ayrshare.com/docs/apis/post/social-networks/instagram
"status": "success",
"platform": "instagram", // Instagram Social Post ID
"id": "17878176260289172",
"postUrl": "https://www.instagram.com/p/CP1dI9Hp_WO/",
"usedQuota": 12,
"contentIssues": { // Optional — only present when Ayrshare detected and resolved a content issue
"originMediaHostFailed": true,
"details": ["Media URL could not be retrieved by the social network. Successfully posted using Ayrshare automated media protection."]
}
},
{
// Details at https://www.ayrshare.com/docs/apis/post/social-networks/linkedin
"status": "success",
"id": "urn:li:share:7282181682126807041", // LinkedIn Social Post ID
"postUrl": "https://www.linkedin.com/feed/update/urn:li:share:7282181682126807041",
"owner": "urn:li:organization:77682157",
"platform": "linkedin"
},
{
// Details at https://www.ayrshare.com/docs/apis/post/social-networks/pinterest
"status": "success",
"id": "42995371460659062", // Pinterest Social Post ID
"postUrl": "https://www.pinterest.com/pin/429953714606062/",
"platform": "pinterest"
},
{
// Details at https://www.ayrshare.com/docs/apis/post/social-networks/reddit
"status": "success",
"id": "1hvdvof", // Reddit Social Post ID
"postUrl": "https://www.reddit.com/r/test/comments/1hvdvof/reddit_post_title/",
"platform": "reddit"
},
{
// Details at https://www.ayrshare.com/docs/apis/post/social-networks/snapchat
"status": "success",
"id": "921ed204-e123-5b08-a9ce-zx489f1f38c5", // Snapchat Social Post ID
"mediaId": "V6noC6UOQgOcABCDEgFZEwAAgd3F0cnp1eWtxZAb9PsH-MXb9PsIWAAAAAA", // Snapchat Media ID
"postUrl": "https://www.snapchat.com/add/samsmith1920/921ed204-e123-5b08-a9ce-zx489f1f38c5",
"type": "stories",
"ended": "2025-05-23T13:04:30.545Z",
"platform": "snapchat"
},
{
// Details at https://www.ayrshare.com/docs/apis/post/social-networks/telegram
"status": "success",
"id": 635, // Telegram Social Post ID
"postUrl": "https://t.me/c/1424847122/635",
"platform": "telegram"
},
{
// Details at https://www.ayrshare.com/docs/apis/post/social-networks/tiktok
"status": "success",
"idShare": "v_pub_url~v2.7456954878846683182",
"id": "pending", // TikTok Social Post ID - see https://www.ayrshare.com/docs/apis/post/social-networks/tiktok
"isVideo": true,
"platform": "tiktok"
},
{
// Details at https://www.ayrshare.com/docs/apis/post/social-networks/twitter
"status": "success",
"id": "1288899996423983105", // X/Twitter Social Post ID
"platform": "twitter",
"postUrl": "https://x.com/handle/status/1288899996423983105"
},
{
// Details at https://www.ayrshare.com/docs/apis/post/social-networks/youtube
"status": "success",
"id": "3oQeP-kTsbo", // YouTube Social Post ID
"postUrl": "https://youtu.be/3oQeP-kTo",
"platform": "youtube"
}
],
"id": "RhrbDtYh7hdSMc67zC8H" // Ayrshare Post ID used for delete, analytics, comments, etc.
}
{
"status": "scheduled",
"scheduleDate": "2023-04-01T10:04:12Z",
"id": "IUiaqFkQP96UJJXYjRpv", // Ayrshare Post ID used for delete, comment, analytics, etc.
"refId": "9abf1426d6ce9122effdeeddfdfdfd",
"post": "Genius is eternal patience. - Michelangelo"
}
{
"status": "success",
"posts": [
{
"status": "success",
"errors": [],
"postIds": [
{
"status": "success",
"id": "1869166036466991888",
"postUrl": "https://twitter.com/wondrouswaffles/status/1869",
"platform": "twitter"
},
{
"status": "success",
"id": "106638148652344_601623445855888",
"postUrl": "https://www.facebook.com/106638148652329/posts/6016",
"platform": "facebook"
}
],
"id": "bVQotNtxgXAUmLtqmw2",
"refId": "b68bdcabb379be2cf1186c1e595449804b232sa",
"profileTitle": "The Best Profile",
"post": "Formal education will make you a living. Self education will make you a fortune. - Jim Rohn"
}
]
}
{
"status": "success",
"posts": [
{
"status": "scheduled",
"scheduleDate": "2023-04-01T10:04:12Z",
"id": "qvu8gysraodz2WFZgRX7", // Ayrshare Post ID used for delete, comment, analytics, etc.
"refId": "9abf1426d6ce9122effdeeddfdfdfd",
"profileTitle": "Best Profile",
"post": "I never thought of myself as being handsome or good-looking or whatever. I always felt like an outsider. - Elton John"
}
]
}
{
"status": "error",
"errors": [
{
"action": "post",
"status": "error",
"code": 156,
"message": "Youtube does not seem to be linked with Ayrshare. Please confirm the linkage on the Social Accounts page in your dashboard. .../ayrshare.com/additional-info/troubleshooting",
"platform": "youtube"
},
{
"action": "post",
"status": "error",
"code": 110,
"message": "Status is a duplicate.",
"post": "Today is a great day",
"platform": "twitter"
}
],
"postIds": [],
"id": "0OGBzZssN5hxy8dMSRaD" // Ayrshare Post ID used for delete, comment, analytics, etc.
}
{
"status": "error",
"posts": [
{
"status": "error",
"errors": [
{
"action": "post",
"status": "error",
"code": 156,
"message": "Instagram is not linked.
Please confirm the linkage on the Social Accounts page in the dashboard. https://www.ayrshare.com/docs/help-center/overview",
"platform": "instagram"
}
],
"postIds": [],
"id": "ekftQJ0hFB1Fx6bnM33",
"refId": "9abf1426d6ce9122effdeeddfdfdfd",
"profileTitle": "Best Profile",
"post": "The most common way people give up their power is by thinking they don't have any. - Alice Walker"
}
]
}
{
"status": "error",
"errors": [
{
"action": "post",
"status": "error",
"code": 107,
"message": "Facebook Error: This status update is identical to the last one you posted. Try posting something different, or delete your previous update.",
"platform": "facebook"
}
],
"postIds": [],
"id": "6APU4qqI7XO7JM3BOy6B" // Ayrshare Post ID used for delete, comment, analytics, etc.
}
⌘I
