Why is my API call failing?

2 min read
Troubleshooting

Here are the most common API errors and how to fix them quickly.


401 Unauthorized

Error: Code: INVALID_API_KEY

Common causes:

  • API key is incorrect or has a typo
  • API key was revoked
  • Missing "Bearer" prefix in the header

How to fix:

bash
# Wrong - missing Bearer prefix Authorization: YOUR_API_KEY # Correct - includes Bearer prefix Authorization: Bearer YOUR_API_KEY

404 Not Found

Error: Code: INVALID_DESIGN_ID

Common causes:

  • Design ID is incorrect
  • Design was deleted
  • Design belongs to a different account

How to fix:

  1. Copy the ID directly from the editor URL: /editor/YOUR_DESIGN_ID
  2. Verify the design exists in your dashboard
  3. Ensure you're using the correct API key for that account

400 Bad Request

Error: Code: INVALID_ELEMENT

Common causes:

  • Element name doesn't exist in the design
  • Typo in element name
  • Case sensitivity issue (names are case-sensitive!)

How to fix:

  1. Open the design in the editor
  2. Check the exact layer names in the right panel
  3. Use the Integrations page to see all available elements

Tip: Layer names are case-sensitive. Title and title are different elements!


429 Too Many Requests

Error: Code: RATE_LIMIT_EXCEEDED

Cause: You're sending too many requests in a short time period.

How to fix:

  • Add delays between requests (100-200ms recommended)
  • Implement exponential backoff for retries
  • Contact us if you need higher rate limits
javascript
// Example: Exponential backoff async function renderWithRetry(data, maxRetries = 3) { for (let i = 0; i < maxRetries; i++) { try { return await render(data); } catch (error) { if (error.code === 'RATE_LIMIT_EXCEEDED') { await sleep(Math.pow(2, i) * 1000); // 1s, 2s, 4s continue; } throw error; } } }

402 Payment Required

Error: Code: INSUFFICIENT_CREDITS

Cause: Your account has run out of render credits.

How to fix:

  1. Check your credit balance in DashboardUsage
  2. Upgrade your plan for more monthly credits
  3. Purchase a one-time credit pack

Still Having Issues?

Note: When contacting support, include:

  • Your API request (with API key redacted)
  • The full error response
  • Design ID you're trying to render
  • Timestamp of when the error occurred

Email us at support@canvelete.com and we'll help you resolve the issue quickly.

Was this article helpful?

Need more help? Contact support