API Version: v1.2.0
View ChangelogDeveloper API DocumentationDocs
Pages API
Get all available posting destinations including accounts and their sub-pages.
GET
/social/pagesGet Connected Pages/Destinations
Retrieve all connected pages, accounts, and posting destinations available for the workspace. This includes main accounts and their sub-pages (Facebook pages, LinkedIn organizations, etc.).
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| platform | string | No | Filter by specific platform (facebook, instagram, linkedin, twitter, tiktok) |
Response
{
"success": true,
"data": {
"pages": [
{
"id": "account_123",
"type": "account",
"platform": "facebook",
"accountId": "account_123",
"name": "My Personal Facebook",
"username": "john.doe",
"email": "john@example.com",
"connectedAt": "2024-01-01T00:00:00Z",
"canPost": true,
"avatar": "https://graph.facebook.com/123/picture"
},
{
"id": "page_456",
"type": "page",
"platform": "facebook",
"accountId": "account_123",
"pageId": "page_456",
"name": "My Business Page",
"username": "mybusiness",
"connectedAt": "2024-01-01T00:00:00Z",
"canPost": true,
"avatar": "https://graph.facebook.com/456/picture",
"parentAccount": {
"id": "account_123",
"name": "My Personal Facebook"
},
"followers": 1250,
"verified": false
}
],
"total": 2,
"byPlatform": {
"facebook": [
{
"id": "account_123",
"type": "account",
"name": "My Personal Facebook",
"canPost": true
},
{
"id": "page_456",
"type": "page",
"name": "My Business Page",
"canPost": true
}
]
}
}
}Response Fields
| Field | Type | Description |
|---|---|---|
| id | string | Unique identifier for the page/destination |
| type | string | "account" or "page" |
| platform | string | Social media platform |
| name | string | Display name of the page/account |
| canPost | boolean | Whether posts can be scheduled to this destination |
| parentAccount | object | Parent account info (for pages only) |
Example Requests
Get All Pages
curl -H "X-API-Key: your_api_key_here" \
-H "X-Workspace-ID: your_workspace_id" \
https://api.zyhap.com/api/v1/public/marketing/pagesFilter by Platform
curl -H "X-API-Key: your_api_key_here" \
-H "X-Workspace-ID: your_workspace_id" \
https://api.zyhap.com/api/v1/public/marketing/pages?platform=facebookCommon Use Cases
🎯 Destination Selection
Display available posting destinations in your UI, allowing users to select which pages/accounts to post to.
📊 Platform Analytics
Show hierarchical relationship between accounts and their pages for better organization.
🔍 Platform Filtering
Filter destinations by platform to show only relevant options based on content type.
✅ Permission Checking
Verify posting permissions before attempting to schedule content to specific destinations.
Integration Example
Here's how to use the pages endpoint to build a destination selector:
// Get all available destinations
const response = await fetch('/api/v1/public/marketing/pages', {
headers: {
'X-API-Key': 'your_api_key',
'X-Workspace-ID': 'your_workspace_id'
}
});
const { data } = await response.json();
// Group destinations by platform for UI
const destinationsByPlatform = data.byPlatform;
// Find destinations that can post
const postableDestinations = data.pages.filter(page => page.canPost);
// Use in post scheduling
const postData = {
content: "Hello World!",
platforms: postableDestinations.slice(0, 2).map(dest => ({
platformId: dest.platform,
pageId: dest.id,
pageName: dest.name
}))
};