curl -X GET "https://postsyncer.com/api/v1/accounts" \
-H "Authorization: Bearer YOUR_API_TOKEN"
{
"data": [
{
"id": 136,
"workspace_id": 12,
"platform": "twitter",
"username": "heyabdulmejid",
"name": "Abdul",
"avatar": "https://pbs.twimg.com/profile_images/1878383928995684352/3Xw5HTsk_400x400.jpg"
},
{
"id": 245,
"workspace_id": 12,
"platform": "twitter",
"username": "username1",
"name": "Account Name",
"avatar": "https://pbs.twimg.com/profile_images/188258dddddddd5070692626432/3oMtYxt5_normal.png"
}
]
}
Accounts
List Accounts
Retrieve all social media accounts from your workspaces
GET
accounts
curl -X GET "https://postsyncer.com/api/v1/accounts" \
-H "Authorization: Bearer YOUR_API_TOKEN"
{
"data": [
{
"id": 136,
"workspace_id": 12,
"platform": "twitter",
"username": "heyabdulmejid",
"name": "Abdul",
"avatar": "https://pbs.twimg.com/profile_images/1878383928995684352/3Xw5HTsk_400x400.jpg"
},
{
"id": 245,
"workspace_id": 12,
"platform": "twitter",
"username": "username1",
"name": "Account Name",
"avatar": "https://pbs.twimg.com/profile_images/188258dddddddd5070692626432/3oMtYxt5_normal.png"
}
]
}
List Accounts
Retrieves all social media accounts from workspaces that the authenticated user has access to.Request
curl -X GET "https://postsyncer.com/api/v1/accounts" \
-H "Authorization: Bearer YOUR_API_TOKEN"
Response
array
Array of account objects
{
"data": [
{
"id": 136,
"workspace_id": 12,
"platform": "twitter",
"username": "heyabdulmejid",
"name": "Abdul",
"avatar": "https://pbs.twimg.com/profile_images/1878383928995684352/3Xw5HTsk_400x400.jpg"
},
{
"id": 245,
"workspace_id": 12,
"platform": "twitter",
"username": "username1",
"name": "Account Name",
"avatar": "https://pbs.twimg.com/profile_images/188258dddddddd5070692626432/3oMtYxt5_normal.png"
}
]
}
Code Examples
curl -X GET "https://postsyncer.com/api/v1/accounts" \
-H "Authorization: Bearer YOUR_API_TOKEN"
const axios = require('axios');
const getAccounts = async () => {
try {
const response = await axios.get('https://postsyncer.com/api/v1/accounts', {
headers: {
'Authorization': 'Bearer YOUR_API_TOKEN'
}
});
console.log('Accounts:', response.data);
return response.data;
} catch (error) {
console.error('Error fetching accounts:', error.response?.data || error.message);
}
};
getAccounts();
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://postsyncer.com/api/v1/accounts');
curl_setopt($ch, CURLOPT_HTTPGET, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer YOUR_API_TOKEN'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($httpCode === 200) {
$accounts = json_decode($response, true);
echo "Found " . count($accounts['data']) . " accounts";
} else {
echo "Error: " . $response;
}
?>
import requests
headers = {
'Authorization': 'Bearer YOUR_API_TOKEN'
}
response = requests.get(
'https://postsyncer.com/api/v1/accounts',
headers=headers
)
if response.status_code == 200:
accounts = response.json()
print(f"Found {len(accounts['data'])} accounts")
for account in accounts['data']:
print(f"Account {account['id']}: {account['platform']} - {account['username']}")
print(f" Active: {account['is_active']}")
else:
print(f"Error: {response.status_code}")
print(response.text)
Error Codes
Unauthorized
Missing or invalid API token
Forbidden
Token does not have ‘accounts’ permission
Was this page helpful?
⌘I