PowerPost APIv1
PowerPost APIv1
PowerPost APIQuickstartAuthenticationWorkspacesInput Types

API Reference

Upload MediaGenerate ContentGenerationsGenerate ImagesPosts & PublishingGet Credits

Guides

WebhooksError CodesChangelog

Error Codes

API error codes and how to handle them.

All successful responses return HTTP 200. All errors return a consistent format:

{
  "error": {
    "message": "Human-readable error message",
    "code": "ERROR_CODE"
  }
}

Error Reference

HTTP StatusCodeDescription
400VALIDATION_ERRORInvalid request body or parameters
401INVALID_API_KEYMissing or invalid API key
402INSUFFICIENT_CREDITSNot enough credits for this operation
403FORBIDDENYou don't have access to this resource
404NOT_FOUNDResource not found
409ALREADY_PUBLISHEDPost has already been published
413FILE_TOO_LARGEUploaded file exceeds size limit
413STORAGE_QUOTA_EXCEEDEDAccount storage quota exceeded
422PLATFORM_NOT_CONNECTEDSocial platform not connected for publishing
429RATE_LIMIT_EXCEEDEDToo many requests
500INTERNAL_ERRORServer error — try again later

Rate Limits

Rate limits vary by endpoint. When you exceed the limit, you'll receive a 429 response with rate limit headers.

Rate Limit Headers

Every response includes rate limit information:

X-RateLimit-Limit: 30
X-RateLimit-Remaining: 29
X-RateLimit-Reset: 1736534460

Rate Limit Error

{
  "error": {
    "message": "Rate limit exceeded",
    "code": "RATE_LIMIT_EXCEEDED",
    "retryAfter": 45
  }
}

Handling Errors

JavaScript Example

async function generateContent(prompt, postTypes) {
  const res = await fetch('https://powerpost.ai/api/v1/content/generate', {
    method: 'POST',
    headers: {
      'x-api-key': process.env.POWERPOST_API_KEY,
      'X-Workspace-Id': 'YOUR_WORKSPACE_ID',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({ prompt, post_types: postTypes, research_mode: 'regular' }),
  })

  if (!res.ok) {
    const { error } = await res.json()

    switch (error.code) {
      case 'INSUFFICIENT_CREDITS':
        throw new Error('Please add more credits')
      case 'RATE_LIMIT_EXCEEDED':
        // Wait and retry
        await new Promise((r) => setTimeout(r, error.retryAfter * 1000))
        return generateContent(prompt, postTypes)
      default:
        throw new Error(error.message)
    }
  }

  return res.json()
}

Request Tracing

All responses include an X-Request-Id header:

X-Request-Id: 7f3c9a2b-4d5e-6f7g-8h9i-0j1k2l3m4n5o

Include this ID when contacting support for faster debugging.

Webhooks

Receive real-time notifications when generations complete.

Changelog

API changes, new features, and deprecations.

On this page

Error ReferenceRate LimitsRate Limit HeadersRate Limit ErrorHandling ErrorsJavaScript ExampleRequest Tracing