Authentication
All PostSyncer API requests require authentication using an API key. This guide explains how to obtain and use your API key.
Getting Your API Key
- Sign in to your PostSyncer account at app.postsyncer.com
- Navigate to Settings → API Integration
- Click “Create”
- Copy the key immediately - it won’t be shown again
Keep your API key secure and never share it publicly. If your key is compromised, regenerate it immediately.
Using Your API Key
Include your API key in the Authorization header of all requests:
Authorization: Bearer YOUR_API_KEY
Example Request
curl -X GET "https://postsyncer.com/api/v1/workspaces" \
-H "Authorization: Bearer 11|HzNfjB..." \
-H "Content-Type: application/json"
JavaScript Example
const response = await fetch('https://postsyncer.com/api/v1/workspaces', {
headers: {
'Authorization': 'Bearer 11|HzNfjB...',
'Content-Type': 'application/json'
}
});
Python Example
import requests
headers = {
'Authorization': 'Bearer 11|HzNfjB...',
'Content-Type': 'application/json'
}
response = requests.get('https://postsyncer.com/api/v1/workspaces', headers=headers)
Python Example
import requests
headers = {
'Authorization': 'Bearer 11|HzNfjB...',
'Content-Type': 'application/json'
}
response = requests.get('https://postsyncer.com/api/v1/workspaces', headers=headers)
PHP Example
$headers = [
'Authorization: Bearer 11|HzNfjB...',
'Content-Type: application/json',
];
$ch = curl_init('https://postsyncer.com/api/v1/workspaces');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error: ' . curl_error($ch);
} else {
$data = json_decode($response, true);
print_r($data);
}
curl_close($ch);
Error Responses
If authentication fails, you’ll receive a 401 Unauthorized response:
{
"message": "Unauthenticated."
}
Common authentication errors:
| Error Code | Description |
Unauthenticated. | Invalid or missing API key |
Expired | API key has expired |
Forbidden - Insufficient permissions | API key doesn’t have required permissions |