Skip to main content

Overview

This guide covers how to handle errors from the Shipstar API, including common error codes, response formats, and best practices for building resilient integrations.

Error Response Format

All API errors return a JSON response with a detail field:
For example, generation requests fail with 402 when your team’s monthly credit allowance is exhausted (see Plans & Credits):

HTTP Status Codes

Client Errors (4xx)

Server Errors (5xx)

Common Errors and Solutions

Causes:
  • Missing Authorization header
  • API key has been deactivated or expired
  • JWT session token has expired
Solutions:
  • Ensure header format is Authorization: Bearer YOUR_KEY
  • Check for typos in the API key
  • Create a new API key in the Dashboard
  • For JWT tokens, refresh via /api/internal/auth/jwt/refresh
Causes:
  • Your team’s monthly credit allowance is exhausted — generation requests charge credits per content type (see Plans & Credits)
Solutions:
  • Wait for credits to reset at the next billing cycle
  • Upgrade your plan for more credits
  • Check your usage in the dashboard sidebar or under Account → Plan
Causes:
  • Accessing a resource that belongs to another project or team
  • Attempting an admin-only operation
Solutions:
  • Check that your API key belongs to the correct project
  • Verify your account permissions
Causes:
  • Content ID doesn’t exist
  • Public slug doesn’t match any published content
  • Resource has been deleted
Solutions:
  • Verify the content ID or slug
  • Check that the content hasn’t been deleted or unpublished
Causes:
  • Attempting to create a duplicate resource
Solutions:
  • Check if the resource already exists before creating
  • Use update endpoints instead of create
Causes:
  • Exceeded requests per minute limit
Solutions:
  • Implement exponential backoff
  • Respect the retry_after value
  • Cache responses where possible
See Rate Limiting below.
Causes:
  • GitHub API is unavailable or returning errors
  • Other external service failure
Solutions:
  • Retry after a short delay
  • Check if GitHub is experiencing an outage

Implementing Error Handling

Basic Error Handling

With Retry Logic

Handling Content Generation Failures

Content generation is asynchronous, so you need to handle failures in your polling logic:

Rate Limiting

Shipstar applies rate limits to protect the service. Limits vary by endpoint:

Handling Rate Limits

Best Practices

Handle All Statuses

Account for pending, processing, completed, and failed states in your polling logic

Use Retries

Implement exponential backoff for 429 and 5xx errors

Log Errors

Log errors with context (endpoint, content ID, status) for debugging

Set Timeouts

Don’t poll indefinitely — set a maximum wait time for content generation

Logging Example