Replace posts

Replaces the post's content, channel, status, scheduled time and media with what the body carries, and answers with the stored row.

PUT /v1/social/posts/{id}

Addresshttps://api.hanzo.ai/v1/social/posts/{id}
MethodPUT
Operationput_social_posts_by_id
AuthAuthorization: Bearer $HANZO_API_KEY

Replaces the post's content, channel, status, scheduled time and media with what the body carries, and answers with the stored row.

A REPLACEMENT, not a merge: an omitted field is written as its default, so omitting media clears it and omitting the status resets the post to draft. content is required on every update. Unlike create, this never triggers a publish — moving a post's scheduled time into the past here leaves it for the scheduler; publish now is its own operation.

Request

6 fields, body application/json (required).

FieldInTypeRequiredDescription
idpathstringyes
channelbodystring—Channel is the network to publish to: x, facebook, instagram, linkedin, tiktok, youtube or threads.
contentbodystring—Content is the post's text.
mediabodystring[]—Media is the post's attached media as URLs, at most 10.
scheduleAtbodyinteger (int64)—ScheduleAt is when to publish, as a unix timestamp in SECONDS.
statusbodystring—Status is the post's lifecycle state: draft, scheduled, published or failed.

Response

StatusBodyMeaning
200social.socialPostok
defaultproblem-detailsrefused

200 body — 11 fields.

FieldInTypeAlwaysDescription
accountIdbodystring—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 through, the provider's returned external post id (for reconciliation), and the last failure reason.
channelbodystring—Channel is the network this post targets: x, facebook, instagram, linkedin, tiktok, youtube or threads.
contentbodystring—Content is the post's text, bounded at 8192 characters.
createdAtbodyinteger (int64)—CreatedAt is when the post was created, as a unix timestamp in seconds.
errorbodystring—Error is why the last publish attempt failed, verbatim and bounded.
externalIdbodystring—ExternalID is the id the network returned for the published post, which is what reconciles this row against the post on the network.
idbodystring—ID is the post's identifier, minted on create and the id every later call addresses it by.
mediabodystring[]—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).
scheduleAtbodyinteger (int64)—ScheduleAt is when the post is due, as a unix timestamp in SECONDS.
statusbodystring—Status is the post's lifecycle state: draft, scheduled, published or failed.
updatedAtbodyinteger (int64)—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 set <id>
import { Configuration, SocialApi } from 'hanzoai';

const api = new SocialApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.putSocialPostsById({ id: 'id', 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).put_social_posts_by_id(id='id', channel="<channel>", content="<content>")
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.SocialAPI.PutSocialPostsById(context.Background()).Execute()
if err != nil {
	return err
}
use hanzo_client::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::put_social_posts_by_id(&cfg, Default::default()).await?;
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.SocialApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new SocialApi(client).putSocialPostsById();
curl -X PUT https://api.hanzo.ai/v1/social/posts/<id> \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "channel": "<channel>",
       "content": "<content>"
     }'

MCP reaches social through the social tool, which names its 13 operations with its own verbs — this one among them, under a name only MCP 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"
         }
       }
     }'

Social API · All Hanzo APIs · Interactive reference

Was this page useful?