Process a PDF for text extraction and embedding

POST /message/pdf

Takes a URL to a PDF and a fileId (CUID of the file_uploads record). Checks the PDF size, downloads it, extracts text, chunks it, generates embeddings, and stores them.

application/json

Body Required

  • url string(url) Required

    The publicly accessible URL of the PDF file (from Vercel Blob).

  • fileId string Required

    The CUID of the corresponding record in the 'file_uploads' table.

Responses

  • 200 application/json

    PDF processed and embedded successfully

    Hide response attributes Show response attributes object
    • success boolean Required
    • statusCode integer Required
    • message string Required
    • data object Required
      Hide data attribute Show data attribute object
      • embeddingsData object Required

        Data related to the generated embeddings (structure may vary).

  • 400 application/json

    Bad Request (e.g., missing URL/fileId, file too large, invalid URL, failed size check)

    Hide response attributes Show response attributes object
    • success boolean Required
    • statusCode integer Required
    • message string Required
  • 500 application/json

    Internal Server Error (e.g., failed to download/process PDF, embedding error)

    Hide response attributes Show response attributes object
    • success boolean Required
    • statusCode integer Required
    • message string Required
POST /message/pdf
curl \
 --request POST 'http://localhost:3000/api/v1/message/pdf' \
 --header "Content-Type: application/json" \
 --data '{"url":"https://blob.vercel-storage.com/.../document.pdf","fileId":"clwxyz..."}'
Request example
{
  "url": "https://blob.vercel-storage.com/.../document.pdf",
  "fileId": "clwxyz..."
}
Response examples (200)
{
  "success": true,
  "statusCode": 200,
  "message": "string",
  "data": {
    "embeddingsData": {
      "count": 150,
      "status": "success"
    }
  }
}
Response examples (400)
{
  "success": false,
  "statusCode": 400,
  "message": "Error description"
}
Response examples (500)
{
  "success": false,
  "statusCode": 400,
  "message": "Error description"
}