Links

generate

Generate new social post and rewrite post using ChatGPT
Creating the text for social media post can be difficult: writing the copy, hashtag, correct length, and emojis. Or if you have an existing social post and need variations — the social networks do not like duplicate posts.
The following endpoint use GPT-4 to process the requests.
Please note this endpoint is in Beta, and is subject to change without prior notice.
Available for Premium and Business Plans.
❗Click the › in the endpoint to view details.
post
https://app.ayrshare.com/api
/generate/post
Generate a Post Text

Request Examples

cURL
Node.js
Python
PHP
curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-d '{"post": "This beautiful new shoe is on sale now. It comes in red, blue, or purple. Check it out today."}' \
-X POST https://app.ayrshare.com/api/generate/post
const API_KEY = "API_KEY";
​
fetch("https://app.ayrshare.com/api/generate/post", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${API_KEY}`
},
body: JSON.stringify({
post: "This beautiful new shoe is on sale now. It comes in red, blue, or purple. Check it out today.", // required
}),
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
​
payload = {'post': 'This beautiful new shoe is on sale now. It comes in red, blue, or purple. Check it out today.'}
headers = {'Content-Type': 'application/json',
'Authorization': 'Bearer API_KEY'}
​
r = requests.post('https://app.ayrshare.com/api/generate/post',
json=payload,
headers=headers)
print(r.json())
<?php
​
$curl = curl_init();
$data = array (
"post" => "This beautiful new shoe is on sale now. It comes in red, blue, or purple. Check it out today."
);
​
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://app.ayrshare.com/api/generate/post',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => http_build_query($data),
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer API_KEY',
'Accept-Encoding: gzip'
),
));
​
$response = curl_exec($curl);
curl_close($curl);
echo $response;
post
https://app.ayrshare.com
/generate/rewrite
Rewrite a Post

Request Examples

cURL
Node.js
Python
PHP
curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-d '{"post": "Kali melts the heart, even when the rest of the day is freezing. Happy International Polar Bear Day to the largest land carnivore and the biggest, furriest part of the Zoo’s bear community! \nOur resident polar bear Kali (pronounced “Cully”) is a wild-born bear that was born off of the northwest coast of Alaska. He was named by the people of the Native Village of Point Lay, who rescued him. \"Kali\" is the Inupiaq name for Point Lay. Eventually, the U.S. Fish and Wildlife"}' \
-X POST https://app.ayrshare.com/api/generate/generate/rewrite
const API_KEY = "API_KEY";
​
fetch("https://app.ayrshare.com/api/generate/rewrite", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${API_KEY}`
},
body: JSON.stringify({
post: "Kali melts the heart, even when the rest of the day is freezing. Happy International Polar Bear Day to the largest land carnivore and the biggest, furriest part of the Zoo’s bear community! \nOur resident polar bear Kali (pronounced “Cully”) is a wild-born bear that was born off of the northwest coast of Alaska. He was named by the people of the Native Village of Point Lay, who rescued him. \"Kali\" is the Inupiaq name for Point Lay. Eventually, the U.S. Fish and Wildlife", // required
}),
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
​
payload = {'post': 'Kali melts the heart, even when the rest of the day is freezing. Happy International Polar Bear Day to the largest land carnivore and the biggest, furriest part of the Zoo’s bear community! \nOur resident polar bear Kali (pronounced “Cully”) is a wild-born bear that was born off of the northwest coast of Alaska. He was named by the people of the Native Village of Point Lay, who rescued him. \"Kali\" is the Inupiaq name for Point Lay. Eventually, the U.S. Fish and Wildlife'}
headers = {'Content-Type': 'application/json',
'Authorization': 'Bearer API_KEY'}
​
r = requests.post('https://app.ayrshare.com/api/generate/rewrite',
json=payload,
headers=headers)
print(r.json())
<?php
​
$curl = curl_init();
$data = array (
"post" => "Kali melts the heart, even when the rest of the day is freezing. Happy International Polar Bear Day to the largest land carnivore and the biggest, furriest part of the Zoo’s bear community! \nOur resident polar bear Kali (pronounced “Cully”) is a wild-born bear that was born off of the northwest coast of Alaska. He was named by the people of the Native Village of Point Lay, who rescued him. \"Kali\" is the Inupiaq name for Point Lay. Eventually, the U.S. Fish and Wildlife"
);
​
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://app.ayrshare.com/api/generate/rewrite',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => http_build_query($data),
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer API_KEY',
'Accept-Encoding: gzip'
),
));
​
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Last modified 12d ago