PDF Processing

4.1. Upload PDF

  • URL: /upload-pdf

  • Method: POST

  • Description: Allows authenticated users to upload a PDF file for processing. Optionally, users can provide metadata in JSON format.

  • Authentication: HTTP Bearer (User API Key)

  • Request:

    • Content-Type: multipart/form-data

    • Form Fields:

      • file (file, required): The PDF file to upload.

      • metadata (string, optional): JSON string containing additional metadata.

  • Constraints:

    • Only PDF files (.pdf) are accepted.

  • Responses:

    • 200 OK

      {
        "message": "File uploaded successfully.",
        "file_id": "string (unique identifier)",
        "gcs_url": "string (Google Cloud Storage URL)"
      }
    • 400 Bad Request

      • Reasons:

        • File is not a PDF.

        • Metadata JSON parsing error.

      {
        "detail": "Only PDF files are supported."
      }
      {
        "detail": "Metadata JSON parse error: <error_message>"
      }
    • 401 Unauthorized

      {
        "detail": "Invalid or expired API key."
      }

4.2. Get Processing Response

  • URL: /response

  • Method: GET

  • Description: Retrieves the processing result of an uploaded PDF using its file_id.

  • Authentication: None

  • Query Parameters:

    • file_id (string, required): The unique identifier of the uploaded PDF.

  • Responses:

    • 200 OK

    • 404 Not Found

      • Reason: No record found for the provided file_id.


Last updated