Agoda Hotels Search
agoda.search.hotels
Hotels search from Agoda Travel & Hotels, as JSON.
At a glance
- Endpoint ID
agoda.search.hotels- Price
- 1 credit per call; failed calls are free
- Runs for up to
- 60 seconds
Request
Send the endpoint ID as capability and its fields as input. Set UPSCRAPE_API_KEY to your key first.
curl --request POST \ --url https://data.upscrape.com/execute \ --header "Authorization: Bearer $UPSCRAPE_API_KEY" \ --header "Content-Type: application/json" \ --header "Prefer: wait=30" \ --data '{ "capability": "agoda.search.hotels", "input": { "bounds": { "max_lat": 1.4, "max_lon": 104.0, "min_lat": 1.2, "min_lon": 103.7 }, "check_in": "2030-06-10", "check_out": "2030-06-12", "currency": "USD", "destination": "Singapore", "guests": [ { "adults": 2, "children": 1, "children_ages": [ 5 ] } ], "locale": "en-US", "max_pages": 1, "sort": "price_low_to_high" }}'
import jsonimport osimport requestspayload = json.loads(r'''{ "capability": "agoda.search.hotels", "input": { "bounds": { "max_lat": 1.4, "max_lon": 104.0, "min_lat": 1.2, "min_lon": 103.7 }, "check_in": "2030-06-10", "check_out": "2030-06-12", "currency": "USD", "destination": "Singapore", "guests": [ { "adults": 2, "children": 1, "children_ages": [ 5 ] } ], "locale": "en-US", "max_pages": 1, "sort": "price_low_to_high" }}''')response = requests.post( "https://data.upscrape.com/execute", headers={ "Authorization": f"Bearer {os.environ['UPSCRAPE_API_KEY']}", "Content-Type": "application/json", "Prefer": "wait=30", }, json=payload,)response.raise_for_status()print(json.dumps(response.json(), indent=2))
const response = await fetch("https://data.upscrape.com/execute", { method: "POST", headers: { "Authorization": `Bearer ${process.env.UPSCRAPE_API_KEY}`, "Content-Type": "application/json", "Prefer": "wait=30", }, body: JSON.stringify({ "capability": "agoda.search.hotels", "input": { "bounds": { "max_lat": 1.4, "max_lon": 104.0, "min_lat": 1.2, "min_lon": 103.7 }, "check_in": "2030-06-10", "check_out": "2030-06-12", "currency": "USD", "destination": "Singapore", "guests": [ { "adults": 2, "children": 1, "children_ages": [ 5 ] } ], "locale": "en-US", "max_pages": 1, "sort": "price_low_to_high" }}),});if (!response.ok) { throw new Error(`Upscrape request failed: ${response.status}`);}console.log(JSON.stringify(await response.json(), null, 2));
Input
| Field | Type | Required | What it does | Example |
|---|---|---|---|---|
destination |
string | yes | Singapore | |
adults |
integer | no | Number of adult guests. From 0 to 20. | |
bounds |
object | no | Geographic bounds of the requested area. | {…} |
check_in |
string | no | Check-in date. | 2030-06-10 |
check_out |
string | no | Check-out date. | 2030-06-12 |
children |
integer | no | Number of child guests. From 0 to 20. | |
city_id |
string | no | City identifier. | |
currency |
string | no | Currency for returned prices. | USD |
guests |
array<object> | no | […] | |
locale |
string | no | Locale to use for the request. | en-US |
max_pages |
integer | no | Maximum number of result pages to fetch. From 1 to 5. | 1 |
page |
integer | no | One-based result page to fetch. From 1 to 100. | |
rooms |
integer | no | Number of rooms. From 1 to 10. | |
sort |
string | no | Sort order for returned results. Allowed values: relevance, price_low_to_high, price_high_to_low, rating_high_to_low, rating_low_to_high. |
price_low_to_high |
Response
A finished call answers with HTTP 200; the data is in results[0].data, and billing.credits_charged is what it cost. A call still running after the wait answers 202: see jobs and results.
This is results[0].data from a real run:
{ "end_page": 1, "has_more": false, "start_page": 1, "hotels": [ { "name": "Hotel Boss", "rating": 8, "review_count": 41763, "hotel_id": "1105091", "page": 1, "position": 1, "url": "https://www.agoda.com/hotel-boss/hotel/singapore-sg.html" }, { "name": "YOTEL Singapore Orchard Road", "rating": 8.8, "review_count": 36830, "hotel_id": "2256959", "page": 1, "position": 2, "url": "https://www.agoda.com/yotel-singapore-orchard-road/hotel/singapore-sg.html" } ]}
Fields
| Field | Type | Example |
|---|---|---|
hotels[].name |
string | Hotel Boss |
hotels[].rating |
integer | 8 |
hotels[].review_count |
integer | 41,763 |
hotels[].hotel_id |
string | 1105091 |
hotels[].page |
integer | 1 |
hotels[].position |
integer | 1 |
hotels[].url |
string | https://www.agoda.com/hotel-boss/hotel/singapore-sg.html |
end_page |
integer | 1 |
has_more |
boolean | false |
hotels |
array | 3 records |
start_page |
integer | 1 |
If a call fails
A failed call costs nothing. The response carries an error.code you can branch on; Errors and retries lists every code and which ones to retry.
Other Agoda Travel & Hotels endpoints
Something missing or unclear? Ask the team that builds the Agoda Travel & Hotels endpoints.