user

Get details on a user.

get
/user

https://app.ayrshare.com/api/user
Get data on the user based on the API key.
Request
Response
Request
Headers
Authorization
required
string
Format: Authorization: Bearer API_KEY. See Overview for more information.
Response
200: OK
User data returned. Display Names are the user assigned account names at the social networks. If display name not present will return empty string.
{
"email": "[email protected]",
"created": {
"_seconds": 1604578889,
"_nanoseconds": 211000000,
"utc": "2020-11-05T12:21:29Z"
},
"activeSocialAccounts": [
"twitter",
"facebook",
"linkedin",
"instagram",
"youtube"
],
"displayNames": [
{
"displayName": "Instagram Time",
"platform": "instagram"
},
{
"displayName": "Twitter Time",
"platform": "twitter"
},
{
"displayName": "YouTube Time",
"platform": "youtube"
},
{
"displayName": "LinkedIn Time",
"platform": "linkedin"
},
{
"displayName": "Facebook Time",
"platform": "facebook"
}
],
"usedMonthlyQuota": 53,
"monthlyQuota": 1000
}

If no social accounts are linked, activeSocialAccounts will not be returned.

Request Examples

cURL
Node.js
Python
PHP
C#
cURL
curl \
-H "Authorization: Bearer API_KEY" \
-X GET https://app.ayrshare.com/api/user
Node.js
const fetch = require("node-fetch");
const API_KEY = "API_KEY";
fetch("https://app.ayrshare.com/api/user", {
method: "GET",
headers: {
"Authorization": `Bearer ${API_KEY}`
}
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
Python
import requests
headers = {'Authorization': 'Bearer API_KEY'}
r = requests.get('https://app.ayrshare.com/api/user', headers=headers)
print(r.json())
PHP
<?php
require 'vendor/autoload.php'; // Composer auto-loader
$client = new GuzzleHttp\Client();
$res = $client->request(
'GET',
'https://app.ayrshare.com/api/user',
[
'headers' => [
'Content-Type' => 'application/json',
'Authorization' => 'Bearer API_KEY'
]
]
);
echo json_encode(json_decode($res->getBody()), JSON_PRETTY_PRINT);
C#
using System;
using System.Net;
using System.IO;
namespace UserGETRequest_charp
{
class User
{
static void Main(string[] args)
{
string API_KEY = "API_KEY";
string url = "https://app.ayrshare.com/api/user";
var httpWebRequest = WebRequest.CreateHttp(url);
httpWebRequest.ContentType = "application/json";
httpWebRequest.Headers.Add("Authorization", "Bearer " + API_KEY);
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
var response = streamReader.ReadToEnd();
Console.WriteLine(response);
}
}
}
}

Profiles

Get user data for a particular user profile by passing the profileKeys parameter as a path parameter. Available for Business Plan users only.

https://app.ayrshare.com/api/user?profileKeys=ldfnk0s82j