profiles
Business plan members can create and manage multiple profile accounts. If you require multiple account for your business or clients, please contact us at [email protected] for assistance.
Click the β€Ί in the endpoint to view details.
post
https://app.ayrshare.com/api
/post
Post to Profiles
If a response of an array is required, please include the body parameter arrayResponse with the boolean value of true.
It is important to follow the rules of the social networks, especially in regards to duplicate or similar content. Please see here for details:
​

Request Examples

cURL
Node.js
Python
PHP
Go
C#
1
curl \
2
-H "Authorization: Bearer API_KEY" \
3
-H 'Content-Type: application/json' \
4
-d '{"post": "Today is a great day!", "platforms": ["twitter", "facebook", "instagram", "linkedin"], "profileKeys": ["Key 1", "Key 2"], "mediaUrls": ["https://images.ayrshare.com/imgs/GhostBusters.jpg"]}' \
5
-X POST https://app.ayrshare.com/api/post
Copied!
1
const fetch = require("node-fetch");
2
const API_KEY = "API_KEY";
3
const postMsg = "Today is a great day!";
4
​
5
fetch("https://app.ayrshare.com/api/post", {
6
method: "POST",
7
headers: {
8
"Content-Type": "application/json",
9
"Authorization": `Bearer ${API_KEY}`
10
},
11
body: JSON.stringify({
12
post: postMsg, // required
13
platforms: ["twitter", "facebook", "instagram", "linkedin"], // required
14
profileKeys: ["PROFILE_KEY"], // required for client posting
15
mediaUrls: ["https://images.ayrshare.com/imgs/GhostBusters.jpg"], //optional
16
}),
17
})
18
.then((res) => res.json())
19
.then((json) => console.log(json))
20
.catch(console.error);
Copied!
1
import requests
2
​
3
payload = {'post': 'Today is a great day!',
4
'platforms': ['twitter', 'facebook', 'instagram', 'linkedin'],
5
'profileKeys': ['PROFILE_KEY'],
6
'mediaUrls': ['https://images.ayrshare.com/imgs/GhostBusters.jpg']}
7
headers = {'Content-Type': 'application/json',
8
'Authorization': 'Bearer API_KEY'}
9
​
10
r = requests.post('https://app.ayrshare.com/api/post',
11
json=payload,
12
headers=headers)
13
14
print(r.json())
Copied!
1
<?php
2
require 'vendor/autoload.php'; // Composer auto-loader
3
​
4
$client = new GuzzleHttp\Client();
5
$res = $client->request(
6
'POST',
7
'https://app.ayrshare.com/api/post',
8
[
9
'headers' => [
10
'Content-Type' => 'application/json',
11
'Authorization' => 'Bearer API_KEY'
12
],
13
'json' => [
14
'post' => 'Today is a great day!',
15
'platforms' => ['twitter', 'facebook', 'instagram', 'linkedin'], // required
16
'profileKeys' => ['PROFILE_KEY'], // required
17
'mediaUrls' => ['https://images.ayrshare.com/imgs/GhostBusters.jpg'], // optional
18
]
19
]
20
);
21
​
22
echo json_encode(json_decode($res->getBody()), JSON_PRETTY_PRINT);
Copied!
1
package main
2
​
3
import (
4
"bytes"
5
"encoding/json"
6
"log"
7
"net/http"
8
)
9
​
10
func main() {
11
message := map[string]interface{}{
12
"post": "Today is a great day!",
13
"platforms": []string{"twitter", "facebook", "instagram", "linkedin"},
14
"profileKeys": []string{"PROFILE_KEY"},
15
"mediaUrls": []string{"https://images.ayrshare.com/imgs/GhostBusters.jpg"}
16
}
17
​
18
bytesRepresentation, err := json.Marshal(message)
19
if err != nil {
20
log.Fatalln(err)
21
}
22
​
23
req, _ := http.NewRequest("POST", "https://app.ayrshare.com/api/post",
24
bytes.NewBuffer(bytesRepresentation))
25
​
26
req.Header.Add("Content-Type", "application/json; charset=UTF-8")
27
req.Header.Add("Authorization", "Bearer API_KEY")
28
​
29
res, err := http.DefaultClient.Do(req)
30
if err != nil {
31
log.Fatal("Error:", err)
32
}
33
​
34
res.Body.Close()
35
}
Copied!
1
using System;
2
using System.Net;
3
using System.IO;
4
​
5
namespace PostPOSTRequest_charp
6
{
7
class Post
8
{
9
static void Main(string[] args)
10
{
11
string API_KEY = "API_KEY";
12
string url = "https://app.ayrshare.com/api/post";
13
​
14
var httpWebRequest = WebRequest.CreateHttp(url);
15
httpWebRequest.ContentType = "application/json";
16
httpWebRequest.Method = "POST";
17
httpWebRequest.Headers.Add("Authorization", "Bearer " + API_KEY);
18
​
19
using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
20
{
21
string json = "{\"post\" : \"Today is a great day forever!\","
22
+ "\"platforms\" : [ \"twitter\", \"facebook\", \"instagram\", \"linkedin\" ],"
23
+ "\"mediaUrls\" : [ \"https://images.ayrshare.com/imgs/GhostBusters.jpg\" ],"
24
+ "\"profileKeys\" : [ \"PROFILE_KEY\" ]}";
25
​
26
streamWriter.Write(json);
27
streamWriter.Flush();
28
}
29
​
30
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
31
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
32
{
33
var response = streamReader.ReadToEnd();
34
Console.WriteLine(response);
35
}
36
}
37
}
38
}
Copied!
​
post
https://app.ayrshare.com/api
/profiles/create-profile
Create a New Profile

Request Examples

cURL
Node.js
Python
PHP
Go
C#
1
curl \
2
-H "Authorization: Bearer API_KEY" \
3
-H 'Content-Type: application/json' \
4
-d '{"title": "ACME Profile"}' \
5
-X POST https://app.ayrshare.com/api/profiles/create-profile
Copied!
1
const fetch = require("node-fetch");
2
const API_KEY = "API_KEY";
3
​
4
fetch("https://app.ayrshare.com/api/profiles/create-profile", {
5
method: "POST",
6
headers: {
7
"Content-Type": "application/json",
8
"Authorization": `Bearer ${API_KEY}`
9
},
10
body: JSON.stringify({
11
title: "ACME Profile", // required
12
}),
13
})
14
.then((res) => res.json())
15
.then((json) => console.log(json))
16
.catch(console.error);
Copied!
1
import requests
2
​
3
payload = {'title': 'ACME Profile'}
4
headers = {'Content-Type': 'application/json',
5
'Authorization': 'Bearer API_KEY'}
6
​
7
r = requests.post('https://app.ayrshare.com/api/profiles/create-profile',
8
json=payload,
9
headers=headers)
10
11
print(r.json())
Copied!
1
<?php
2
require 'vendor/autoload.php'; // Composer auto-loader
3
​
4
$client = new GuzzleHttp\Client();
5
$res = $client->request(
6
'POST',
7
'https://app.ayrshare.com/api/profiles/create-profile',
8
[
9
'headers' => [
10
'Content-Type' => 'application/json',
11
'Authorization' => 'Bearer API_KEY'
12
],
13
'title' => ['ACME Profile'],
14
]
15
);
16
​
17
echo json_encode(json_decode($res->getBody()), JSON_PRETTY_PRINT);
Copied!
1
package main
2
​
3
import (
4
"bytes"
5
"encoding/json"
6
"log"
7
"net/http"
8
)
9
​
10
func main() {
11
message := map[string]interface{}{
12
"title": "ACME Profile"
13
}
14
​
15
bytesRepresentation, err := json.Marshal(message)
16
if err != nil {
17
log.Fatalln(err)
18
}
19
​
20
req, _ := http.NewRequest("POST", "https://app.ayrshare.com/api/profiles/create-profile",
21
bytes.NewBuffer(bytesRepresentation))
22
​
23
req.Header.Add("Content-Type", "application/json; charset=UTF-8")
24
req.Header.Add("Authorization", "Bearer API_KEY")
25
​
26
res, err := http.DefaultClient.Do(req)
27
if err != nil {
28
log.Fatal("Error:", err)
29
}
30
​
31
res.Body.Close()
32
}
Copied!
1
using System;
2
using System.Net;
3
using System.IO;
4
​
5
namespace CreateProfilePOSTRequest_charp
6
{
7
class CreateProfile
8
{
9
static void Main(string[] args)
10
{
11
string API_KEY = "API_KEY";
12
string url = "https://app.ayrshare.com/api/profiles/create-profile";
13
​
14
var httpWebRequest = WebRequest.CreateHttp(url);
15
httpWebRequest.ContentType = "application/json";
16
httpWebRequest.Method = "POST";
17
httpWebRequest.Headers.Add("Authorization", "Bearer " + API_KEY);
18
​
19
using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
20
{
21
string json = "{\"title\" : \"ACME Profile\"}";
22
​
23
streamWriter.Write(json);
24
streamWriter.Flush();
25
}
26
​
27
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
28
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
29
{
30
var response = streamReader.ReadToEnd();
31
Console.WriteLine(response);
32
}
33
}
34
}
35
}
Copied!
The Profile Key should be securely stored in your system with appropriate access controls. The refId should be stored to associate a profile to an endpoint return.
​
delete
https://app.ayrshare.com/api
/profiles/delete-profile
Delete a Profile

Request Examples

cURL
Node.js
Python
PHP
C#
1
curl \
2
-H "Authorization: Bearer API_KEY" \
3
-H 'Content-Type: application/json' \
4
-d '{"profileKey": "PROFILE_KEY"}' \
5
-X DELETE https://app.ayrshare.com/api/profiles/delete-profile
Copied!
1
const fetch = require("node-fetch");
2
const API_KEY = "API_KEY";
3
const profileKey = "PROFILE_KEY";
4
​
5
fetch("https://app.ayrshare.com/api/profiles/delete-profile", {
6
method: "DELETE",
7
headers: {
8
"Content-Type": "application/json",
9
"Authorization": `Bearer ${API_KEY}`
10
},
11
body: JSON.stringify({ profileKey }),
12
})
13
.then((res) => res.json())
14
.then((json) => console.log(json))
15
.catch(console.error);
Copied!
1
import requests
2
​
3
payload = {'profileKey': 'PROFILE_KEY'}
4
headers = {'Content-Type': 'application/json',
5
'Authorization': 'Bearer API_KEY'}
6
​
7
r = requests.delete('https://app.ayrshare.com/api/profiles/delete-profile',
8
json=payload,
9
headers=headers)
10
11
print(r.json())
Copied!
1
<?php
2
require 'vendor/autoload.php'; // Composer auto-loader
3
​
4
$client = new GuzzleHttp\Client();
5
$res = $client->request(
6
'DELETE',
7
'https://app.ayrshare.com/api/profiles/delete-profile',
8
[
9
'headers' => [
10
'Content-Type' => 'application/json',
11
'Authorization' => 'Bearer API_KEY'
12
],
13
'profileKey' => ['PROFILE_KEY'],
14
]
15
);
16
​
17
echo json_encode(json_decode($res->getBody()), JSON_PRETTY_PRINT);
Copied!
1
using System;
2
using System.Net;
3
using System.IO;
4
​
5
namespace DeletePOSTRequest_charp
6
{
7
class Delete
8
{
9
static void Main(string[] args)
10
{
11
string API_KEY = "API_KEY";
12
string url = "https://app.ayrshare.com/api/profiles/delete-profile";
13
​
14
var httpWebRequest = WebRequest.CreateHttp(url);
15
httpWebRequest.ContentType = "application/json";
16
httpWebRequest.Method = "DELETE";
17
httpWebRequest.Headers.Add("Authorization", "Bearer " + API_KEY);
18
​
19
using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
20
{
21
string json = "{\"profileKey\" : \"Profile Key\"}";
22
​
23
streamWriter.Write(json);
24
streamWriter.Flush();
25
}
26
​
27
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
28
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
29
{
30
var response = streamReader.ReadToEnd();
31
Console.WriteLine(response);
32
}
33
}
34
}
35
}
Copied!
​
put
https://app.ayrshare.com/api
/profiles/update-profile
Update a Profile

Request Examples

cURL
Node.js
Python
PHP
C#
1
curl \
2
-H "Authorization: Bearer API_KEY" \
3
-H 'Content-Type: application/json' \
4
-d '{"profileKey": "Jokdf-903Js-j9sd0-Pow02-QS9n3", "title": "ACME Profile"}' \
5
-X PUT https://app.ayrshare.com/api/profiles/update-profile
Copied!
1
const fetch = require("node-fetch");
2
const API_KEY = "API_KEY";
3
​
4
fetch("https://app.ayrshare.com/api/profiles/update-profile", {
5
method: "PUT",
6
headers: {
7
"Content-Type": "application/json",
8
"Authorization": `Bearer ${API_KEY}`
9
},
10
body: JSON.stringify({
11
profileKey: "Jokdf-903Js-j9sd0-Pow02-QS9n3", // required
12
title: "ACME Profile",
13
}),
14
})
15
.then((res) => res.json())
16
.then((json) => console.log(json))
17
.catch(console.error);
Copied!
1
import requests
2
​
3
payload = {'profileKey': 'Jokdf-903Js-j9sd0-Pow02-QS9n3', 'title': 'ACME Profile'}
4
headers = {'Content-Type': 'application/json',
5
'Authorization': 'Bearer API_KEY'}
6
​
7
r = requests.put('https://app.ayrshare.com/api/profiles/update-profile',
8
json=payload,
9
headers=headers)
10
11
print(r.json())
Copied!
1
<?php
2
require 'vendor/autoload.php'; // Composer auto-loader
3
​
4
$client = new GuzzleHttp\Client();
5
$res = $client->request(
6
'PUT',
7
'https://app.ayrshare.com/api/profiles/update-profile',
8
[
9
'headers' => [
10
'Content-Type' => 'application/json',
11
'Authorization' => 'Bearer API_KEY'
12
],
13
'profileKey' => ['Jokdf-903Js-j9sd0-Pow02-QS9n3'],
14
'title' => ['ACME Profile'],
15
]
16
);
17
​
18
echo json_encode(json_decode($res->getBody()), JSON_PRETTY_PRINT);
Copied!
1
using System;
2
using System.Net;
3
using System.IO;
4
​
5
namespace CreateProfilePOSTRequest_charp
6
{
7
class CreateProfile
8
{
9
static void Main(string[] args)
10
{
11
string API_KEY = "API_KEY";
12
string url = "https://app.ayrshare.com/api/profiles/update-profile";
13
​
14
var httpWebRequest = WebRequest.CreateHttp(url);
15
httpWebRequest.ContentType = "application/json";
16
httpWebRequest.Method = "PUT";
17
httpWebRequest.Headers.Add("Authorization", "Bearer " + API_KEY);
18
​
19
using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
20
{
21
string json = "{\"profileKey\" : \"Jokdf-903Js-j9sd0-Pow02-QS9n3\", \"title\" : \"ACME Profile\"}";
22
​
23
streamWriter.Write(json);
24
streamWriter.Flush();
25
}
26
​
27
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
28
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
29
{
30
var response = streamReader.ReadToEnd();
31
Console.WriteLine(response);
32
}
33
}
34
}
35
}
Copied!
​
get
https://app.ayrshare.com/api
/profiles
Get Profiles

Request Examples

cURL
Node.js
Python
PHP
C#
1
curl \
2
-H "Authorization: Bearer API_KEY" \
3
-X GET https://app.ayrshare.com/api/profiles
Copied!
1
const fetch = require("node-fetch");
2
const API_KEY = "API_KEY";
3
​
4
fetch("https://app.ayrshare.com/api/profiles", {
5
method: "GET",
6
headers: {
7
"Authorization": `Bearer ${API_KEY}`
8
}
9
})
10
.then((res) => res.json())
11
.then((json) => console.log(json))
12
.catch(console.error);
Copied!
1
import requests
2
​
3
headers = {'Authorization': 'Bearer API_KEY'}
4
​
5
r = requests.get('https://app.ayrshare.com/api/profiles', headers=headers)
6
7
print(r.json())
Copied!
1
<?php
2
require 'vendor/autoload.php'; // Composer auto-loader
3
​
4
$client = new GuzzleHttp\Client();
5
$res = $client->request(
6
'GET',
7
'https://app.ayrshare.com/api/profiles',
8
[
9
'headers' => [
10
'Content-Type' => 'application/json',
11
'Authorization' => 'Bearer API_KEY'
12
]
13
]
14
);
15
​
16
echo json_encode(json_decode($res->getBody()), JSON_PRETTY_PRINT);
Copied!
1
using System;
2
using System.Net;
3
using System.IO;
4
​
5
namespace HistoryGETRequest_charp
6
{
7
class History
8
{
9
static void Main(string[] args)
10
{
11
string API_KEY = "API_KEY";
12
string url = "https://app.ayrshare.com/api/profiles";
13
​
14
var httpWebRequest = WebRequest.CreateHttp(url);
15
httpWebRequest.ContentType = "application/json";
16
httpWebRequest.Headers.Add("Authorization", "Bearer " + API_KEY);
17
​
18
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
19
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
20
{
21
var response = streamReader.ReadToEnd();
22
Console.WriteLine(response);
23
}
24
}
25
}
26
}
Copied!
​
post
https://app.ayrshare.com/api
/profiles/generateJWT
Generate a JWT

Request Examples

cURL
Node.js
Python
PHP
C#
1
curl \
2
-H "Authorization: Bearer API_KEY" \
3
-H 'Content-Type: application/json' \
4
-d '{"domain": "ACME", "privateKey": "-----BEGIN RSA PRIVATE KEY...", "profileKey": "PROFILE_KEY"}' \
5
-X POST https://app.ayrshare.com/api/profiles/generateJWT
Copied!
1
const fetch = require("node-fetch");
2
const API_KEY = "API_KEY";
3
const PROFILE_KEY = "PROFILE_KEY";
4
​
5
fetch("https://app.ayrshare.com/api/profiles/generateJWT", {
6
method: "POST",
7
headers: {
8
"Content-Type": "application/json",
9
"Authorization": `Bearer ${API_KEY}`
10
},
11
body: JSON.stringify({
12
domain: "ACME", // required
13
privateKey: "-----BEGIN RSA PRIVATE KEY...", // required
14
profileKey: PROFILE_KEY, // required
15
}),
16
})
17
.then((res) => res.json())
18
.then((json) => console.log(json))
19
.catch(console.error);
Copied!
1
import requests
2
​
3
payload = {'domain': 'ACME',
4
'privateKey': '-----BEGIN RSA PRIVATE KEY...',
5
'profileKey': 'PROFILE_KEY' }
6
headers = {'Content-Type': 'application/json',
7
'Authorization': 'Bearer API_KEY'}
8
​
9
r = requests.post('https://app.ayrshare.com/api/profiles/generateJWT',
10
json=payload,
11
headers=headers)
12
13
print(r.json())
Copied!
1
<?php
2
require 'vendor/autoload.php'; // Composer auto-loader
3
​
4
$client = new GuzzleHttp\Client();
5
$res = $client->request(
6
'POST',
7
'https://app.ayrshare.com/api/post',
8
[
9
'headers' => [
10
'Content-Type' => 'application/json',
11
'Authorization' => 'Bearer API_KEY'
12
],
13
'json' => [
14
'domain' => 'ACME',
15
'privateKey' => '-----BEGIN RSA PRIVATE KEY...', // required
16
'profileKey' => 'PROFILE_KEY', // requires
17
]
18
]
19
);
20
​
21
echo json_encode(json_decode($res->getBody()), JSON_PRETTY_PRINT);
Copied!
1
using System;
2
using System.Net;
3
using System.IO;
4
​
5
namespace GenerateJWTRequest_charp
6
{
7
class GenerateJWT
8
{
9
static void Main(string[] args)
10
{
11
string API_KEY = "API_KEY";
12
string url = "https://app.ayrshare.com/api/profiles/generateJWT";
13
​
14
var httpWebRequest = WebRequest.CreateHttp(url);
15
httpWebRequest.ContentType = "application/json";
16
httpWebRequest.Method = "POST";
17
httpWebRequest.Headers.Add("Authorization", "Bearer " + API_KEY);
18
​
19
using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
20
{
21
string json = "{\"domain\" : \"ACME\","
22
+ "\"privateKey\" : \"-----BEGIN RSA PRIVATE KEY...\","
23
+ "\"profileKey\" : \"PROFILE_KEY\"}";
24
​
25
streamWriter.Write(json);
26
streamWriter.Flush();
27
}
28
​
29
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
30
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
31
{
32
var response = streamReader.ReadToEnd();
33
Console.WriteLine(response);
34
}
35
}
36
}
37
}
Copied!
The Private Key must be precise, meaning preserving all characters including newlines. We recommend reading the private.key from a file to preserve all characters. If you paste the key into your code, you might need to manually replace newlines with a \n character or URL encode the string.
If you are a Bubble user, please see Generate JWT Token in the Bubble.io section for instructions:

Additional Endpoints

All other endpoints, such as /user, /analytics, or /delete, can be called on behalf of a Profile account by adding the "profileKeys" parameter and sending a single profileKey as a String.
For example, the /delete endpoint can be called to delete a Profile account's post for the given post id for the provided Profile Key.
1
const fetch = require("node-fetch");
2
const API_KEY = "API_KEY";
3
const PROFILE_KEY = "PROFILE_KEY";
4
const id = "Post ID";
5
​
6
fetch("https://app.ayrshare.com/api/delete", {
7
method: "DELETE",
8
headers: {
9
"Content-Type": "application/json",
10
"Authorization": `Bearer ${API_KEY}`
11
},
12
body: JSON.stringify({
13
profileKeys: PROFILE_KEY, // a single Profile Key passed as a String
14
id: id
15
}),
16
})
17
.then((res) => res.json())
18
.then((json) => console.log(json))
19
.catch(console.error);
Copied!
or for a path parameter with /history:
1
https://app.ayrshare.com/api/history?profileKeys=ldfnk0s82j
Copied!
Please see the endpoints for further detail.
Last modified 12d ago