Stores a post for the org and answers 201 with the stored row.
Stores a post for the org and answers 201 with the stored row.
POST /v1/social/posts
| Address | https://api.hanzo.ai/v1/social/posts |
| Method | POST |
| Operation | post_social_posts |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Stores a post for the org and answers 201 with the stored row.
A post created as scheduled for a time that has already passed is published IMMEDIATELY, and the row returned carries that outcome — this is the one behaviour a reader would otherwise miss. A future-scheduled post is left for the scheduler, and a draft is left alone. Publishing never fails the creation: the post is stored either way, and a publish that could not run leaves the row for the scheduler to retry.
Request
5 fields, body application/json (required).
| Field | In | Type | Required | Description |
|---|---|---|---|---|
channel | body | string | — | Channel is the network to publish to: x, facebook, instagram, linkedin, tiktok, youtube or threads. |
content | body | string | — | Content is the post's text. Required — an empty body is a 400 — and bounded at 8192 characters, comfortably above every network's own limit. |
media | body | string[] | — | Media is the post's attached media as URLs, at most 10, each bounded at 1024 characters. |
scheduleAt | body | integer | — | ScheduleAt is when to publish, as a unix timestamp in SECONDS. 0 means unscheduled. A negative value is clamped to 0. |
status | body | string | — | Status is the post's lifecycle state: draft, scheduled, published or failed. Omitted means draft. |
Response
| Status | Body | Meaning |
|---|---|---|
201 | socialPost | created |
201 body — 11 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
accountId | body | string | — | AccountID / ExternalID / Error are server-managed publish results, set only by the publish path (never by a client update): the account a post was published… |
channel | body | string | — | Channel is the network this post targets: x, facebook, instagram, linkedin, tiktok, youtube or threads. |
content | body | string | — | Content is the post's text, bounded at 8192 characters. |
createdAt | body | integer | — | CreatedAt is when the post was created, as a unix timestamp in seconds. |
error | body | string | — | Error is why the last publish attempt failed, verbatim and bounded. |
externalId | body | string | — | ExternalID is the id the network returned for the published post, which is what reconciles this row against the post on the network. |
id | body | string | — | ID is the post's identifier, minted on create and the id every later call addresses it by. |
media | body | string[] | — | Media is the post's attached media as a list of URLs (images today; the composer's URL field now, an S3 picker later, populate it). |
scheduleAt | body | integer | — | ScheduleAt is when the post is due, as a unix timestamp in SECONDS. 0 means unscheduled. |
status | body | string | — | Status is the post's lifecycle state: draft, scheduled, published or failed. |
updatedAt | body | integer | — | UpdatedAt is when the post row last changed, as a unix timestamp in seconds. |
Failure carries the platform error shape — see Errors.
Examples
hanzo social posts createimport { Configuration, SocialApi } from 'hanzoai';
const api = new SocialApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.postSocialPosts({ channel: "<channel>", content: "<content>" });from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import SocialApi
client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = SocialApi(client).post_social_posts(channel="<channel>", content="<content>")cfg := cloud.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := cloud.NewAPIClient(cfg)
resp, _, err := client.SocialAPI.PostSocialPosts(context.Background()).Execute()
if err != nil {
return err
}use hanzo_cloud::apis::{configuration::Configuration, social_api};
let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();
let result = social_api::post_social_posts(&cfg, Default::default()).await?;import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.SocialApi;
ApiClient client = new ApiClient();
client.setRequestInterceptor(b -> b.header("Authorization", "Bearer " + System.getenv("HANZO_API_KEY")));
var result = new SocialApi(client).postSocialPosts();curl -X POST https://api.hanzo.ai/v1/social/posts \
-H "Authorization: Bearer $HANZO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"channel": "<channel>",
"content": "<content>"
}'The door reaches social through the social tool, which names its 13 operations with its own verbs — this one among them, under a name only the door declares. describe explains any of them:
curl -X POST https://api.hanzo.ai/v1/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "describe",
"arguments": {
"op": "list_social_accounts"
}
}
}'How is this guide?