xAIcreator

API

Complete API v1 documentation for authentication, publishing, scheduling, accounts, templates, and CLI

Overview

The xAIcreator API v1 provides a RESTful interface for multi-platform authentication, content publishing, scheduling, and account management. All endpoints use API Key authentication for secure access.

Base URL: https://xaicreator.com/api/v1

Authentication

All API requests require an API Key passed via the xai-key header:

curl "https://xaicreator.com/api/v1/twitter/drafts" \
  -H "xai-key: your_api_key_here"

Getting Your API Key

1. Email Login

POST /api/v1/auth/login

Email login for existing users only. Does not support new user registration.

curl -X POST "https://xaicreator.com/api/v1/auth/login" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]",
    "password": "yourpassword"
  }'

Response (Success):

{
  "success": true,
  "user": {
    "uuid": "user-uuid",
    "email": "[email protected]"
  },
  "apiKey": {
    "key": "sk-xxxxx...",
    "name": "Default API Key",
    "createdAt": "2026-01-15T10:00:00Z",
    "lastUsed": null
  },
  "warning": "Please save your API key securely. This is the only time the full key will be displayed."
}

2. Google OAuth

Step 1: Get OAuth URL

POST /api/v1/auth/oauth/google/url

curl -X POST "https://xaicreator.com/api/v1/auth/oauth/google/url" \
  -H "Content-Type: application/json" \
  -d '{"redirectUri": "http://localhost:3000/oauth-callback"}'

Response:

{
  "success": true,
  "authUrl": "https://accounts.google.com/o/oauth2/v2/auth?client_id=...",
  "state": "server-generated-state"
}

Step 2: OAuth Callback

POST /api/v1/auth/oauth/google/callback

curl -X POST "https://xaicreator.com/api/v1/auth/oauth/google/callback" \
  -H "Content-Type: application/json" \
  -d '{
    "code": "authorization-code-from-google",
    "state": "state-from-step-1"
  }'

Response (New User):

{
  "success": true,
  "user": {
    "uuid": "new-user-uuid",
    "email": "[email protected]",
    "provider": "google",
    "isNewUser": true
  },
  "apiKey": {
    "key": "sk-new-user-key...",
    "name": "Default API Key",
    "createdAt": "2026-01-15T10:00:00Z",
    "lastUsed": null
  }
}

3. Twitter OAuth

Step 1: Get OAuth URL

POST /api/v1/auth/oauth/twitter/url

curl -X POST "https://xaicreator.com/api/v1/auth/oauth/twitter/url" \
  -H "Content-Type: application/json" \
  -d '{"redirectUri": "http://localhost:3000/oauth-callback?provider=twitter"}'

Response:

{
  "success": true,
  "authUrl": "https://x.com/i/oauth2/authorize?client_id=...",
  "state": "base64url-encoded-state"
}

Step 2: OAuth Callback

POST /api/v1/auth/oauth/twitter/callback

curl -X POST "https://xaicreator.com/api/v1/auth/oauth/twitter/callback" \
  -H "Content-Type: application/json" \
  -d '{
    "code": "authorization-code-from-twitter",
    "state": "state-from-step-1"
  }'

Important: The complete API Key is only displayed once during registration/login. Save it immediately.

API Key Management

Get API Keys

GET /api/v1/auth/api-keys

curl "https://xaicreator.com/api/v1/auth/api-keys" \
  -H "xai-key: sk-your-api-key"

Response:

{
  "success": true,
  "apiKeys": [
    {
      "id": "key-uuid-1",
      "key": "sk-xxxx...abcd",
      "name": "Default API Key",
      "status": "created",
      "lastUsed": "2026-01-15T10:00:00Z",
      "createdAt": "2026-01-14T08:00:00Z"
    }
  ]
}

Create API Key

POST /api/v1/auth/api-keys

curl -X POST "https://xaicreator.com/api/v1/auth/api-keys" \
  -H "Content-Type: application/json" \
  -H "xai-key: sk-your-api-key" \
  -d '{"name": "New API Key"}'

Delete API Key

DELETE /api/v1/auth/api-keys/:keyId

curl -X DELETE "https://xaicreator.com/api/v1/auth/api-keys/key-uuid-3" \
  -H "xai-key: sk-your-api-key"

Twitter OAuth 2.0

Initiate Twitter OAuth

POST /api/v1/twitter/auth

curl -X POST "https://xaicreator.com/api/v1/twitter/auth" \
  -H "Content-Type: application/json" \
  -H "xai-key: your_api_key" \
  -d '{
    "socialSetId": "your-social-set-id",
    "mode": "add_to_existing"
  }'

Parameters

ParameterTypeRequiredDescription
socialSetIdstringNoSocial Set ID to bind the account
modestringNo"create_new" or "add_to_existing" (default)
followOnXbooleanNoWhether to follow on X after authorization

Response:

{
  "authUrl": "https://x.com/i/oauth2/authorize?...",
  "sessionId": "session_uuid_here"
}

Twitter OAuth Callback

GET /api/v1/twitter/callback

After user authorization, Twitter redirects to your callback URL with code and state parameters.

curl "https://xaicreator.com/api/v1/twitter/callback?code=xxx&state=xxx"

Response:

{
  "success": true,
  "accountUuid": "account_uuid",
  "socialSetId": "social_set_id"
}

Drafts Management

List Drafts

GET /api/v1/twitter/drafts

curl "https://xaicreator.com/api/v1/twitter/drafts?socialSetId=xxx" \
  -H "xai-key: your_api_key"

Response:

{
  "drafts": [
    {
      "id": "draft_uuid",
      "title": "My Draft",
      "status": "draft",
      "tweets": [...],
      "createdAt": "2026-01-14T07:21:26.000Z"
    }
  ]
}

Create Draft

POST /api/v1/twitter/drafts

curl -X POST "https://xaicreator.com/api/v1/twitter/drafts" \
  -H "Content-Type: application/json" \
  -H "xai-key: your_api_key" \
  -d '{
    "title": "My Draft",
    "tweets": [{"content": "<p>Hello from API!</p>"}],
    "socialSetId": "social-set-id",
    "scheduledFor": "2026-01-15T10:00:00Z"
  }'

Parameters

ParameterTypeRequiredDescription
titlestringYesDraft title
tweetsarrayYesArray of tweet objects with content field (HTML supported)
socialSetIdstringNoAssociated Social Set ID. If omitted, uses the user's default Social Set. Returns NO_SOCIAL_SET error if the user has no Social Set.
statusstringNoDraft status (default: "draft")
scheduledForstringNoISO 8601 datetime for scheduled publishing
selectedAccountIdsarrayNoAccount IDs to publish to
templateIdstringNoTemplate ID if created from template

Note: A Social Set is required to create drafts. If the user has not connected any social accounts, the API will return a 400 error with NO_SOCIAL_SET code. Please connect a social account via the web dashboard first.

Response:

{
  "draft": {
    "id": "draft_uuid",
    "title": "My Draft",
    "status": "draft",
    "scheduledFor": null,
    "socialSetId": "social-set-id",
    "selectedAccountIds": [],
    "tweets": [
      {
        "id": "tweet_uuid",
        "content": "<p>Hello from API!</p>",
        "plainText": "Hello from API!",
        "media": [],
        "characterCount": 16,
        "isValid": true,
        "position": 0
      }
    ],
    "createdAt": "2026-01-14T07:21:26.000Z",
    "updatedAt": "2026-01-14T07:21:26.000Z"
  }
}

Draft Batch Creation

Batch Create Drafts

POST /api/v1/twitter/drafts/batch

Create multiple drafts in a single request.

curl -X POST "https://xaicreator.com/api/v1/twitter/drafts/batch" \
  -H "Content-Type: application/json" \
  -H "xai-key: your_api_key" \
  -d '{
    "drafts": [
      {
        "title": "Draft 1",
        "tweets": [{"content": "<p>First draft</p>"}]
      },
      {
        "title": "Draft 2",
        "tweets": [{"content": "<p>Second draft</p>"}]
      }
    ],
    "socialSetId": "social-set-id"
  }'

Draft Platform Content

Get Platform Content

GET /api/v1/twitter/drafts/:id/platforms

Get platform-specific content for a draft. When publishing to multiple platforms, each platform can have customized content.

curl "https://xaicreator.com/api/v1/twitter/drafts/draft-uuid/platforms" \
  -H "xai-key: your_api_key"

Response:

{
  "platforms": [
    {
      "id": 1,
      "draft_uuid": "draft-uuid",
      "platform": "bluesky",
      "content": "Custom Bluesky content",
      "created_at": "2026-01-15T10:00:00.000Z",
      "updated_at": "2026-01-15T10:00:00.000Z"
    }
  ]
}

Update Platform Content

PUT /api/v1/twitter/drafts/:id/platforms

Set platform-specific content for a draft. Uses upsert logic (creates or updates).

curl -X PUT "https://xaicreator.com/api/v1/twitter/drafts/draft-uuid/platforms" \
  -H "Content-Type: application/json" \
  -H "xai-key: your_api_key" \
  -d '{
    "platforms": [
      {
        "platform": "bluesky",
        "content": "Custom Bluesky content"
      },
      {
        "platform": "linkedin",
        "content": "Custom LinkedIn content"
      }
    ]
  }'

Publishing

Publish to Twitter

POST /api/v1/twitter/publish

curl -X POST "https://xaicreator.com/api/v1/twitter/publish" \
  -H "Content-Type: application/json" \
  -H "xai-key: your_api_key" \
  -d '{
    "draftId": "draft_uuid",
    "accountIds": ["account_id"]
  }'

Parameters

ParameterTypeRequiredDescription
draftIdstringYesDraft ID to publish
accountIdsarrayNoSpecific account IDs
jobIdstringNoCustom job ID for tracking
communityobjectNoCommunity metadata ({id, name, description})

Quote Tweet

POST /api/v1/twitter/quote

curl -X POST "https://xaicreator.com/api/v1/twitter/quote" \
  -H "Content-Type: application/json" \
  -H "xai-key: your_api_key" \
  -d '{
    "content": "Great insight!",
    "quoteTweetId": "quoted_tweet_id",
    "accountId": "your_account_id"
  }'

Response:

{
  "success": true,
  "message": "Quote posted successfully",
  "tweetId": "new_tweet_id",
  "url": "https://x.com/user/status/new_tweet_id"
}

Publish Progress

GET /api/v1/twitter/publish/progress

Check the publishing progress for a draft.

curl "https://xaicreator.com/api/v1/twitter/publish/progress?draftId=draft-uuid" \
  -H "xai-key: your_api_key"

Response:

{
  "entries": [
    {
      "id": "queue-uuid",
      "draftId": "draft-uuid",
      "status": "published",
      "platform": "twitter",
      "accountUuid": "account-uuid",
      "scheduledFor": "2026-01-15T10:00:00.000Z",
      "publishedAt": "2026-01-15T10:00:05.000Z"
    }
  ],
  "summary": {
    "total": 2,
    "completed": 2,
    "failed": 0,
    "pending": 0
  }
}

Multi-Platform Publishing

POST /api/v1/publish/multi-platform

Publish to multiple platforms (Twitter, Bluesky, Mastodon, Threads, LinkedIn) simultaneously.

curl -X POST "https://xaicreator.com/api/v1/publish/multi-platform" \
  -H "Content-Type: application/json" \
  -H "xai-key: your_api_key" \
  -d '{
    "draftId": "draft_uuid",
    "targetAccounts": [
      {
        "accountId": "twitter_account_id",
        "platform": "twitter",
        "communityId": "community_id"
      },
      {
        "accountId": "bluesky_account_id",
        "platform": "bluesky"
      },
      {
        "accountId": "mastodon_account_id",
        "platform": "mastodon"
      },
      {
        "accountId": "threads_account_id",
        "platform": "threads"
      },
      {
        "accountId": "linkedin_account_id",
        "platform": "linkedin"
      }
    ]
  }'

Parameters

ParameterTypeRequiredDescription
draftIdstringYesDraft UUID
targetAccountsarrayYesTarget account list
targetAccounts[].accountIdstringYesAccount UUID
targetAccounts[].platformstringYesPlatform: twitter, bluesky, mastodon, threads, linkedin
targetAccounts[].communityIdstringNoCommunity ID (Twitter only)

Response:

{
  "success": true,
  "results": [
    {
      "accountId": "account_uuid",
      "platform": "twitter",
      "success": true,
      "data": { "tweetId": "...", "url": "..." }
    },
    {
      "accountId": "account_uuid",
      "platform": "bluesky",
      "success": true,
      "data": { "uri": "at://...", "cid": "..." }
    }
  ],
  "summary": {
    "total": 2,
    "succeeded": 2,
    "failed": 0
  }
}

Cost: 10 credits per platform

Platform-Specific Publishing

Bluesky

POST /api/v1/bluesky/publish

curl -X POST "https://xaicreator.com/api/v1/bluesky/publish" \
  -H "Content-Type: application/json" \
  -H "xai-key: your_api_key" \
  -d '{
    "accountUuid": "account_uuid",
    "type": "single",
    "text": "Hello Bluesky!",
    "langs": ["en"]
  }'

Parameters

ParameterTypeRequiredDescription
accountUuidstringYesAccount UUID
typestringYessingle or thread
textstringNo*Post content (required for single)
textsarrayNo*Thread posts (required for thread)
imageUrlsarrayNoImage URLs
langsarrayNoLanguage tags (default: ["en"])

Cost: 10 credits

Mastodon

POST /api/v1/mastodon/publish

curl -X POST "https://xaicreator.com/api/v1/mastodon/publish" \
  -H "Content-Type: application/json" \
  -H "xai-key: your_api_key" \
  -d '{
    "accountUuid": "account_uuid",
    "type": "single",
    "text": "Hello Mastodon!"
  }'

Parameters: Same as Bluesky

Cost: 10 credits

Threads

POST /api/v1/threads/publish

curl -X POST "https://xaicreator.com/api/v1/threads/publish" \
  -H "Content-Type: application/json" \
  -H "xai-key: your_api_key" \
  -d '{
    "accountId": "account_uuid",
    "text": "Hello Threads!",
    "mediaUrls": ["https://example.com/image.jpg"]
  }'

Parameters

ParameterTypeRequiredDescription
accountIdstringYesAccount UUID
draftIdstringNo*Draft UUID (use draft or text/mediaUrls)
textstringNo*Post text (max 500 characters)
mediaUrlsarrayNoMedia URL array
replyControlstringNoeveryone, accounts_you_follow, mentioned_only

Cost: 10 credits

LinkedIn

POST /api/v1/linkedin/publish

curl -X POST "https://xaicreator.com/api/v1/linkedin/publish" \
  -H "Content-Type: application/json" \
  -H "xai-key: your_api_key" \
  -d '{
    "accountId": "account_uuid",
    "text": "Hello LinkedIn!",
    "mediaUrls": ["https://example.com/image.jpg"],
    "visibility": "PUBLIC"
  }'

Parameters

ParameterTypeRequiredDescription
accountIdstringYesAccount UUID
draftIdstringNo*Draft UUID (use draft or text)
textstringNo*Post text (max 3000 characters)
mediaUrlsarrayNoMedia URL array
visibilitystringNoPUBLIC, CONNECTIONS, LOGGED_IN (default: PUBLIC)

Cost: 10 credits

Scheduled Publishing

Schedule Draft

POST /api/v1/twitter/schedule

curl -X POST "https://xaicreator.com/api/v1/twitter/schedule" \
  -H "Content-Type: application/json" \
  -H "xai-key: your_api_key" \
  -d '{
    "draftId": "draft_uuid",
    "scheduledFor": "2026-01-15T10:00:00Z",
    "targetAccounts": [
      {
        "accountId": "account_id",
        "platform": "twitter"
      }
    ],
    "priority": 0,
    "applyJitter": true
  }'

Parameters

ParameterTypeRequiredDescription
draftIdstringYesDraft UUID
scheduledForstringYesISO 8601 datetime (UTC)
targetAccountsarrayNoTarget accounts (multi-platform)
accountUuidstringNoSingle account (legacy)
platformstringNoPlatform type (default: twitter)
prioritynumberNoPriority (default: 0)
applyJitterbooleanNoAdd random jitter ±3min (default: true)

Response:

{
  "message": "Draft scheduled successfully",
  "queueIds": ["uuid1", "uuid2"],
  "scheduledFor": "2026-01-15T10:00:00.000Z",
  "accountCount": 2
}

Cancel Schedule

DELETE /api/v1/twitter/schedule

curl -X DELETE "https://xaicreator.com/api/v1/twitter/schedule?draftId=draft_uuid" \
  -H "xai-key: your_api_key"

List Schedules

GET /api/v1/twitter/schedule

curl "https://xaicreator.com/api/v1/twitter/schedule" \
  -H "xai-key: your_api_key"

Response:

{
  "schedules": [
    {
      "id": "queue_uuid",
      "draftId": "draft_uuid",
      "draftTitle": "My Draft",
      "scheduledFor": "2026-01-15T10:00:00.000Z",
      "priority": 0,
      "attempts": 0,
      "createdAt": "2026-01-14T08:00:00.000Z",
      "platform": "twitter",
      "accountUuid": "account_uuid"
    }
  ]
}

Media Upload

Upload Media

POST /api/v1/twitter/media/upload

curl -X POST "https://xaicreator.com/api/v1/twitter/media/upload" \
  -H "xai-key: your_api_key" \
  -F "files=@/path/to/image.jpg"

Limits:

  • Maximum 4 files per request
  • Images: 5MB per file
  • GIFs: 15MB per file
  • Videos: 512MB per file

Response:

{
  "code": 0,
  "data": {
    "uploads": [
      {
        "mediaId": "media_id_string",
        "url": "https://pbs.twimg.com/...",
        "type": "image"
      }
    ]
  }
}

Social Sets

List Social Sets

GET /api/v1/social-sets

curl "https://xaicreator.com/api/v1/social-sets" \
  -H "xai-key: your_api_key"

Response:

{
  "socialSets": [
    {
      "id": "social-set-id",
      "name": "My Social Set",
      "accounts": [
        {
          "accountId": "account_id",
          "platform": "twitter",
          "username": "username"
        }
      ]
    }
  ]
}

Create Social Set

POST /api/v1/social-sets

curl -X POST "https://xaicreator.com/api/v1/social-sets" \
  -H "Content-Type: application/json" \
  -H "xai-key: your_api_key" \
  -d '{"name": "New Social Set"}'

Update Social Set

PUT /api/v1/social-sets

curl -X PUT "https://xaicreator.com/api/v1/social-sets" \
  -H "Content-Type: application/json" \
  -H "xai-key: your_api_key" \
  -d '{"id": "social-set-id", "name": "Updated Name"}'

Delete Social Set

DELETE /api/v1/social-sets

curl -X DELETE "https://xaicreator.com/api/v1/social-sets" \
  -H "Content-Type: application/json" \
  -H "xai-key: your_api_key" \
  -d '{"id": "social-set-id"}'

User Info

Get Current User

GET /api/v1/me

curl "https://xaicreator.com/api/v1/me" \
  -H "xai-key: your_api_key"

Response:

{
  "uuid": "user-uuid",
  "email": "[email protected]",
  "nickname": "John",
  "avatar_url": "https://...",
  "timezone": "Asia/Shanghai",
  "credits_balance": 150,
  "locale": "en",
  "created_at": "2026-01-01T00:00:00.000Z"
}

Accounts Management

List Connected Accounts

GET /api/v1/accounts

List all social accounts bound to the authenticated user across all platforms.

curl "https://xaicreator.com/api/v1/accounts" \
  -H "xai-key: your_api_key"

Response:

{
  "accounts": [
    {
      "uuid": "account-uuid",
      "platform": "twitter",
      "platform_user_id": "123456",
      "username": "johndoe",
      "display_name": "John Doe",
      "avatar": "https://...",
      "status": "active",
      "followers_count": 1500,
      "following_count": 300,
      "created_at": "2026-01-01T00:00:00.000Z"
    }
  ]
}

Get Account Details

GET /api/v1/accounts/:id

curl "https://xaicreator.com/api/v1/accounts/account-uuid" \
  -H "xai-key: your_api_key"

Remove Account

DELETE /api/v1/accounts/:id

Unbind a social account from the user. This removes the account from all Social Sets.

curl -X DELETE "https://xaicreator.com/api/v1/accounts/account-uuid" \
  -H "xai-key: your_api_key"

Response:

{
  "success": true,
  "message": "Account deleted successfully"
}

Templates

List Templates

GET /api/v1/templates

curl "https://xaicreator.com/api/v1/templates" \
  -H "xai-key: your_api_key"

Response:

{
  "templates": [
    {
      "uuid": "template-uuid",
      "name": "My Template",
      "description": "A reusable template",
      "head_content_plain": "Header text",
      "tail_content_plain": "Footer text",
      "created_at": "2026-01-01T00:00:00.000Z",
      "updated_at": "2026-01-01T00:00:00.000Z"
    }
  ]
}

Get Template

GET /api/v1/templates/:id

curl "https://xaicreator.com/api/v1/templates/template-uuid" \
  -H "xai-key: your_api_key"

Create Template

POST /api/v1/templates

curl -X POST "https://xaicreator.com/api/v1/templates" \
  -H "Content-Type: application/json" \
  -H "xai-key: your_api_key" \
  -d '{
    "name": "My Template",
    "description": "A reusable template",
    "headContentPlain": "Header text",
    "tailContentPlain": "Footer text"
  }'

Parameters

ParameterTypeRequiredDescription
namestringYesTemplate name
descriptionstringNoTemplate description
headContentPlainstringNoHeader content (plain text)
tailContentPlainstringNoFooter content (plain text)
headContentHtmlstringNoHeader content (HTML)
tailContentHtmlstringNoFooter content (HTML)

Update Template

PUT /api/v1/templates/:id

curl -X PUT "https://xaicreator.com/api/v1/templates/template-uuid" \
  -H "Content-Type: application/json" \
  -H "xai-key: your_api_key" \
  -d '{"name": "Updated Template"}'

Delete Template

DELETE /api/v1/templates/:id

curl -X DELETE "https://xaicreator.com/api/v1/templates/template-uuid" \
  -H "xai-key: your_api_key"

Credits

Check Credits Balance

POST /api/v1/credits

curl -X POST "https://xaicreator.com/api/v1/credits" \
  -H "xai-key: your_api_key"

Response:

{
  "balance": 150,
  "expiresAt": "2026-02-01T00:00:00Z"
}

Credits Usage History

GET /api/v1/credits/usage

curl "https://xaicreator.com/api/v1/credits/usage?page=1&limit=20" \
  -H "xai-key: your_api_key"

Parameters

ParameterTypeRequiredDescription
pagenumberNoPage number (default: 1)
limitnumberNoItems per page (default: 20, max: 100)
start_datestringNoFilter by start date (ISO 8601)
end_datestringNoFilter by end date (ISO 8601)
trans_typestringNoFilter by transaction type

Response:

{
  "records": [
    {
      "id": 1,
      "trans_no": "TXN-001",
      "trans_type": "publish",
      "credits": -10,
      "order_no": null,
      "source_type": "twitter",
      "source_detail": "Published draft: My Draft",
      "expired_at": null,
      "created_at": "2026-01-15T10:00:00.000Z"
    }
  ],
  "pagination": {
    "total": 50,
    "page": 1,
    "limit": 20,
    "hasMore": true
  }
}

Error Handling

All endpoints may return errors in this format:

{
  "success": false,
  "error": "ERROR_CODE",
  "message": "Human-readable error message"
}

Common Error Codes

CodeDescription
INVALID_API_KEYAPI key is missing, invalid, or revoked
USER_NOT_FOUNDEmail not registered
INVALID_CREDENTIALSInvalid email or password
INSUFFICIENT_CREDITSNot enough credits for the operation
NO_SOCIAL_SETUser has no Social Set. Connect a social account first before creating drafts.
UNAUTHORIZEDUser lacks permission for the resource
NOT_FOUNDRequested resource doesn't exist
RATE_LIMITEDToo many requests, try again later
INVALID_INPUTRequest validation failed
TOKEN_EXPIREDOAuth token has expired (re-auth required)
OAUTH_NOT_CONFIGUREDOAuth environment variables not configured

HTTP Status Codes

StatusDescription
200Success
400Bad Request (invalid input)
401Unauthorized (invalid API key or token)
402Payment Required (insufficient credits)
403Forbidden (limit exceeded)
404Not Found
500Internal Server Error

Rate Limits

API requests are rate limited per API Key:

  • Free tier: 100 requests/hour
  • Pro tier: 1,000 requests/hour
  • Enterprise: Custom limits

Rate limit headers are included in responses:

X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 950
X-RateLimit-Reset: 1705272000

Best Practices

  1. Secure Your Keys: Never expose API Keys in client-side code or public repositories
  2. Handle Errors: Always check for error responses and handle appropriately
  3. Check Credits: Verify credit balance before publishing operations
  4. Use Webhooks: For long-running operations, consider setting up webhooks
  5. Cache Responses: Cache Social Set and account data to reduce API calls
  6. Batch Operations: Create threads in a single draft request when possible
  7. Schedule Ahead: Use the scheduling API for optimal posting times
  8. Multi-Platform: Use multi-platform endpoint for simultaneous publishing

Platform Reference

PlatformMax CharactersMax MediaCredit Cost
Twitter280 (or more with Premium)4 images / 1 video10
Bluesky3004 images10
Mastodon500 (instance-dependent)4 images10
Threads50010 photos / 1 video10
LinkedIn300020 images10

CLI Tool

The @xaicreator/cli npm package provides a command-line interface for all API operations, suitable for both human users and AI agents.

Installation

npm install -g @xaicreator/cli
# or run directly
npx @xaicreator/cli

Authentication

# Login with API Key
xaic login --api-key sk-xxx

# Check current user
xaic whoami

# Logout
xaic logout

Common Commands

# Drafts
xaic draft list
xaic draft create --content "Hello world"
xaic draft create --file ./tweet.md          # From file
xaic draft create --stdin                    # From stdin (pipe)
xaic draft get <id>
xaic draft update <id> --content "Updated"
xaic draft delete <id>

# Publishing
xaic publish <draft-id>

# Scheduling
xaic schedule create <draft-id> --at "2026-01-15T10:00:00Z"
xaic schedule list
xaic schedule cancel <id>

# Social Sets & Accounts
xaic social-set list
xaic account list

# Templates
xaic template list
xaic template get <id>
xaic template create --name "My Template"

# Credits
xaic credits
xaic credits-usage

Global Options

--output json|table|minimal     # Output format (default: table)
--api-key sk-xxx                # Override stored API Key
--base-url https://...          # Custom API base URL
--quiet                         # Suppress non-essential output

Environment Variables

XAIC_API_KEY=sk-xxx             # API Key (alternative to login)
XAIC_BASE_URL=https://...       # Custom API base URL

SDK Usage

The CLI's underlying client can be imported as an SDK:

import { XAICreatorClient } from '@xaicreator/cli';

const client = new XAICreatorClient({ apiKey: 'sk-xxx' });
const drafts = await client.listDrafts();
const draft = await client.createDraft({
  title: 'Hello',
  tweets: [{ content: 'Hello world', position: 0 }],
});
await client.publish(draft.draft.id);

Thread Support

Create multi-tweet threads using --- separator:

echo "First tweet
---
Second tweet
---
Third tweet" | xaic draft create --stdin

Support

For API issues or questions: