Errors

Not Found

404 - The requested resource was not found

Overview

The 404 Not Found error occurs when the requested resource does not exist in the system.

HTTP Status Code

404

Error Response

{
  "type": "https://scan-documents.com/docs/errors/not-found",
  "title": "Not Found",
  "status": 404,
  "message": "File with id file_abc123def456 not found."
}

Common Causes

  • Requesting a resource with an invalid or non-existent ID
  • The resource was deleted before the request was made
  • Typo in the resource ID
  • Using an ID from a different environment (e.g., test ID in production)

How to Fix

  1. Verify Resource ID: Double-check that the resource ID is correct and properly formatted. Resource IDs typically follow the pattern {resource}_{randomId}:

    • Files: file_abc123def456
    • Tasks: task_xyz789ghi012
  2. Check Resource Existence: Before accessing a resource, you can list all available resources to verify it exists:

# List all files
curl -X GET https://api.scan-documents.com/v1/files \
  -H "Authorization: Bearer YOUR_API_KEY"
  1. Handle Deleted Resources: If you're storing resource IDs, implement proper error handling for cases where resources may have been deleted:
try {
  const file = await client.files.get(fileId);
  // Process file
} catch (error) {
  if (error.status === 404) {
    console.log('File no longer exists');
    // Handle gracefully
  }
}