user
User API Endpoint: Get details on a user's social media account including linked social networks and social usernames.
User API Endpoint
❗Click the › in the endpoint to view details.
GET User Profile Details
GET
https://app.ayrshare.com/api/user
Get information on the user or user profile including linked social networks and social usernames.
Query Parameters
Name | Type | Description |
---|---|---|
instagramQuota | boolean | Return the current Instagram quota used - 50 posts over a 24-hour rolling period and the Instagram profile type: creator or business. Default: false. |
validate | boolean | Check if a user profile still exists. If the user profile no longer exists, the delete details will be returned. Must include the Profile Key in the header. Optional. |
Headers
Name | Type | Description |
---|---|---|
Authorization* | string | Format: |
Profile-Key | string | The Profile Key of a user profile. |
{
"activeSocialAccounts": [
"facebook",
"gmb",
"instagram",
"linkedin",
"pinterest",
"reddit",
"telegram",
"tiktok",
"twitter",
"youtube"
],
"ayrlinkUrl": "https://ayrl.ink/bio/ayrshare", // Ayrlink Bio Page URL
"created": {
"_seconds": 1667351022,
"_nanoseconds": 814000000,
"utc": "2022-11-02T01:03:42Z"
},
"displayNames": [
{
"created": "2022-11-14T16:18:49.110Z",
"displayName": "Ayrshare",
"id": "106638152329", // Facebook Page Id
"messagingActive": true, // Messaging active for the social network
"pageName": "Ayrshare",
"platform": "facebook",
"profileUrl": "https://www.facebook.com/ayrshare",
"userId": "283748192833", // Facebook User Id
"userImage": "https://img.ayrshare.com/ndfdfJ239s/social/facebook.jpeg" // The image at the time of linking
},
{
"created": "2024-03-27T20:47:46.251Z",
"description": "Easy to integrate Social Media APIs allow you to manage all your users’ social accounts right from your product. Post, Auto Schedule, and Analytics. Great for SaaS, CMS, DAM, Agencies, and Apps.",
"displayName": "Ayrshare",
"mapsUrl": "https://maps.google.com/maps?cid=5229466225881728772",
"placeId": "ChIJN53jw8BZwokRBEeVVtPLkkg",
"platform": "gmb",
"profileUrl": "https://www.ayrshare.com/",
"reviewUrl": "https://search.google.com/local/writereview?placeid=ChIJN53jw8BZwokRBEeVVtPLkkg"
},
{
"created": "2022-11-09T20:36:58.659Z",
"displayName": "Ayrshare",
"id": "1784144322", // Associate Facebook Page Id
"messagingActive": true, // Messaging active for the social network
"pageName": "Social Media API",
"platform": "instagram",
"profileUrl": "https://www.instagram.com/ayrshare",
"type": "business", // "business" returned for both business and creator account types. Only returned if instagramQuota: true
"usedQuota": 34, // Instagram quota. 50 posts per rolling 24-hour period. Returned if instagramQuota: true
"userId": "2938492293422", // Instagram User Id
"userImage": "https://img.ayrshare.com/ndfdfJ239s/social/instagram.jpeg", // The image at the time of linking
"username": "ayrshare"
},
{
"created": "2022-11-17T18:52:29.830Z",
"displayName": "Ayrshare",
"id": "72157",
"platform": "linkedin",
"profileUrl": "https://www.linkedin.com/company/ayrshare",
"refreshDaysRemaining": 364, // Days until link auth must be refreshed
"refreshRequired": "2023-11-17T18:52:29.830Z",
"type": "corporate", // corporate or personal
"userImage": "https://img.ayrshare.com/ndfdfJ239s/social/linkedin.jpeg", // The image at the time of linking
"username": "ayrshare" // logged in username
},
{
"created": "2022-12-06T03:16:52.642Z",
"displayName": "Ayrshare",
"id": "42995790741",
"platform": "pinterest",
"profileUrl": "https://www.pinterest.com/ayrshare",
"userImage": "https://img.ayrshare.com/ndfdfJ239s/social/pinterest.jpeg", // The image at the time of linking
"username": "ayrshare"
},
{
"created": "2022-11-17T18:55:34.419Z",
"displayName": "funone",
"platform": "reddit",
"profileUrl": "https://www.reddit.com/user/funone",
"userImage": "https://img.ayrshare.com/ndfdfJ239s/social/reddit.png", // The image at the time of linking
"username": "funone"
},
{
"created": "2022-11-17T18:55:16.320Z",
"displayName": "Ayrshare",
"id": -10017122,
"platform": "telegram",
"profileUrl": "https://web.telegram.org/z/#-17122",
"type": "channel",
"userImage": "https://img.ayrshare.com/nclMLxaIzmXHxOi4KEggA5gQ1T82/social/telegram.octo-stream" // The image at the time of linking
},
{
"created": "2022-11-02T02:11:53.452Z",
"displayName": "Ayrshare",
"id": "5ebc6f39-7900-421e-bf9",
"platform": "tiktok",
"profileUrl": "https://www.tiktok.com/@ayrshare",
"userImage": "https://img.ayrshare.com/ndfdfJ239s/social/tiktok.jpeg", // The image at the time of linking
"username": "@ayrshare"
},
{
"created": "2022-11-02T01:38:42.326Z",
"displayName": "ayrshare",
"id": "1194881472",
"messagingActive": true,
"platform": "twitter", // Messaging active for the social network
"profileUrl": "https://twitter.com/ayrshare",
"subscriptionType": "Premium", // Premium, PremiumPlus, None
"twitterUsage": { // Available for Primary Profile. https://docs.ayrshare.com/rest-api/errors/http-status-codes#id-429-rate-limit
"monthlyUsage": 4323,
"monthlyLimit": 100000,
"monthlyReset": "2024-02-02"
},
"userImage": "https://img.ayrshare.com/ndfdfJ239s/social/twitter.png", // The image at the time of linking
"username": "ayrshare",
"verifiedType": "blue" // Values "blue", "business", or "none". Both "blue" and "business" are considered Premium. This will be updated when an X post is done via Ayrshare.
},
{
"created": "2022-11-17T18:54:09.954Z",
"displayName": "@ayrshare",
"id": "106891058521430758565",
"platform": "youtube",
"profileUrl": "https://www.youtube.com/@ayrshare",
"userImage": "https://img.ayrshare.com/ndfdfJ239s/social/youtube.png", // The image at the time of linking
"username": "@ayrshare"
}
],
"email": "me@ayrshare.com", // null if a User Profile
"lastApiCall": "2024-08-14T15:18:11Z", // Time of the last recorded API call for this user
"messagingConversationMonthlyCount": 7, // Monthly conversation count out of 100 - contact us if you need more per user profile
"messagingEnabled": true, // Messaging enabled for the account
"monthlyApiCalls": 49, // Count of monthly API post calls
"monthlyApiCallsQuota": 500, // Quota of monthly API post calls. Not present for Business Plans.
"refId": "13a9da9e0df1183a7a6a1fc2c60b8023fa9a32a0", // User Profile reference ID
"title": "Primary Profile", // User Profile Title - Business Plan only
"lastUpdated": "2024-01-04T15:51:17.775Z",
"nextUpdate": "2024-01-04T15:51:47.775Z"
}
{
"action": "post",
"status": "error",
"code": 144,
"message": "Some profiles not found. Please verify the Profile Keys."
}
If no social accounts are linked, activeSocialAccounts
will not be returned.
Get data for a particular User Profile by adding the Profile-Key in the header.
If your business requires gathering all of your user profile data at once, please use the /user/batch endpoint.
If you need a notification when a user links and unlinks a social account, please see the /webhooks endpoint.
Request Examples
curl \
-H "Authorization: Bearer API_KEY" \
-X GET https://app.ayrshare.com/api/user
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);
import requests
headers = {'Authorization': 'Bearer API_KEY'}
r = requests.get('https://app.ayrshare.com/api/user', headers=headers)
print(r.json())
<?php
$apiUrl = 'https://app.ayrshare.com/api/user';
$apiKey = 'API_KEY'; // Replace 'API_KEY' with your actual API key
$headers = [
'Content-Type: application/json',
'Authorization: Bearer ' . $apiKey,
];
$curl = curl_init($apiUrl);
curl_setopt_array($curl, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => $headers
]);
$response = curl_exec($curl);
if ($response === false) {
echo 'Curl error: ' . curl_error($curl);
} else {
echo json_encode(json_decode($response), JSON_PRETTY_PRINT);
}
curl_close($curl);
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);
}
}
}
}
GET Pinterest User Board Details
GET
https://app.ayrshare.com/api/user/details/:platform
Get the details of a particular platform. Current support for Pinterest Boards.
Currently supported platform values: "pinterest"
https://app.ayrshare.com/api/user/details/pinterest
Premium, Business, or Enterprise Plan required.
Headers
Name | Type | Description |
---|---|---|
Authorization* | string | Format: |
Profile-Key | string | The Profile Key of a user profile. |
{
"pinterest": [
{
"privacy": "PUBLIC",
"owner": {
"username": "ayrshare"
},
"id": "718465015493014420",
"name": "Coworking",
"description": ""
},
{
"privacy": "PUBLIC",
"owner": {
"username": "ayrshare"
},
"id": "718465015493634450",
"name": "Social Media Networks",
"description": ""
}
]
}
Request Examples
curl \
-H "Authorization: Bearer API_KEY" \
-X GET https://app.ayrshare.com/api/user/details/pinterest
const API_KEY = "API_KEY";
fetch("https://app.ayrshare.com/api/user/details/pinterest", {
method: "GET",
headers: {
"Authorization": `Bearer ${API_KEY}`
}
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
headers = {'Authorization': 'Bearer API_KEY'}
r = requests.get('https://app.ayrshare.com/api/user/details/pinterest', headers=headers)
print(r.json())
<?php
$apiUrl = 'https://app.ayrshare.com/api/user/details/pinterest';
$apiKey = 'API_KEY'; // Replace 'API_KEY' with your actual API key
$headers = [
'Content-Type: application/json',
'Authorization: Bearer ' . $apiKey,
];
$curl = curl_init($apiUrl);
curl_setopt_array($curl, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => $headers
]);
$response = curl_exec($curl);
if ($response === false) {
echo 'Curl error: ' . curl_error($curl);
} else {
echo json_encode(json_decode($response), JSON_PRETTY_PRINT);
}
curl_close($curl);
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/details/pinterest";
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);
}
}
}
}C#
PATCH Update User
PATCH
https://app.ayrshare.com/api/user/:platform
Update the account or user data of the social network. Currently only Google Business Profile is supported.
Google limits updating some Google Business Profile location fields to being updated 5 times within a rolling 24-hour period. For example updating phoneNumbers
more than 5 times in a rolling 24-hour period will return a 400 Response.
Premium, Business, or Enterprise Plan required.
Headers
Name | Type | Value |
---|---|---|
Authorization* | string | Format: |
Profile-Key | string | The Profile Key of a user profile. |
Path Parameters
Name | Type | Description |
---|---|---|
:platform* | string | Values: |
Body
Name | Type | Description |
---|---|---|
phoneNumbers | object | Object containing the different phone numbers that customers can use to get in touch with the business.
|
name | string | Google identifier for this location in the form. |
adPhone | string | An alternate phone number to display on AdWords location extensions instead of the location's primary phone number. |
storeCode | string | External identifier for this location, which must be unique within a given account. This is a means of associating the location with your own records. |
title | string | Location name should reflect your business's real-world name, as used consistently on your storefront, website, and stationery, and as known to customers. |
websiteUrl | string | A URL for this business. |
labels | array | A collection of free-form strings to allow you to tag your business. These labels are not user facing; only you can see them. Must be between 1-255 characters per label. |
latlng | object | An object that represents a latitude/longitude pair. This is expressed as a pair of doubles to represent degrees latitude and degrees longitude. Unless specified otherwise, this object must conform to the WGS84 standard. Values must be within normalized ranges.
|
profile | object | Description of the location in your own voice, not editable by anyone else.
|
Response
{
"gmb": {
"status": "success",
"data": {
"name": "locations/4913369732395328466",
"languageCode": "en",
"title": "Ayrshare",
"phoneNumbers": {},
"categories": {
"primaryCategory": {
"name": "categories/gcid:software_company",
"displayName": "Software company",
"serviceTypes": [
{
"serviceTypeId": "job_type_id:application_development",
"displayName": "Application development"
},
{
"serviceTypeId": "job_type_id:big_data_consulting_and_implementation",
"displayName": "Big data consulting & implementation"
},
{
"serviceTypeId": "job_type_id:data_center_management",
"displayName": "Data center management"
},
{
"serviceTypeId": "job_type_id:data_quality_management",
"displayName": "Data quality management"
},
{
"serviceTypeId": "job_type_id:enterprise_software_development",
"displayName": "Enterprise software development"
},
{
"serviceTypeId": "job_type_id:it_consulting",
"displayName": "It consulting"
},
{
"serviceTypeId": "job_type_id:mobile_app_development",
"displayName": "Mobile app development"
},
{
"serviceTypeId": "job_type_id:platform_consulting",
"displayName": "Platform consulting"
},
{
"serviceTypeId": "job_type_id:security_services_management",
"displayName": "Security services management"
},
{
"serviceTypeId": "job_type_id:software_consulting",
"displayName": "Software consulting"
},
{
"serviceTypeId": "job_type_id:software_development",
"displayName": "Software development"
},
{
"serviceTypeId": "job_type_id:software_development_outsourcing",
"displayName": "Software development outsourcing"
},
{
"serviceTypeId": "job_type_id:solution_consulting",
"displayName": "Solution consulting"
}
],
"moreHoursTypes": [
{
"hoursTypeId": "ACCESS",
"displayName": "Access",
"localizedDisplayName": "Access"
},
{
"hoursTypeId": "BREAKFAST",
"displayName": "Breakfast",
"localizedDisplayName": "Breakfast"
},
{
"hoursTypeId": "BRUNCH",
"displayName": "Brunch",
"localizedDisplayName": "Brunch"
},
{
"hoursTypeId": "DELIVERY",
"displayName": "Delivery",
"localizedDisplayName": "Delivery"
},
{
"hoursTypeId": "DINNER",
"displayName": "Dinner",
"localizedDisplayName": "Dinner"
},
{
"hoursTypeId": "DRIVE_THROUGH",
"displayName": "Drive through",
"localizedDisplayName": "Drive through"
},
{
"hoursTypeId": "HAPPY_HOUR",
"displayName": "Happy hours",
"localizedDisplayName": "Happy hours"
},
{
"hoursTypeId": "KITCHEN",
"displayName": "Kitchen",
"localizedDisplayName": "Kitchen"
},
{
"hoursTypeId": "LUNCH",
"displayName": "Lunch",
"localizedDisplayName": "Lunch"
},
{
"hoursTypeId": "ONLINE_SERVICE_HOURS",
"displayName": "Online service hours",
"localizedDisplayName": "Online service hours"
},
{
"hoursTypeId": "PICKUP",
"displayName": "Pickup",
"localizedDisplayName": "Pickup"
},
{
"hoursTypeId": "TAKEOUT",
"displayName": "Takeout",
"localizedDisplayName": "Takeout"
},
{
"hoursTypeId": "SENIOR_HOURS",
"displayName": "Senior hours",
"localizedDisplayName": "Senior hours"
}
]
},
"additionalCategories": [
{
"name": "categories/gcid:automation_company",
"displayName": "Automation company",
"moreHoursTypes": [
{
"hoursTypeId": "ACCESS",
"displayName": "Access",
"localizedDisplayName": "Access"
},
{
"hoursTypeId": "BREAKFAST",
"displayName": "Breakfast",
"localizedDisplayName": "Breakfast"
},
{
"hoursTypeId": "BRUNCH",
"displayName": "Brunch",
"localizedDisplayName": "Brunch"
},
{
"hoursTypeId": "DELIVERY",
"displayName": "Delivery",
"localizedDisplayName": "Delivery"
},
{
"hoursTypeId": "DINNER",
"displayName": "Dinner",
"localizedDisplayName": "Dinner"
},
{
"hoursTypeId": "DRIVE_THROUGH",
"displayName": "Drive through",
"localizedDisplayName": "Drive through"
},
{
"hoursTypeId": "HAPPY_HOUR",
"displayName": "Happy hours",
"localizedDisplayName": "Happy hours"
},
{
"hoursTypeId": "KITCHEN",
"displayName": "Kitchen",
"localizedDisplayName": "Kitchen"
},
{
"hoursTypeId": "LUNCH",
"displayName": "Lunch",
"localizedDisplayName": "Lunch"
},
{
"hoursTypeId": "ONLINE_SERVICE_HOURS",
"displayName": "Online service hours",
"localizedDisplayName": "Online service hours"
},
{
"hoursTypeId": "PICKUP",
"displayName": "Pickup",
"localizedDisplayName": "Pickup"
},
{
"hoursTypeId": "TAKEOUT",
"displayName": "Takeout",
"localizedDisplayName": "Takeout"
},
{
"hoursTypeId": "SENIOR_HOURS",
"displayName": "Senior hours",
"localizedDisplayName": "Senior hours"
}
]
}
]
},
"storefrontAddress": {
"regionCode": "US",
"languageCode": "en",
"postalCode": "10019",
"administrativeArea": "NY",
"locality": "New York",
"addressLines": [
"142 W 57th St"
]
},
"websiteUri": "https://www.ayrshare.com/",
"regularHours": {
"periods": [
{
"openDay": "SUNDAY",
"openTime": {},
"closeDay": "SUNDAY",
"closeTime": {
"hours": 24
}
},
{
"openDay": "MONDAY",
"openTime": {},
"closeDay": "MONDAY",
"closeTime": {
"hours": 24
}
},
{
"openDay": "TUESDAY",
"openTime": {},
"closeDay": "TUESDAY",
"closeTime": {
"hours": 24
}
},
{
"openDay": "WEDNESDAY",
"openTime": {},
"closeDay": "WEDNESDAY",
"closeTime": {
"hours": 24
}
},
{
"openDay": "THURSDAY",
"openTime": {},
"closeDay": "THURSDAY",
"closeTime": {
"hours": 24
}
},
{
"openDay": "FRIDAY",
"openTime": {},
"closeDay": "FRIDAY",
"closeTime": {
"hours": 24
}
},
{
"openDay": "SATURDAY",
"openTime": {},
"closeDay": "SATURDAY",
"closeTime": {
"hours": 24
}
}
]
},
"serviceArea": {
"businessType": "CUSTOMER_AND_BUSINESS_LOCATION",
"places": {
"placeInfos": [
{
"placeName": "United States",
"placeId": "ChIJCzYy5IS16lQRQrfeQ5K5Oxw"
}
]
},
"regionCode": "US"
},
"openInfo": {
"status": "OPEN",
"canReopen": true
},
"metadata": {
"hasPendingEdits": true,
"canDelete": true,
"canModifyServiceList": true,
"placeId": "ChIJN53jw8BZwokRBEeVVtPLkkg",
"mapsUri": "https://maps.google.com/maps?cid=5229466225881728772",
"newReviewUri": "https://search.google.com/local/writereview?placeid=ChIJN53jw8BZwokRBEeVVtPLkkg",
"hasVoiceOfMerchant": true
},
"profile": {
"description": "Easy to integrate Social Media APIs allow you to manage all your users’ social accounts right from your product. Post, Auto Schedule, and Analytics. Great for SaaS, CMS, DAM, Agencies, and Apps."
}
}
}
}
{
"action": "authorization",
"status": "error",
"code": 227,
"message": "Error updating GBP location data. This can occur if you attempt more than 5 updates within a rolling 24 hours period. Please wait and try again."
}
Request Examples
curl -X PATCH \
-H "Authorization: Bearer API_KEY" \
-H "Accept-Encoding: gzip" \
-H "Content-Type: application/json" \
-d '{
"phoneNumbers": {
"primaryPhone": "(212)-123-4567"
},
"websiteUrl": "https://www.ayrshare.com"
}' \
"https://app.ayrshare.com/api/user/gbp"
const apiKey = 'API_KEY';
const url = 'https://app.ayrshare.com/api/user/gbp';
const data = {
phoneNumbers: {
primaryPhone: '(212)-123-4567',
},
websiteUrl: 'https://www.ayrshare.com',
};
const requestOptions = {
method: 'PATCH',
headers: {
'Authorization': `Bearer ${apiKey}`,
'Accept-Encoding': 'gzip',
'Content-Type': 'application/json',
},
body: JSON.stringify(data),
};
fetch(url, requestOptions)
.then(response => {
if (!response.ok) {
throw new Error('Request failed');
}
return response.json();
})
.then(result => {
console.log('Success:', result);
})
.catch(error => {
console.error('Error:', error);
});
import requests
import json
url = "https://app.ayrshare.com/api/user/gbp"
api_key = "API_KEY"
headers = {
"Authorization": f"Bearer {api_key}",
"Accept-Encoding": "gzip",
"Content-Type": "application/json"
}
data = {
"phoneNumbers": {
"primaryPhone": "(212)-123-4567"
},
"websiteUrl": "https://www.ayrshare.com"
}
response = requests.patch(url, headers=headers, data=json.dumps(data))
if response.status_code == 200:
result = response.json()
print("Success:", result)
else:
print("Error:", response.status_code, response.text)
<?php
$url = "https://app.ayrshare.com/api/user/gbp";
$apiKey = "API_KEY";
$headers = [
"Authorization: Bearer " . $apiKey,
"Accept-Encoding: gzip",
"Content-Type: application/json"
];
$data = [
"phoneNumbers" => [
"primaryPhone" => "(212)-123-4567"
],
"websiteUrl" => "https://www.ayrshare.com"
];
$jsonData = json_encode($data);
$options = [
"http" => [
"method" => "PATCH",
"header" => implode("\r\n", $headers),
"content" => $jsonData
]
];
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
if ($result === false) {
echo "Error: " . error_get_last()["message"];
} else {
$response = json_decode($result, true);
echo "Success: " . json_encode($response);
}
?>
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
class Program
{
static async Task Main(string[] args)
{
string url = "https://app.ayrshare.com/api/user/gbp";
string apiKey = "API_KEY";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", apiKey);
client.DefaultRequestHeaders.AcceptEncoding.Add(new StringWithQualityHeaderValue("gzip"));
var data = new
{
phoneNumbers = new
{
primaryPhone = "(212)-123-4567"
},
websiteUrl = "https://www.ayrshare.com"
};
var jsonData = JsonConvert.SerializeObject(data);
var content = new StringContent(jsonData, Encoding.UTF8, "application/json");
var response = await client.PatchAsync(url, content);
if (response.IsSuccessStatusCode)
{
var result = await response.Content.ReadAsStringAsync();
var json = JsonConvert.DeserializeObject(result);
Console.WriteLine("Success: " + result);
}
else
{
Console.WriteLine("Error: " + response.StatusCode + " - " + await response.Content.ReadAsStringAsync());
}
}
}
}
GET Batch Get All User Profiles
GET
https://app.ayrshare.com/api/user/batch
Retrieve the user data for all user profiles. Use the batch endpoint as an alternative to calling the /user endpoint for each of your users in rapid succession, which maybe be restricted by rate-limits.
The endpoint will return a pre-signed URL for the file containing all the user profile data. Please note the urlAvailable
field time for when the file will be accessible.
The pre-signed URL will expire in 7 days after creation. A new file may be generated every 3 hours.
You may also be notified when the file is ready via the Batch Action webhook.
Headers
Name | Type | Description |
---|---|---|
Authorization* | string | Format: |
{
"success": true,
"url": "https://storage.googleapis.com/batch.ayrshare.com/users/9iskiedwtOddd/users-batch-2024-01-11-22-42.json",
"urlAvailable": "2024-01-11T22:47:36Z",
"urlExpires": "2024-01-18T22:42:36Z",
"lastUpdated": "2024-01-11T22:42:36.808Z",
"nextUpdate": "2024-01-11T22:54:36.808Z"
}
{
"action": "authorization",
"status": "error",
"code": 102,
"message": "API Key not valid. Please be sure to send a Header Authorization containing 'Bearer API_KEY'. https://docs.ayrshare.com/rest-api/overview#authorization"
}
Request Examples
curl \
-H "Authorization: Bearer API_KEY" \
-X GET https://app.ayrshare.com/api/user/batch
const API_KEY = "API_KEY";
fetch("https://app.ayrshare.com/api/user/batch", {
method: "GET",
headers: {
"Authorization": `Bearer ${API_KEY}`
}
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
headers = {'Authorization': 'Bearer API_KEY'}
r = requests.get('https://app.ayrshare.com/api/user/batch', headers=headers)
print(r.json())
<?php
$apiUrl = 'https://app.ayrshare.com/api/user/batch';
$apiKey = 'API_KEY'; // Replace 'API_KEY' with your actual API key
$headers = [
'Content-Type: application/json',
'Authorization: Bearer ' . $apiKey,
];
$curl = curl_init($apiUrl);
curl_setopt_array($curl, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => $headers
]);
$response = curl_exec($curl);
if ($response === false) {
echo 'Curl error: ' . curl_error($curl);
} else {
echo json_encode(json_decode($response), JSON_PRETTY_PRINT);
}
curl_close($curl);
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);
}
}
}
}
Last updated