As a user of our web calculator APIs, you may need to handle a large number of requests efficiently to avoid timeouts. This is particularly important for clients processing five or six-digit numbers of requests daily. Here are some best practices for using our APIs in a performant way:
1. Use the Bulk Flight API: We offer two flight APIs - one for single flights and another for multiple flights with a single query. For high-volume use cases, we strongly recommend using the bulk flight API. You can find the documentation at: https://connect.myclimate.org/apis#operation/post-v1-bulk_flight_calculators.json
2. Batch Processing: The bulk flight API can calculate several thousand flights within seconds. For large numbers of flights (e.g., 15,000), we suggest splitting them into smaller batches of around 5,000 flights each.
3. Fair Use Policy: We don't enforce hard limits on API requests but follow a "fair use" policy. We ask clients not to overwhelm our APIs with unnecessary requests. For exceptionally high numbers of calculations (50,000+), we'll work with you to find a suitable technical solution.
4. De-duplication and Caching: In large flight inventories, identical routes often account for a significant portion of all flights. By caching and reusing calculation results for identical routes, you can dramatically reduce the number of API calls needed. For example, "Berlin-Zurich-Economy" will have the same footprint regardless of how many times it appears in your dataset.
5. Efficient Data Preprocessing: Remember that the carbon footprint for a flight is the same in both directions (e.g., "Berlin-Zurich-Economy" and "Zurich-Berlin-Economy" have the same footprint). By properly preprocessing your data, you can further reduce the number of necessary calculations.
By following these guidelines, you can efficiently use our APIs for large-scale calculations while adhering to our fair use policy. If you have any questions or need further assistance, please don't hesitate to contact us.