Skip to Content

GET

/api/fetchCompany


Try Me!

GET /api/fetchCompany

Query Parameters

Response Schema

FieldTypeDescription
namestringName of the company
slugstringURL-friendly unique identifier
industrystringIndustry the company operates in
countrystringCountry where the company is based
environmentalobjectEnvironmental statistics
socialarraySocial statistics
governancearrayGovernance statistics

Summary

Returns detailed ESG information about the company whose slug is passed to it.

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 Company Data 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/fetchCompanyData

Request

This endpoint accepts a singular parameter: industry

Parameters

ParametersRequiredDescription
company_slugmandatoryThe slug of the company you wish to search for

Headers

This endpoint accepts one parameter.

HeaderRequiredDescription
AcceptOptionalDefaults to application/json

Response Schema

Success - 200 OK

CompanyData[]
CompanyData Object
FieldTypeDescription
namestringName of the company
slugstringURL-friendly slug
countrystringThe country the company is headquartered in
industrystringThe industry the company predominantly operates in
environmentalEnvironmentalDataThe environmental data of the company concerned
socialSocialGovernanceDataThe social data of the company concerned
governanceSocialGovernanceDataThe governance data of the company concerned
Example Response
[ { "name": "Apple", "slug": "apple", "country": "North America", "industry": "Technology", "environmental": { "quantitative": [ { "criterion": "blah", "unit": "TJ", "current": [ { "year": 2024, "value": 5992 } ], "future": [ { "year": 2025, "value": 5500 } ] } ], "qualitative": [ { "criterion": "TCFD-Aligned Energy Disclosures", "history": [ { "year": 2024, "comment": "The company integrates disclosures" } ] } ] } } ]
Empty Response

If the company does not exist, 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
  1. MongoDB Connection Issues
  2. 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
  1. Unhandled runtime exception
  2. Application-level failure outside database operations.

Implementation Notes

  1. Uses a MongoDB find() query with projection to exclude _id
  2. Materializes the cursor before returning the response
  3. Logs both database-specific and unexpected errors for observability
  4. Treats empty datasets as a valid state, not an error condition
Last updated on