Skip to content

Error Codes

When an error occurs, the API returns a JSON response with success: false:

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

Error Reference

Authentication Errors

CodeStatusDescriptionResolution
MISSING_AUTH401Authorization header is missingAdd Authorization: Bearer YOUR_API_KEY header
INVALID_API_KEY401API key is invalid or has been revokedCheck your API key or generate a new one
INVALID_TOKEN401JWT token is invalid or expiredRefresh your authentication token
SUBSCRIPTION_REQUIRED403Active Pro subscription requiredUpgrade to Pro at shotprose.com/pricing

Request Errors

CodeStatusDescriptionResolution
INVALID_REQUEST400Request body is invalidCheck JSON syntax and required fields
MISSING_SCREENSHOT400No screenshot providedInclude screenshot_url or screenshot_base64
RATE_LIMITED429Rate limit exceededWait and retry after the Retry-After period

Server Errors

CodeStatusDescriptionResolution
RENDER_TIMEOUT504Render operation timed outTry a simpler configuration or retry
RENDER_FAILED500Failed to generate mockupCheck screenshot URL accessibility
INTERNAL_ERROR500Unexpected server errorRetry or contact support

Handling Errors

JavaScript

javascript
const response = await fetch('https://shotprose.com/api/v1/mockup', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${apiKey}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(requestBody)
});

const data = await response.json();

if (!data.success) {
  switch (data.error.code) {
    case 'RATE_LIMITED':
      // Wait and retry
      const retryAfter = response.headers.get('Retry-After');
      await sleep(parseInt(retryAfter) * 1000);
      break;
    case 'INVALID_API_KEY':
      // Handle authentication error
      throw new Error('Please check your API key');
    default:
      throw new Error(data.error.message);
  }
}

Python

python
import requests
import time

response = requests.post(
    'https://shotprose.com/api/v1/mockup',
    headers={'Authorization': f'Bearer {api_key}'},
    json=request_body
)

data = response.json()

if not data['success']:
    error_code = data['error']['code']

    if error_code == 'RATE_LIMITED':
        retry_after = int(response.headers.get('Retry-After', 60))
        time.sleep(retry_after)
    elif error_code == 'INVALID_API_KEY':
        raise Exception('Please check your API key')
    else:
        raise Exception(data['error']['message'])

Best Practices

  1. Always check success - Don't assume the request succeeded
  2. Handle rate limits gracefully - Implement exponential backoff
  3. Log error codes - Makes debugging easier
  4. Validate inputs - Catch errors before making API calls

Shotprose API Documentation