Publishing a scheduled post (curl)
This guide walks through a complete happy-path workflow: upload media, create a scheduled post, watch it publish, and confirm the webhook.
Prerequisites
Section titled “Prerequisites”- An API key exported as
NATIVPOST_API_KEY. - A publicly reachable HTTPS endpoint that returns
200for POST requests. Use webhook.site for a quick sandbox. - At least one connected social account. This guide targets X.
1. Upload a photo
Section titled “1. Upload a photo”MEDIA_ID=$(curl -sS -X POST https://app.nativpost.com/api/v1/media_assets \ -H "Authorization: Bearer $NATIVPOST_API_KEY" \ -F "file=@./launch-banner.jpg" \ -F "tags=launch" \ | jq -r ".id")
echo "Uploaded $MEDIA_ID"2. Register a webhook
Section titled “2. Register a webhook”curl -X POST https://app.nativpost.com/api/v1/webhooks \ -H "Authorization: Bearer $NATIVPOST_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "url": "https://webhook.site/your-uuid-here", "events": ["content.published", "content.publish_failed"] }'Copy the returned signing_secret into your endpoint’s environment.
3. Create the post scheduled for one hour from now
Section titled “3. Create the post scheduled for one hour from now”SCHEDULED_AT=$(date -u -d "+1 hour" +"%Y-%m-%dT%H:%M:%SZ")
CONTENT_ID=$(curl -sS -X POST https://app.nativpost.com/api/v1/content \ -H "Authorization: Bearer $NATIVPOST_API_KEY" \ -H "Content-Type: application/json" \ -d "$(jq -n \ --arg m "$MEDIA_ID" \ --arg s "$SCHEDULED_AT" \ '{ content_type: "photo", platforms: ["x"], body_text: "Launch day.", media_asset_ids: [$m], status: "scheduled", scheduled_at: $s }')" \ | jq -r ".id")
echo "Created $CONTENT_ID at $SCHEDULED_AT"4. Confirm the state
Section titled “4. Confirm the state”curl -sS https://app.nativpost.com/api/v1/content/$CONTENT_ID \ -H "Authorization: Bearer $NATIVPOST_API_KEY" | jq ".status, .scheduled_at"Expect "scheduled" and the timestamp from step 3.
5. Publish immediately (optional)
Section titled “5. Publish immediately (optional)”If you would rather not wait an hour, call publish:
curl -X POST https://app.nativpost.com/api/v1/content/$CONTENT_ID/publish \ -H "Authorization: Bearer $NATIVPOST_API_KEY" | jqThe response includes per-platform results. Your webhook endpoint receives a content.published event within a second or two.
6. Verify the webhook
Section titled “6. Verify the webhook”Inspect the delivery log to confirm the endpoint returned 2xx:
curl -sS https://app.nativpost.com/api/v1/webhooks/$WEBHOOK_ID/deliveries?limit=5 \ -H "Authorization: Bearer $NATIVPOST_API_KEY" | jqThat is the entire flow. From here, wrap steps 1-3 in your own scripts or move to the Zapier / n8n guides.