xAIcreator

API Reference

Complete API v1 documentation for authentication, publishing, and scheduling

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
statusstringNoDraft status (default: "draft")
scheduledForstringNoISO 8601 datetime for scheduled publishing
selectedAccountIdsarrayNoAccount IDs to publish to
templateIdstringNoTemplate ID if created from template

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"
  }
}

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"
}

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"
        }
      ]
    }
  ]
}

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"
}

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
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

Support

For API issues or questions: