GET
/api/companies
Try Me!
Query Parameters
Response Schema
| Field | Type | Description |
|---|---|---|
| name | string | Name of the company |
| slug | string | URL-friendly unique identifier |
| industry | string | Industry the company operates in |
| country | string | Country where the company is based |
Summary
Returns a list of all companies whose data is currently present in the database.
This endpoint is designed for read-only access and is commonly used by client applications to populate selectors such as dropdowns, filters, and search facets.
Description
The Fetch Companies API retrieves companies records from the database and returns them as a JSON array.
Key characteristics of this endpoint:
- Publicly accessible (no authentication required)
- No query parameters or 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
This endpoint serves as the authoritative source of company data across the platform.
Endpoint
GET /api/companiesRequest
This endpoint does not accept any parameters
Headers
This endpoint does not accept any parameters
| Header | Required | Description |
|---|---|---|
Accept | Optional | Defaults to application/json |
Response Schema
Success - 200 OK
Company[]Company Object
| Field | Type | Description |
|---|---|---|
name | string | Name of the company |
slug | string | URL-friendly slug |
country | string | The country the company is headquartered in |
industry | string | The industry the company predominantly operates in |
Example Response
[
{
"name": "Apple",
"slug": "apple",
"country": "North America",
"industry": "Technology"
},
{
"name": "BHP",
"slug": "bhp",
"country": "Australia",
"industry": "Mining"
}
]Empty Response
If no companies are available, an empty array is returned:
[]Error Codes & Response Types
503 Service Unavailable
Returned when the database is temporarily unavailable, or a query fails due to a database issue
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
- Uses a MongoDB find() query with projection to exclude _id
- Materializes the cursor before returning the response
- Logs both database-specific and unexpected errors for observability
- Treats empty datasets as a valid state, not an error condition