Skip to main content

Error Response Format

All API errors return a JSON response with a detail field:
{
  "detail": "Error message describing what went wrong"
}
For validation errors (malformed request body), the response includes field-level details:
{
  "detail": [
    {
      "type": "validation_error",
      "loc": ["body", "field_name"],
      "msg": "Field validation message",
      "input": "provided_value"
    }
  ]
}

HTTP Error Codes

CodeTypeRetryableDescription
400invalid_request_errorNoIssue with the format or content of your request
401authentication_errorNoInvalid or missing API key
403permission_errorNoAPI key lacks permission or subscription issue
404not_found_errorNoRequested resource not found or expired
413request_too_largeNoFile exceeds the maximum allowed size
429rate_limit_errorYesRate limit exceeded — wait and retry
500api_errorYesInternal server error — wait and retry
529overloaded_errorYesAPI temporarily overloaded — wait and retry

SDK Exception Mapping

The Python SDK maps HTTP errors to specific exception classes:
HTTP CodeSDK ExceptionDescription
400DatalabAPIErrorCheck the response_data field for details
401DatalabAPIErrorInvalid API key
403DatalabAPIErrorSubscription or permission issue
404DatalabAPIErrorResource not found or expired
413DatalabAPIErrorFile too large
429Auto-retriedSDK retries automatically with exponential backoff
500Auto-retriedSDK retries automatically
TimeoutDatalabTimeoutErrorRequest timed out
File errorDatalabFileErrorFile not found or empty
ValidationDatalabValidationErrorInvalid input parameters
from datalab_sdk import DatalabClient
from datalab_sdk.exceptions import (
    DatalabAPIError,
    DatalabTimeoutError,
    DatalabFileError,
    DatalabValidationError,
)

client = DatalabClient()

try:
    result = client.convert("document.pdf")
except DatalabFileError as e:
    print(f"File issue: {e}")
except DatalabTimeoutError as e:
    print(f"Timed out: {e}")
except DatalabAPIError as e:
    print(f"API error (HTTP {e.status_code}): {e}")
    if e.response_data:
        print(f"Details: {e.response_data}")

Common Error Messages

400 Bad Request

{"detail": "Invalid file type. Only PDF files, word documents, spreadsheets, powerpoints, HTML, and PNG, JPG, GIF, TIFF, and WEBP images are accepted."}
{"detail": "File size exceeds upload limit of 209715200 bytes."}

401 Unauthorized

{"detail": "Invalid API key provided. Set the X-API-Key header to your API key."}

403 Forbidden

{"detail": "You need an active, paid subscription to use this API."}
{"detail": "Your subscription has expired. You may need to re-enable your plan, or pay an unpaid invoice."}
{"detail": "Your payment has failed. Please pay any unpaid invoices to continue using the API."}

429 Too Many Requests

{"detail": "Rate limit exceeded for endpoint /api/v1/convert. You can make 200 requests every 60 seconds. Please try again later, or reach out to support@datalab.to if you need a higher limit."}
{"detail": "Concurrency exceeded for endpoint /api/v1/convert. You can have 400 concurrent requests running at once. Please try again later, or reach out to support@datalab.to if you need a higher limit."}

Subscription and Access Errors

When making API requests, you may encounter 403 errors related to your subscription status:

No Active Subscription

Error: "You need an active, paid subscription to use this API." This occurs when you don’t have an active subscription and have exhausted your free credits. To resolve:
  • Subscribe to a paid plan in the dashboard
  • New accounts include free credits — verify your email to claim them

Expired Subscription

Error: "Your subscription has expired. You may need to re-enable your plan, or pay an unpaid invoice." Your subscription has passed its end date and grace period. To resolve:
  • Renew your subscription in the dashboard
  • Pay any outstanding invoices

Payment Failed

Error: "Your payment has failed. Please pay any unpaid invoices to continue using the API." A payment for your subscription has failed and you’ve exceeded the grace period. To resolve:
  • Update your payment method in the dashboard
  • Pay any unpaid invoices

Inactive Subscription

Error: "Your subscription is not active. You may need to re-enable your plan or pay an unpaid invoice." Your subscription is canceled or inactive. To resolve:
  • Reactivate your subscription in the dashboard
  • Subscribe to a new plan

Next Steps