API and webhooks
Two ways to connect your own systems: call the REST API to publish posts, read tickets and contacts or send messages, and register webhooks to be told when something happens. Both are managed under Settings by admins, supervisors and developers.
API keys
Section titled “API keys”Open Settings → API keys and press New API key. Give it a label so you remember what uses it. The key is shown once; copy it then. Only a hash is stored, so it can’t be shown again. Revoke a key at any time; it stops working immediately.

What each numbered element does (4)
- link All settings
- button New API key
- button Delete API key
- link AI assistants

What each numbered element does (4)
- button Close
- field Zapier integration
- button Cancel
- button Create key
Calling the API
Section titled “Calling the API”Every request goes to https://app.ghamalim.net/api/v1/… with the key as a bearer token:
curl https://app.ghamalim.net/api/v1/tickets \ -H "Authorization: Bearer sk_live_…"The API covers publishing social posts, tickets (filters, status, assignment, tags, notes, forms) and their messages with attachments, contacts (create, update, search, custom fields) and their channel identities, channels (with what each can send), WhatsApp templates, labels, teams, saved replies, forms and their answers, satisfaction ratings, an inbox report, message moderation and webhook management. No code? See n8n. The complete, current reference, with every field, is the OpenAPI document at /api/v1/openapi.json; import it into Postman or any API client.
Things worth knowing:
- Everything is scoped to your organization. A key can never see another workspace’s data.
- Rate limits: 120 requests per minute per key and 300 per minute per organization. Responses carry
RateLimit-Limit,RateLimit-RemainingandRateLimit-Resetheaders, and429when you go over. Repeated wrong keys from one address are blocked for a while. - Idempotent sends. When you send a message through the API, add an
Idempotency-Keyheader. Retrying with the same key never sends the message twice. - Errors are JSON and every response carries an
X-Request-Id; quote it when you contact support. 402 subscription_inactivemeans the workspace’s trial ended or its subscription was canceled. The API works again as soon as billing is active.
Publish a post
Section titled “Publish a post”The most common first use: your website publishes something (a new property listing, an event, a blog post) and it should appear on your social pages by itself.
1. Find your channels. GET /api/v1/channels lists everything connected. The ones you can publish to have capabilities.api.publish_posts set to true (Facebook Page, Instagram, TikTok, LinkedIn, X). Copy their ids once and keep them in your configuration.
curl https://app.ghamalim.net/api/v1/channels \ -H "Authorization: Bearer sk_live_…"2. Send the post. One request can go to several channels at once.
curl -X POST https://app.ghamalim.net/api/v1/posts \ -H "Authorization: Bearer sk_live_…" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: listing-4821-v1" \ -d '{ "caption": "New listing: 2-bedroom condo near BTS Ekkamai. Viewing this weekend!", "media": ["https://yoursite.com/uploads/4821/living-room.jpg"], "channel_ids": ["<facebook-channel-id>", "<instagram-channel-id>"], "external_id": "listing-4821" }'The answer is 202 Accepted: the post is queued and publishes in the background (Instagram and TikTok take a while), so the response is the post with "status": "scheduled" and a Location header pointing at it.
3. Check the result, or let a webhook tell you. GET /api/v1/posts/<id> returns the status and one entry per channel with its own state, the live url once published, and the platform’s error if it failed:
{ "data": { "id": "0c1f…", "status": "published", "external_id": "listing-4821", "targets": [ { "channel_type": "facebook_feed", "state": "published", "url": "https://www.facebook.com/…", "error": null }, { "channel_type": "instagram_feed", "state": "published", "url": "https://www.instagram.com/p/…", "error": null } ] }}Fields
Section titled “Fields”| Field | |
|---|---|
caption |
The text. Optional if you send media. Limits: X 280, Instagram and TikTok 2,200, LinkedIn 3,000, Facebook 63,206. The strictest channel you pick decides. |
media |
Up to 10 image URLs, or one video URL. Public https:// addresses only. The type comes from the extension (.jpg .png .webp .gif, .mp4 .mov); for a URL without one, send { "url": "…", "type": "image" }. |
channel_ids |
Required. 1 to 10 channel ids. |
scheduled_at |
Optional. ISO 8601 with a time zone, e.g. 2026-11-01T09:00:00+07:00. Leave it out to publish now. Must be in the future, at most 365 days ahead. |
tiktok |
Required when a TikTok channel is selected. TikTok asks the person posting to choose visibility for every post, so there is no default: { "privacy_level": "SELF_ONLY" } (or PUBLIC_TO_EVERYONE, MUTUAL_FOLLOW_FRIENDS, FOLLOWER_OF_CREATOR), plus optional allow_comment, allow_duet, allow_stitch (default true), commercial_content, your_brand, branded_content (default false). Sending it means you have the poster’s consent TikTok requires. |
external_id |
Optional. Your own reference (a listing id, an article id), up to 128 characters. Returned on the post, and GET /api/v1/posts?external_id=listing-4821 finds it again. |
Platform rules are checked before the post is accepted, so a 202 means it will be attempted. Instagram and TikTok posts need an image or video; X takes text only; TikTok posts from an app that hasn’t passed TikTok’s audit are private on TikTok’s side.
Status values
Section titled “Status values”scheduled (waiting for its time, also the first moments after “publish now”) → publishing → published, partially_published (some channels worked, some didn’t) or failed. Posts created in the app can also be draft, pending_approval or rejected. A channel’s state is pending, publishing, published, failed or removed.
Get told instead of polling
Section titled “Get told instead of polling”Add a webhook for post.published and post.failed (Settings → Webhooks, or the webhooks API). They fire once, when the post reaches its final status, with the same body as GET /api/v1/posts/<id>. post.failed also covers partially_published: read data.status and each target’s state and error.
Drafts, approval and labels
Section titled “Drafts, approval and labels”POST /api/v1/posts also takes "draft": true (saved without a time, nothing goes out), "require_approval": true (waits in Posts → Pending approval for an admin or supervisor) and "label_ids": [...] (from GET /api/v1/labels; the same tags used on tickets). Drafts are published with POST /api/v1/posts/<id>/publish, which takes an optional scheduled_at.
Edit, reschedule, cancel, list, retry
Section titled “Edit, reschedule, cancel, list, retry”PATCH /api/v1/posts/<id>changes a post that hasn’t gone out (draft, scheduled or waiting for approval): any ofcaption,media,channel_ids,scheduled_at,label_ids,tiktok. The same rules as creating one are applied to the result. Editing never publishes. A post that is publishing or published answers409.DELETE /api/v1/posts/<id>removes a post in any state and answers200with{ "deleted": true, "warnings": [] }. A live Facebook or Instagram post is also deleted on the platform; if the platform refuses, the call still succeeds andwarningssays what is still live. TikTok, LinkedIn and X offer no delete we can call, so only our record goes. A post being published right now answers409.POST /api/v1/posts/<id>/approveand/reject(the key’s creator must be an admin or supervisor; reject takes an optionalreason).POST /api/v1/posts/<id>/retryretries the channels that failed;POST /api/v1/posts/<id>/refresh-insightsfetches reach and engagement for a published post (they appear asinsightson each target).GET /api/v1/postslists posts newest first (status,external_id,limit,offset), including posts created in the app.POST /api/v1/posts/bulkqueues many posts at once:{ "channel_ids": [...], "posts": [{ "caption": "…", "scheduled_at": "…" }, …] }. Every row needs its own time; rows fail individually and the answer lists which.- A failed post is not retried automatically (the one exception: when Meta is rate limiting an account, the post pauses and retries itself). Fix the cause (usually an expired connection: reconnect the channel in the app) and call
retry.
Media must be a public https:// URL. If your file isn’t on one, POST /api/v1/media (multipart, field file; images up to 20 MB, videos up to 200 MB) stores it and returns a URL to use in media. GET /api/v1/media lists media recently used in posts. In the app’s own composer the limit per upload is 30 MB.
Helpers
Section titled “Helpers”POST /api/v1/posts/ai/captionswith{ "brief": "…", "platforms": ["instagram"] }returns AI-written caption variants. Nothing is posted. It uses one AI session of your plan’s allowance, and the brief is sent to our AI provider.GET /api/v1/posts/best-times?timezone=Asia/Bangkoksuggests posting times from your own history.GET /api/v1/channels/<id>/tiktok-optionsreturns the privacy levels and limits TikTok allows for that account.
Automation: RSS feeds and watermarks
Section titled “Automation: RSS feeds and watermarks”POST /api/v1/rss-scheduleswith{ "name": "Blog", "feed_url": "https://…/feed", "channel_ids": [...], "caption_template": "{title}\n\n{link}" }turns every new feed item into a post. The first check only records what the feed already holds; at most 5 new items are posted per check.PATCHchanges name, channels, template or pauses withis_active;DELETEstops it (posts already made are kept). Feed items carry no image, so use Facebook or LinkedIn-style link posts rather than Instagram or TikTok.POST /api/v1/watermarksstamps a logo or text on images at publish time (originals are never changed). Upload a logo withPOST /api/v1/watermarks/logo, then create{ "name": "Logo", "type": "image", "logo_url": "…", "position": "bottom-right" }; with nochannel_idsit applies everywhere.PATCHwith{ "status": "inactive" }turns it off.
Example: publish a listing from PHP or WordPress
Section titled “Example: publish a listing from PHP or WordPress”function publish_listing( $listing ) { $response = wp_remote_post( 'https://app.ghamalim.net/api/v1/posts', array( 'headers' => array( 'Authorization' => 'Bearer ' . SOCIAL_API_KEY, 'Content-Type' => 'application/json', 'Idempotency-Key' => 'listing-' . $listing->id . '-v' . $listing->version, ), 'body' => wp_json_encode( array( 'caption' => $listing->title . ' — ' . $listing->url, 'media' => array( $listing->cover_image_url ), 'channel_ids' => SOCIAL_CHANNEL_IDS, 'external_id' => 'listing-' . $listing->id, ) ), 'timeout' => 15, ) ); return 202 === wp_remote_retrieve_response_code( $response );}Outside WordPress use curl_init or Guzzle the same way. In JavaScript (Node 18+):
const res = await fetch('https://app.ghamalim.net/api/v1/posts', { method: 'POST', headers: { Authorization: `Bearer ${process.env.SOCIAL_API_KEY}`, 'Content-Type': 'application/json', 'Idempotency-Key': `listing-${listing.id}-v${listing.version}`, }, body: JSON.stringify({ caption: `${listing.title} ${listing.url}`, media: [listing.coverImageUrl], channel_ids: process.env.SOCIAL_CHANNEL_IDS.split(','), external_id: `listing-${listing.id}`, }),});if (res.status !== 202) throw new Error(await res.text());const { data } = await res.json();Use one Idempotency-Key per thing you publish (the listing id and version works well): if your code retries after a timeout, the post is still created only once. Posting is limited to 30 posts per minute per API key.
Webhooks
Section titled “Webhooks”Open Settings → Webhooks, press New webhook, enter the HTTPS address of your endpoint, tick the events you want and press Add webhook. The secret used to sign deliveries is shown once, right after you add it. Each saved webhook lists the events it sends; Edit events changes them.

What each numbered element does (8)
- link All settings
- button New webhook
- switch Webhook https://example.com/hooks/helpdesk active
- button Test
- button Delete webhook
- button Edit events
- button Recent deliveries (0)
- link AI assistants
Payload reference expands an example body for every event (ticket.created, ticket.resolved, ticket.assigned, message.received, message.sent, message.failed, contact.created, csat.submitted, form.submitted, note.created, tag.removed, ticket.priority_changed, sla.breached, call events and more):

What each numbered element does (27)
- button Close
- field Endpoint address
- checkbox (icon button, no label)
- checkbox (icon button, no label)
- checkbox (icon button, no label)
- checkbox (icon button, no label)
- checkbox (icon button, no label)
- checkbox (icon button, no label)
- checkbox (icon button, no label)
- checkbox (icon button, no label)
- checkbox (icon button, no label)
- checkbox (icon button, no label)
- checkbox (icon button, no label)
- checkbox (icon button, no label)
- checkbox (icon button, no label)
- checkbox (icon button, no label)
- checkbox (icon button, no label)
- checkbox (icon button, no label)
- checkbox (icon button, no label)
- checkbox (icon button, no label)
- checkbox (icon button, no label)
- checkbox (icon button, no label)
- checkbox (icon button, no label)
- checkbox (icon button, no label)
- button Payload reference
- button Cancel
- button Add webhook
Verifying a delivery
Section titled “Verifying a delivery”Every delivery is an HTTPS POST with a JSON body and these headers:
| Header | Meaning |
|---|---|
webhook-id |
Stable across retries of the same event; use it to ignore duplicates. |
webhook-timestamp |
Unix seconds of this attempt; reject anything too old to stop replays. |
webhook-signature |
v1, + base64 HMAC-SHA256 of "<webhook-id>.<webhook-timestamp>.<body>" with your secret (the Standard Webhooks scheme). |
X-Webhook-Signature |
Older style: hex HMAC-SHA256 of the raw body. Kept for existing integrations. |
X-Webhook-Event |
The event name. |
Answer with any 2xx within a few seconds. Anything else is retried automatically after 1, 5, 30, 120 and 360 minutes (six attempts in total). The Recent deliveries list under each webhook shows every attempt with its response, and a failed one can be re-sent by hand. A webhook that keeps failing for 5 days is switched off and you’re emailed.
Webhook addresses must be public: private and internal addresses are refused when you add them and again on every send.