Getting Started
Learn how to integrate with Zyhap SMM API and schedule your first post in minutes.
Quick Start
Get up and running with the Zyhap API in 5 minutes or less.
Step 1: Get Your API Credentials
First, you'll need to obtain your API key and workspace ID from your Zyhap dashboard.
💡 Tip: Navigate to Settings → API Keys in your Zyhap dashboard to generate a new API key.
Step 2: Connect Your Social Accounts
Connect the social media accounts you want to post to through the Zyhap dashboard.
- Facebook Pages & Personal Accounts
- Instagram Business & Creator Accounts
- LinkedIn Personal & Company Pages
- Twitter/X Accounts
- TikTok Accounts
Step 3: Make Your First API Call
Test your connection by fetching your connected accounts.
curl -H "X-API-Key: your_api_key_here" \
-H "X-Workspace-ID: your_workspace_id" \
https://api.zyhap.com/api/v1/public/marketing/accountsStep 4: Schedule Your First Post
Create and schedule a simple text post to test the integration.
curl -X POST \
-H "Content-Type: application/json" \
-H "X-API-Key: your_api_key_here" \
-H "X-Workspace-ID: your_workspace_id" \
-d '{
"content": {
"text": "Hello from Zyhap API! 🚀"
},
"platforms": [
{
"platformId": "facebook",
"uniqueId": "your_page_uniqueId",
}
],
"publishDate": "2024-01-15T10:00:00Z"
}' \
https://api.zyhap.com/api/v1/public/marketing/postsAuthentication
The Zyhap API uses API keys for authentication. Include these headers with every request:
Required Headers
X-API-KeyYour unique API key from the dashboardX-Workspace-IDYour workspace identifier🔐 Security Best Practices
- • Never expose API keys in client-side code
- • Store API keys as environment variables
- • Regenerate keys if compromised
- • Use separate keys for development and production
Base URL & Endpoints
All API requests should be made to the following base URL:
Production Base URL
https://api.zyhap.com/api/v1/public/{module}Main Endpoints
Posts Management
GET /social/posts- List postsPOST /social/posts- Create postGET /social/posts/id- Get postDELETE /social/posts/id- Delete post
Account & Pages
GET /social/accounts- List accountsGET /social/pages- List pagesGET /social/drafts- List draftsGET /webhooks- List webhooks
SDK Examples
Choose your preferred programming language to get started quickly:
JavaScript/Node.js
const ZYHAP_API_KEY = process.env.ZYHAP_API_KEY;
const WORKSPACE_ID = process.env.ZYHAP_WORKSPACE_ID;
async function createPost(content, platforms, publishDate) {
const response = await fetch('https://api.zyhap.com/api/v1/public/marketing/posts', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': ZYHAP_API_KEY,
'X-Workspace-ID': WORKSPACE_ID
},
body: JSON.stringify({
content,
platforms,
publishDate
})
});
return response.json();
}
// Usage
const result = await createPost(
{ text: "Hello World!" },
[{ platformId: "facebook", pageId: "page_123" }],
"2024-01-15T10:00:00Z"
);Python
import requests
import os
from datetime import datetime
class ZyhapAPI:
def __init__(self):
self.api_key = os.getenv('ZYHAP_API_KEY')
self.workspace_id = os.getenv('ZYHAP_WORKSPACE_ID')
self.base_url = 'https://api.zyhap.com/api/v1/public/marketing'
self.headers = {
'Content-Type': 'application/json',
'X-API-Key': self.api_key,
'X-Workspace-ID': self.workspace_id
}
def create_post(self, content, platforms, publish_date):
url = f"{self.base_url}/posts"
data = {
'content': content,
'platforms': platforms,
'publishDate': publish_date
}
response = requests.post(url, json=data, headers=self.headers)
return response.json()
# Usage
zyhap = ZyhapAPI()
result = zyhap.create_post(
{'text': 'Hello from Python!'},
[{'platformId': 'facebook', 'pageId': 'page_123'}],
'2024-01-15T10:00:00Z'
)PHP
<?php
class ZyhapAPI {
private $apiKey;
private $workspaceId;
private $baseUrl = 'https://api.zyhap.com/api/v1/public/marketing';
public function __construct() {
$this->apiKey = $_ENV['ZYHAP_API_KEY'];
$this->workspaceId = $_ENV['ZYHAP_WORKSPACE_ID'];
}
public function createPost($content, $platforms, $publishDate) {
$url = $this->baseUrl . '/posts';
$data = json_encode([
'content' => $content,
'platforms' => $platforms,
'publishDate' => $publishDate
]);
$headers = [
'Content-Type: application/json',
'X-API-Key: ' . $this->apiKey,
'X-Workspace-ID: ' . $this->workspaceId
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
return json_decode($response, true);
}
}
// Usage
$zyhap = new ZyhapAPI();
$result = $zyhap->createPost(
['text' => 'Hello from PHP!'],
[['platformId' => 'facebook', 'pageId' => 'page_123']],
'2024-01-15T10:00:00Z'
);
?>🎉 You're Ready!
Congratulations! You've successfully set up the Zyhap API. Here's what to explore next: