curl -X GET "https://postsyncer.com/api/v1/labels" \
-H "Authorization: Bearer YOUR_API_TOKEN"
{
"data": [
{
"id": 1,
"name": "Product Launch",
"color": "#ff0000",
"workspace": {
"id": 12,
"name": "abdulmejidshemsuawel",
"slug": "abdulmejidshemsuawel",
"type": "PERSONAL",
"logo": null,
"timezone": "Africa/Addis_Ababa",
"language": "en"
}
},
{
"id": 2,
"name": "Winter",
"color": "#0000ff",
"workspace": {
"id": 12,
"name": "abdulmejidshemsuawel",
"slug": "abdulmejidshemsuawel",
"type": "PERSONAL",
"logo": null,
"timezone": "Africa/Addis_Ababa",
"language": "en"
}
}
]
}
Labels
List Labels
Retrieve all labels from your workspaces
GET
labels
curl -X GET "https://postsyncer.com/api/v1/labels" \
-H "Authorization: Bearer YOUR_API_TOKEN"
{
"data": [
{
"id": 1,
"name": "Product Launch",
"color": "#ff0000",
"workspace": {
"id": 12,
"name": "abdulmejidshemsuawel",
"slug": "abdulmejidshemsuawel",
"type": "PERSONAL",
"logo": null,
"timezone": "Africa/Addis_Ababa",
"language": "en"
}
},
{
"id": 2,
"name": "Winter",
"color": "#0000ff",
"workspace": {
"id": 12,
"name": "abdulmejidshemsuawel",
"slug": "abdulmejidshemsuawel",
"type": "PERSONAL",
"logo": null,
"timezone": "Africa/Addis_Ababa",
"language": "en"
}
}
]
}
List Labels
Retrieves all labels from workspaces that the authenticated user has access to.Request
curl -X GET "https://postsyncer.com/api/v1/labels" \
-H "Authorization: Bearer YOUR_API_TOKEN"
Response
array
Array of label objects
{
"data": [
{
"id": 1,
"name": "Product Launch",
"color": "#ff0000",
"workspace": {
"id": 12,
"name": "abdulmejidshemsuawel",
"slug": "abdulmejidshemsuawel",
"type": "PERSONAL",
"logo": null,
"timezone": "Africa/Addis_Ababa",
"language": "en"
}
},
{
"id": 2,
"name": "Winter",
"color": "#0000ff",
"workspace": {
"id": 12,
"name": "abdulmejidshemsuawel",
"slug": "abdulmejidshemsuawel",
"type": "PERSONAL",
"logo": null,
"timezone": "Africa/Addis_Ababa",
"language": "en"
}
}
]
}
Code Examples
curl -X GET "https://postsyncer.com/api/v1/labels" \
-H "Authorization: Bearer YOUR_API_TOKEN"
const axios = require('axios');
const getLabels = async () => {
try {
const response = await axios.get('https://postsyncer.com/api/v1/labels', {
headers: {
'Authorization': 'Bearer YOUR_API_TOKEN'
}
});
console.log('Labels:', response.data);
return response.data;
} catch (error) {
console.error('Error fetching labels:', error.response?.data || error.message);
}
};
getLabels();
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://postsyncer.com/api/v1/labels');
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) {
$labels = json_decode($response, true);
echo "Found " . count($labels['data']) . " labels";
} else {
echo "Error: " . $response;
}
?>
import requests
headers = {
'Authorization': 'Bearer YOUR_API_TOKEN'
}
response = requests.get(
'https://postsyncer.com/api/v1/labels',
headers=headers
)
if response.status_code == 200:
labels = response.json()
print(f"Found {len(labels['data'])} labels")
for label in labels['data']:
print(f"Label {label['id']}: {label['name']} ({label['color']})")
else:
print(f"Error: {response.status_code}")
print(response.text)
Error Codes
Unauthorized
Missing or invalid API token
Forbidden
Token does not have ‘labels’ permission
Was this page helpful?
⌘I