Error Handling

Error Handling

The API uses standard HTTP status codes to indicate the success or failure of requests. Below are the common error responses:

  • 400 Bad Request: The request could not be understood or was missing required parameters.

  • 401 Unauthorized: Authentication failed or user does not have permissions for the desired action.

  • 404 Not Found: The requested resource does not exist.

  • 429 Too Many Requests: Rate limit exceeded.

  • 500 Internal Server Error: An unexpected error occurred on the server.

Error Response Format:

{
  "detail": "Error message describing what went wrong."
}

Models

1. CreateUserRequest

  • Description: Request body schema for creating a new user.

  • Fields:

    • username: string (3-50 characters, alphanumeric, required)

    • password: string (min 8 characters, at least one digit and one uppercase letter, required)

2. AssignAPIKeyRequest

  • Description: Request body schema for assigning an API key to a user.

  • Fields:

    • username: string (3-50 characters, alphanumeric, required)

3. APIKeyResponse

  • Description: Response schema for API key operations.

  • Fields:

    • message: string

    • api_key: string

4. RemoveUserRequest

  • Description: Request body schema for removing a user.

  • Fields:

    • username: string (required)

5. FileUploadResponse

  • Description: Response schema for PDF upload.

  • Fields:

    • message: string

    • file_id: string

    • gcs_url: string (optional)

6. ProcessResponse

  • Description: Response schema for retrieving processing results.

  • Fields:

    • result: object or string

    • chunks: array of object


Last updated