Skip to main content
The Memic API uses conventional HTTP status codes. 2xx means success, 4xx means the request had a problem (fix it and retry), 5xx means Memic had a problem (retry with backoff).

Error response format

Error responses are JSON with a stable shape:
{
  "detail": "File not found",
  "code": "file_not_found",
  "request_id": "req_01J9..."
}
  • detail — human-readable error message
  • code — stable machine-readable error code (use this for programmatic handling)
  • request_id — opaque ID for support tickets; include it when filing issues

HTTP status codes

CodeMeaningWhat to do
200Success
201Created
204No content (e.g. after DELETE)
400Bad request — invalid inputFix the request body or query params and retry
401Unauthorized — missing or invalid API keyCheck X-API-Key header
403Forbidden — key valid but not authorized for this resourceVerify the key is bound to the correct environment
404Not found — resource doesn’t exist or isn’t in your environmentCheck the resource ID
409Conflict — e.g. duplicate resourceInspect the error; usually non-retryable
422Unprocessable — request shape is valid but values are rejectedRead the detail field
429Rate limitedBack off and retry — see Rate limits
500Internal server errorRetry with exponential backoff; file an issue if persistent
502/503/504Gateway/service issueRetry with exponential backoff

Common error codes

CodeStatusDescription
invalid_api_key401The API key is missing, malformed, or deleted
file_not_found404The file ID doesn’t exist in this environment
prompt_not_found404No prompt with that name has a live version
file_still_processing409File is not yet ready — poll /files/{id}/status
invalid_file_type400Unsupported file extension
file_too_large413File exceeds the upload size limit
rate_limit_exceeded429Too many requests — back off

Retry strategy

For 5xx responses and 429, use exponential backoff with jitter:
import time
import random

def call_with_retry(fn, max_attempts=5):
    for attempt in range(max_attempts):
        try:
            return fn()
        except TransientError as e:
            if attempt == max_attempts - 1:
                raise
            delay = (2 ** attempt) + random.uniform(0, 1)
            time.sleep(delay)
The Python SDK does this automatically for transient errors.

Reporting issues

If you hit a 5xx error that doesn’t resolve with retry, include the request_id from the error response when you report it. This lets us find the exact request in our logs.

Rate limits

Limits and 429 response behavior.

Authentication

How API keys work.