Docs

Pages API

Get all available posting destinations including accounts and their sub-pages.

GET/social/pages

Get 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

ParameterTypeRequiredDescription
platformstringNoFilter 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

FieldTypeDescription
idstringUnique identifier for the page/destination
typestring"account" or "page"
platformstringSocial media platform
namestringDisplay name of the page/account
canPostbooleanWhether posts can be scheduled to this destination
parentAccountobjectParent 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/pages

Filter 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=facebook

Common 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
  }))
};