Skip to main content
This guide explains how to handle errors when using Sim APIs, including common error codes, troubleshooting steps, and code examples for proper error handling.

Errors vs. Warnings

Sim APIs distinguish between errors and warnings:
  • Errors indicate that the request failed and could not be fulfilled. The API returns an error response with an HTTP 4xx or 5xx status code.
  • Warnings indicate non-fatal issues where the request was partially fulfilled. The API returns a successful HTTP 200 response with data, but includes a warnings array to inform you about issues that occurred.

When Warnings Occur

Warnings are currently used when you request data for specific chains via the chain_ids parameter and some of those chains are not supported. For example:
  • If you request ?chain_ids=1,9999,10 and chain 9999 is not supported, the API will return data for chains 1 and 10, plus a warning about chain 9999.

Warning Response Format

When warnings are present, they appear in a warnings array within the successful (HTTP 200) response:
Each warning includes:
  • code: A machine-readable warning code (e.g., UNSUPPORTED_CHAIN_IDS)
  • message: A human-readable description of the warning
  • chain_ids: The list of chain IDs that caused this warning (for chain-related warnings)
  • docs_url: A link to relevant documentation for more information

Error Response Format

Authentication, rate limiting, and quota enforcement errors return JSON with an error field:
All other errors return JSON with a message field:
A few endpoints (EVM Transactions, Activity, Token Info) return errors as plain text with no JSON wrapper. Check the error responses documented on each endpoint’s page for the exact format.
When handling errors programmatically, check for both "error" and "message" fields in the response body.

Common Error Codes

Handling Warnings in Code

When processing API responses, check for the warnings array to be notified of non-fatal issues:

Handling Errors in Code

Here are examples of how to properly handle errors in different programming languages:

Best Practices for Error Handling

  1. Always check for errors: Don’t assume API calls will succeed.
  2. Use HTTP status codes: Rely on HTTP status codes rather than parsing error message strings for programmatic decisions.
  3. Implement retry logic with backoff: For transient errors (like rate limits or server errors), implement exponential backoff.
  4. Provide meaningful error messages: Transform API error responses into user-friendly messages.
  5. Log errors for debugging: Maintain detailed logs of API errors for troubleshooting.
  6. Implement fallbacks: When possible, have fallback behavior when API calls fail.

Debugging Tips

If you’re experiencing persistent errors:
  1. Verify your API key: Ensure it’s valid and has the necessary permissions.
  2. Check request format: Validate that your request parameters match the API specifications.
  3. Inspect full error responses: The error message often contains specific details about what went wrong.
  4. Monitor your usage: Check if you’re approaching or exceeding rate limits.
  5. Test with cURL: Isolate issues by testing the API directly with cURL:

Need More Help?

If you’re still experiencing issues after following these guidelines, please reach out through our support channels.