Skip to main content

Error Handling

The Fabius API uses standard HTTP status codes to indicate the success or failure of requests. Detailed error messages are included in the response body to help you troubleshoot issues.

HTTP Status Codes

Status CodeDescription
200 OKRequest succeeded
201 CreatedResource created successfully
400 Bad RequestInvalid request parameters or body
401 UnauthorizedMissing or invalid authentication
404 Not FoundResource not found
429 Too Many RequestsRate limit exceeded
500 Internal Server ErrorServer error

Error Response Format

All error responses include a JSON body with the following structure:
{
  "message": "Human-readable error description"
}

Common Errors

Authentication Errors

401 Unauthorized - Missing Header
{
  "message": "Authorization header required"
}
401 Unauthorized - Invalid Scheme
{
  "message": "Invalid authorization scheme"
}
401 Unauthorized - Invalid Credentials
{
  "message": "Invalid authentication credentials"
}
Causes:
  • Missing Authorization header
  • Wrong authentication scheme (must be “Basic”)
  • Invalid client ID or secret
  • Malformed Base64 encoding
  • Deleted API key
Solution: Verify your API credentials and ensure they’re properly formatted in the Authorization header.

Validation Errors

400 Bad Request - Missing Required Field
{
  "message": "Name is required"
}
{
  "message": "Content is required"
}
Solution: Ensure all required fields are included in your request. 400 Bad Request - Invalid Pagination
{
  "message": "Invalid request body: strconv.ParseInt: parsing \"abc\": invalid syntax"
}
{
  "message": "offset cannot be negative"
}
Solution: Ensure limit and offset parameters are valid positive integers. 500 Internal Server Error - User Not Found
{
  "message": "user with email [email protected] not found"
}
Solution: Verify the email address matches an existing user in your Fabius account. 500 Internal Server Error - Invalid Timestamp Format
{
  "message": "invalid document timestamp format (expected RFC3339): parsing time \"2023-12-15\" as \"2006-01-02T15:04:05Z07:00\": cannot parse \"\" as \"T\""
}
Solution: Ensure timestamps are in RFC3339 format (e.g., 2023-12-15T14:30:00Z).

Resource Errors

404 Not Found - Document
{
  "message": "Document not found"
}
Solution: Check the document ID and ensure it belongs to your account. 404 Not Found - Contact/Account
{
  "message": "contact not found"
}
Solution: Verify the external contact or account ID exists in your CRM and has been synced to Fabius.

Error Handling Best Practices

1. Implement Retry Logic

For transient errors (5xx status codes), implement exponential backoff:
async function apiRequestWithRetry(url, options, maxRetries = 3) {
  for (let i = 0; i < maxRetries; i++) {
    try {
      const response = await fetch(url, options);

      if (response.ok) {
        return response;
      }

      // Don't retry client errors
      if (response.status >= 400 && response.status < 500) {
        throw new Error(`Client error: ${response.status}`);
      }

      // Retry server errors with backoff
      if (i < maxRetries - 1) {
        await new Promise((resolve) =>
          setTimeout(resolve, Math.pow(2, i) * 1000)
        );
      }
    } catch (error) {
      if (i === maxRetries - 1) throw error;
    }
  }
}

2. Log Detailed Error Information

Always log the full error response for debugging:
import logging
import requests

try:
    response = requests.post(url, json=data, auth=auth)
    response.raise_for_status()
except requests.exceptions.HTTPError as e:
    logging.error(f"API Error: {e.response.status_code} - {e.response.text}")
    # Handle specific error cases
    if e.response.status_code == 400:
        error_data = e.response.json()
        if "user with email" in error_data.get("message", ""):
            # Handle user not found
            pass

3. Validate Input Before Sending

Validate data client-side to avoid unnecessary API calls:
function validateDocumentRequest(data) {
  const errors = [];

  if (!data.name || data.name.trim() === "") {
    errors.push("Name is required");
  }

  if (!data.content || data.content.trim() === "") {
    errors.push("Content is required");
  }

  if (data.userEmail && !isValidEmail(data.userEmail)) {
    errors.push("Invalid email format");
  }

  return errors;
}

Troubleshooting Guide

ErrorCommon CausesSolutions
401 UnauthorizedIncorrect credentials, revoked keyCheck API key configuration
400 Bad RequestMissing fields, invalid dataReview request payload
404 Not FoundWrong ID, resource doesn’t existVerify resource IDs
429 Too Many RequestsExceeded rate limitImplement retry with backoff
500 Internal Server ErrorServer issue, invalid referencesCheck data and retry if needed

Getting Help

If you continue to experience issues:
  1. Check the API status page for any ongoing incidents
  2. Review your request against the API documentation
  3. Contact support with your request details (excluding credentials)