Skip to content

Best Practices

Guidelines for building production-ready integrations with the Resource API.

Use Search Over Discover, When Possible

As mentioned in Product Checklist, the resource team or our partners may have already found sufficient resources for your application. If that is the case, prefer using the /api/v0/search endpoint over the /api/v0/discover endpoint for lower latency.

Request Only What You Need

Including the travel_mode in your request will cause the API to request travel route information to the found resources, adding latency to the response. If your application does not need travel route information, omit the travel_mode field. Similarly, if you only need a few resources for your use case, use the limit parameter to reduce response size and latency.

Use Concurrent Requests

All requests are handled independently in the API, so you may request resources for multiple needs concurrently (multiple category/subcategory pairs). For example:

import asyncio

async def fetch_resources(category, subcategory, limit):
    ...

tasks = [
    fetch_resources(category1, subcategory1, limit=5),
    fetch_resources(category2, subcategory2, limit=5),
    fetch_resources(category3, subcategory3, limit=5),
]
results = await asyncio.gather(*tasks)