Add Data
POST
/api/companies
Summary
Adds a given PDF’s data into the database using GenAI and Docling. Subject to Google Gemini rate limits.
Description
The Add Data API adds a company report into the database.
Key characteristics of this endpoint:
- Private access only.
- One query parameter, MultiForm Part request body
- Database identifiers (
_id) are excluded from responses - Empty results are treated as a valid, non-error response
- Clear separation between database errors and unexpected server failures
Endpoint
POST /api/addDataRequest
This endpoint accepts one parameter.
Parameters
| Parameters | Required | Type | Description |
|---|---|---|---|
company_name | mandatory | string | The company’s name, if it exists. Else, undefined |
Headers
This endpoint accepts a singular optional header.
| Header | Required | Description |
|---|---|---|
Accept | optional | Defaults to application/json |
Response Schema
Success - 200 OK
Example Response
[]Error Codes & Response Types
503 Service Unavailable
Returned when the database is temporarily unavailable, a query fails due to a database issue, or Gemini is overloaded.
Response Body
{
"detail" : "Database temporarily unavailable"
}Typical Causes
- MongoDB Connection Issues
- Database timeout or query failure for a non-general reason
500 Internal Server Error
Returned when an unexpected server-side error occurs.
Response Body
{
"detail" : "Internal server error"
}Typical Causes
- Unhandled runtime exception
- Application-level failure outside database operations.
Implementation Notes
- Logs both database-specific and unexpected errors for observability
- Treats empty datasets as a valid state, not an error condition
Last updated on