Posts & Editing
Create tweets, threads, and edit published tweets
Quick Start
Post a tweet in under 60 seconds:
const { post } = await zernio.posts.createPost({
content: 'Hello from Zernio API!',
platforms: [
{ platform: 'twitter', accountId: 'YOUR_ACCOUNT_ID' }
],
publishNow: true
});
console.log('Tweet posted!', post._id);result = client.posts.create_post(
content="Hello from Zernio API!",
platforms=[
{"platform": "twitter", "accountId": "YOUR_ACCOUNT_ID"}
],
publish_now=True
)
post = result.post
print(f"Tweet posted! {post['_id']}")curl -X POST https://zernio.com/api/v1/posts \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"content": "Hello from Zernio API!",
"platforms": [
{"platform": "twitter", "accountId": "YOUR_ACCOUNT_ID"}
],
"publishNow": true
}'Content Types
Text Tweet
A simple text-only tweet. Keep it under 280 characters for free accounts.
const { post } = await zernio.posts.createPost({
content: 'Just shipped a new feature. Check it out!',
platforms: [
{ platform: 'twitter', accountId: 'YOUR_ACCOUNT_ID' }
],
publishNow: true
});
console.log('Tweet posted!', post._id);result = client.posts.create_post(
content="Just shipped a new feature. Check it out!",
platforms=[
{"platform": "twitter", "accountId": "YOUR_ACCOUNT_ID"}
],
publish_now=True
)
post = result.post
print(f"Tweet posted! {post['_id']}")curl -X POST https://zernio.com/api/v1/posts \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"content": "Just shipped a new feature. Check it out!",
"platforms": [
{"platform": "twitter", "accountId": "YOUR_ACCOUNT_ID"}
],
"publishNow": true
}'Tweet with Image
Attach up to 4 images per tweet. JPEG, PNG, WebP, and GIF formats are supported.
const { post } = await zernio.posts.createPost({
content: 'Check out this photo!',
mediaItems: [
{ type: 'image', url: 'https://cdn.example.com/photo.jpg' }
],
platforms: [
{ platform: 'twitter', accountId: 'YOUR_ACCOUNT_ID' }
],
publishNow: true
});
console.log('Tweet with image posted!', post._id);result = client.posts.create_post(
content="Check out this photo!",
media_items=[
{"type": "image", "url": "https://cdn.example.com/photo.jpg"}
],
platforms=[
{"platform": "twitter", "accountId": "YOUR_ACCOUNT_ID"}
],
publish_now=True
)
post = result.post
print(f"Tweet with image posted! {post['_id']}")curl -X POST https://zernio.com/api/v1/posts \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"content": "Check out this photo!",
"mediaItems": [
{"type": "image", "url": "https://cdn.example.com/photo.jpg"}
],
"platforms": [
{"platform": "twitter", "accountId": "YOUR_ACCOUNT_ID"}
],
"publishNow": true
}'Tweet with Video
Attach a single video per tweet. MP4 and MOV formats, up to 512 MB, max 140 seconds (standard uploads).
const { post } = await zernio.posts.createPost({
content: 'New product demo',
mediaItems: [
{ type: 'video', url: 'https://cdn.example.com/demo.mp4' }
],
platforms: [
{ platform: 'twitter', accountId: 'YOUR_ACCOUNT_ID' }
],
publishNow: true
});
console.log('Tweet with video posted!', post._id);result = client.posts.create_post(
content="New product demo",
media_items=[
{"type": "video", "url": "https://cdn.example.com/demo.mp4"}
],
platforms=[
{"platform": "twitter", "accountId": "YOUR_ACCOUNT_ID"}
],
publish_now=True
)
post = result.post
print(f"Tweet with video posted! {post['_id']}")curl -X POST https://zernio.com/api/v1/posts \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"content": "New product demo",
"mediaItems": [
{"type": "video", "url": "https://cdn.example.com/demo.mp4"}
],
"platforms": [
{"platform": "twitter", "accountId": "YOUR_ACCOUNT_ID"}
],
"publishNow": true
}'Tweet with GIF
Only 1 GIF per tweet (it consumes all 4 image slots). Max 15 MB, 1280 x 1080 px. Animated GIFs auto-play in the timeline.
const { post } = await zernio.posts.createPost({
content: 'Check out this animation!',
mediaItems: [
{ type: 'gif', url: 'https://cdn.example.com/animation.gif' }
],
platforms: [
{ platform: 'twitter', accountId: 'YOUR_ACCOUNT_ID' }
],
publishNow: true
});
console.log('Tweet with GIF posted!', post._id);result = client.posts.create_post(
content="Check out this animation!",
media_items=[
{"type": "gif", "url": "https://cdn.example.com/animation.gif"}
],
platforms=[
{"platform": "twitter", "accountId": "YOUR_ACCOUNT_ID"}
],
publish_now=True
)
post = result.post
print(f"Tweet with GIF posted! {post['_id']}")curl -X POST https://zernio.com/api/v1/posts \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"content": "Check out this animation!",
"mediaItems": [
{"type": "gif", "url": "https://cdn.example.com/animation.gif"}
],
"platforms": [
{"platform": "twitter", "accountId": "YOUR_ACCOUNT_ID"}
],
"publishNow": true
}'Thread (Multi-Tweet)
Create Twitter threads with multiple connected tweets using platformSpecificData.threadItems. Each item becomes a reply to the previous tweet and can have its own content and media.
Note: When
threadItemsis provided, the top-levelcontentfield is used only for display and search purposes, it is NOT published. You must include your first tweet asthreadItems[0].
Edit Published Tweets
Zernio supports editing published tweets via X's edit feature.
Note: Editing is currently supported for X (Twitter) only, requires an active X Premium subscription on the connected account, must be within 1 hour of the original publish time, is limited to 5 edits per tweet (enforced by X), and supports text-only edits (media changes are not supported).
curl -X POST https://zernio.com/api/v1/posts/YOUR_POST_ID/edit \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"platform": "twitter",
"content": "Updated tweet text with corrected information"
}'const result = await zernio.posts.editPost({
postId: 'YOUR_POST_ID',
platform: 'twitter',
content: 'Updated tweet text with corrected information'
});
console.log('Edited tweet:', result.id, result.url);result = client.posts.edit_post(
post_id="YOUR_POST_ID",
platform="twitter",
content="Updated tweet text with corrected information"
)
print("Edited tweet:", result["id"], result["url"])