Tài liệu API Hop
Tham chiếu Google Hotels
Tìm khách sạn, gợi ý, ảnh và đánh giá trên Google Hotels.
Giới hạn đồng thời
AI và Data mỗi loại dùng chung một nhóm lượt đồng thời trên toàn tài khoản: mặc định 5 AI / 2 Data, tùy theo gói đăng ký. Giới hạn riêng của endpoint vẫn chịu giới hạn tổng của loại API. Khi đạt bất kỳ giới hạn nào, API trả về HTTP 429. Tác vụ bất đồng bộ giữ chỗ đến khi thực thi kết thúc.
GET /v1/google-hotels/search GET /v1/google-hotels/autocomplete GET /v1/google-hotels/photos GET /v1/google-hotels/reviews Tìm khách sạn, gợi ý, ảnh và đánh giá trên Google Hotels.
Xác thực và phí
Giá mặc định là $0.0003 (300 credits) cho mỗi yêu cầu thành công. Dùng khóa API API Hop. Quyền truy cập phụ thuộc cổng đang bật và quyền khóa. Xem danh mục và tài khoản để biết giá mỗi yêu cầu thành công; ưu tiên giá tài khoản. Kết quả rỗng thành công vẫn tính phí. Lỗi giải phóng khoản giữ trước. Hết hạn sau 60 giây, không tự thử lại hay phân trang. Lỗi quyết toán không gọi lại nhà cung cấp.
Authorization: Bearer YOUR_API_KEYGoogle Hotels: Tìm khách sạn
GET https://api.apihop.ai/v1/google-hotels/search
Tham số
| Trường | Kiểu | Giới hạn | Ví dụ |
|---|---|---|---|
query | string | Từ khóa tìm kiếm; query: optional | hotels in New York |
next_page_token | string | Mã trang tiếp theo; next_page_token: optional; UTF-8 bytes: 24576 | - |
currency | string | Mã tiền tệ (currency); currency: optional; ALL, DZD, ARS, AMD, AWG, AUD, AZN, BSD, BHD, BYN, BMD, BAM, BRL, GBP, BGN, XPF, CAD, CLP, CNY, COP, CRC, CUP, CZK, DKK, DOP, EGP, EUR, GEL, HKD, HUF, ISK, INR, IDR, IRR, ILS, JMD, JPY, JOD, KZT, KWD, LBP, MKD, MYR, MXN, MDL, MAD, TWD, NZD, NOK, OMR, PKR, PAB, PEN, PHP, PLN, QAR, RON, RUB, SAR, RSD, SGD, ZAR, KRW, SEK, CHF, THB, TRY, USD, UAH, AED, VND; ^[A-Z]{3}$ | USD |
country | string | Mã quốc gia hoặc cửa hàng (country); country: optional; ^[A-Za-z]{2}$ | - |
language | string | Ngôn ngữ; language: optional | - |
limit | integer | Giới hạn kết quả; limit: optional; min: 1; max: 100 | 1 |
device | string | Thiết bị; device: optional; desktop, mobile, tablet | desktop |
zero_trace | boolean | Không lưu trữ phản hồi; zero_trace: optional | true |
check_in_date | string | Ngày đi (YYYY-MM-DD) hoặc khoảng ngày được hỗ trợ (check_in_date); check_in_date: optional; ^[0-9]{4}-[0-9]{2}-[0-9]{2}$ | - |
check_out_date | string | Ngày đi (YYYY-MM-DD) hoặc khoảng ngày được hỗ trợ (check_out_date); check_out_date: optional; ^[0-9]{4}-[0-9]{2}-[0-9]{2}$ | - |
adults | integer | Số người lớn (adults); adults: optional; min: 1; max: 100 | 1 |
children | integer | Số trẻ em (children); children: optional; min: 0; max: 99 | 0 |
children_ages | string | Danh sách tuổi trẻ em (children_ages); Mặc định: 12; children_ages: optional; UTF-8 bytes: 296; ^(?:[1-9]|1[0-7])(?:,(?:[1-9]|1[0-7])){0,98}$ | - |
sort_by | string | Sắp xếp; sort_by: optional; relevance, lowest_price, highest_rating, most_reviewed | relevance |
min_price | integer | Giá tối thiểu (min_price); min_price: optional; min: 0; max: 2147483647 | 0 |
max_price | integer | Giá tối đa (max_price); max_price: optional; min: 1; max: 2147483647 | 1 |
rating | integer | Số sao, phân cách bằng dấu phẩy; 7 → 3.5+, 8 → 4.0+, 9 → 4.5+; rating: optional; 7, 8, 9 | 7 |
hotel_class | string | Bộ lọc chỗ ở (hotel_class); hotel_class: optional; UTF-8 bytes: 7 | - |
amenities | string | Bộ lọc chỗ ở (amenities); amenities: optional; UTF-8 bytes: 300; ^[1-9][0-9]*(?:,[1-9][0-9]*)*$ | - |
free_cancellation | boolean | Bộ lọc chỗ ở (free_cancellation); free_cancellation: optional | true |
special_offers | boolean | Bộ lọc chỗ ở (special_offers); special_offers: optional | true |
eco_certified | boolean | Bộ lọc chỗ ở (eco_certified); eco_certified: optional | true |
property_types | string | Bộ lọc chỗ ở (property_types); property_types: optional; UTF-8 bytes: 100; ^[1-9][0-9]*(?:,[1-9][0-9]*)*$ | - |
brands | string | Bộ lọc chỗ ở (brands); brands: optional; UTF-8 bytes: 300; ^[1-9][0-9]{0,5}(?:,[1-9][0-9]{0,5})*$ | - |
vacation_rentals | boolean | Bộ lọc chỗ ở (vacation_rentals); vacation_rentals: optional | true |
bedrooms | integer | Số phòng ngủ hoặc giường tối thiểu (bedrooms); bedrooms: optional; min: 0; max: 2147483647 | 0 |
bathrooms | integer | Số phòng tắm tối thiểu (bathrooms); bathrooms: optional; min: 0; max: 2147483647 | 0 |
property_token | string | Mã lựa chọn từ phản hồi mới nhất (property_token); property_token: optional; UTF-8 bytes: 256; ^[A-Za-z0-9_-]{16,256}$ | - |
Kiểm tra
Chỉ nhận tham số truy vấn, không có phần thân. Từ chối giá trị lạ, trùng lặp, trống hoặc không hợp lệ. Chỉ hỗ trợ JSON; không tự phân trang hay thử lại. Quy tắc: AND = cả hai, OR = hoặc, XOR = đúng một, NOT = loại trừ, => = yêu cầu.
GET query only; body = null; response = JSON; html, output, json_restrictor, no_cache: NOT supportedstring: UTF-8 bytes <= maxLength (default 8192); boolean = true OR false; integer: safe integerlanguage: /^[A-Za-z]{2,3}(?:[-_][A-Za-z]{2,4})?$/min_price <= max_pricecheck_in_date AND check_out_date: supply both or neither; valid YYYY-MM-DD dates; check_out_date > check_in_datequery OR property_token OR next_page_token: requiredadults (default 2) + children <= 100; children_ages: comma-separated ages 0..17; count = childrenbedrooms OR bathrooms => vacation_rentals = true; vacation_rentals = true => NOT brandsTokens: copy the exact token from a fresh response; do not invent or reuse expired tokens; each page or token lookup is a separate billable successful request
Ví dụ
curl --get "https://api.apihop.ai/v1/google-hotels/search" \
-H "Authorization: Bearer YOUR_API_KEY" \
--data-urlencode "currency=USD" \
--data-urlencode "query=hotels in New York"Google Hotels: Lấy gợi ý khách sạn
GET https://api.apihop.ai/v1/google-hotels/autocomplete
Tham số
| Trường | Kiểu | Giới hạn | Ví dụ |
|---|---|---|---|
query | string | Từ khóa tìm kiếm; query: REQUIRED | New York |
country | string | Mã quốc gia hoặc cửa hàng (country); country: optional; ^[A-Za-z]{2}$ | - |
language | string | Ngôn ngữ; language: optional | - |
limit | integer | Giới hạn kết quả; limit: optional; min: 1; max: 100 | 1 |
device | string | Thiết bị; device: optional; desktop, mobile, tablet | desktop |
zero_trace | boolean | Không lưu trữ phản hồi; zero_trace: optional | true |
currency | string | Mã tiền tệ (currency); currency: optional; ALL, DZD, ARS, AMD, AWG, AUD, AZN, BSD, BHD, BYN, BMD, BAM, BRL, GBP, BGN, XPF, CAD, CLP, CNY, COP, CRC, CUP, CZK, DKK, DOP, EGP, EUR, GEL, HKD, HUF, ISK, INR, IDR, IRR, ILS, JMD, JPY, JOD, KZT, KWD, LBP, MKD, MYR, MXN, MDL, MAD, TWD, NZD, NOK, OMR, PKR, PAB, PEN, PHP, PLN, QAR, RON, RUB, SAR, RSD, SGD, ZAR, KRW, SEK, CHF, THB, TRY, USD, UAH, AED, VND; ^[A-Z]{3}$ | ALL |
Kiểm tra
Chỉ nhận tham số truy vấn, không có phần thân. Từ chối giá trị lạ, trùng lặp, trống hoặc không hợp lệ. Chỉ hỗ trợ JSON; không tự phân trang hay thử lại. Quy tắc: AND = cả hai, OR = hoặc, XOR = đúng một, NOT = loại trừ, => = yêu cầu.
GET query only; body = null; response = JSON; html, output, json_restrictor, no_cache: NOT supportedstring: UTF-8 bytes <= maxLength (default 8192); boolean = true OR false; integer: safe integerlanguage: /^[A-Za-z]{2,3}(?:[-_][A-Za-z]{2,4})?$/
Ví dụ
curl --get "https://api.apihop.ai/v1/google-hotels/autocomplete" \
-H "Authorization: Bearer YOUR_API_KEY" \
--data-urlencode "query=New York"Google Hotels: Lấy ảnh khách sạn
GET https://api.apihop.ai/v1/google-hotels/photos
Tham số
| Trường | Kiểu | Giới hạn | Ví dụ |
|---|---|---|---|
id | string | Mã khách sạn từ kết quả tìm kiếm (id); id: REQUIRED | ChgI-N6n0Nnyw_K2ARoLL2cvMXRqZGgzMjkQAQ |
country | string | Mã quốc gia hoặc cửa hàng (country); country: optional; ^[A-Za-z]{2}$ | - |
language | string | Ngôn ngữ; language: optional | - |
limit | integer | Giới hạn kết quả; limit: optional; min: 1; max: 100 | 1 |
device | string | Thiết bị; device: optional; desktop, mobile, tablet | desktop |
zero_trace | boolean | Không lưu trữ phản hồi; zero_trace: optional | true |
next_page_token | string | Mã trang tiếp theo; next_page_token: optional; UTF-8 bytes: 24576 | - |
Kiểm tra
Chỉ nhận tham số truy vấn, không có phần thân. Từ chối giá trị lạ, trùng lặp, trống hoặc không hợp lệ. Chỉ hỗ trợ JSON; không tự phân trang hay thử lại. Quy tắc: AND = cả hai, OR = hoặc, XOR = đúng một, NOT = loại trừ, => = yêu cầu.
GET query only; body = null; response = JSON; html, output, json_restrictor, no_cache: NOT supportedstring: UTF-8 bytes <= maxLength (default 8192); boolean = true OR false; integer: safe integerlanguage: /^[A-Za-z]{2,3}(?:[-_][A-Za-z]{2,4})?$/Tokens: copy the exact token from a fresh response; do not invent or reuse expired tokens; each page or token lookup is a separate billable successful request
Ví dụ
curl --get "https://api.apihop.ai/v1/google-hotels/photos" \
-H "Authorization: Bearer YOUR_API_KEY" \
--data-urlencode "id=ChgI-N6n0Nnyw_K2ARoLL2cvMXRqZGgzMjkQAQ"Google Hotels: Lấy đánh giá khách sạn
GET https://api.apihop.ai/v1/google-hotels/reviews
Tham số
| Trường | Kiểu | Giới hạn | Ví dụ |
|---|---|---|---|
id | string | Mã khách sạn từ kết quả tìm kiếm (id); id: REQUIRED | ChgI-N6n0Nnyw_K2ARoLL2cvMXRqZGgzMjkQAQ |
next_page_token | string | Mã trang tiếp theo; next_page_token: optional; UTF-8 bytes: 24576 | - |
sort_by | string | Sắp xếp; sort_by: optional; relevance, newest, highest_rating, lowest_rating | relevance |
country | string | Mã quốc gia hoặc cửa hàng (country); country: optional; ^[A-Za-z]{2}$ | - |
language | string | Ngôn ngữ; language: optional | - |
limit | integer | Giới hạn kết quả; limit: optional; min: 1; max: 10 | 10 |
device | string | Thiết bị; device: optional; desktop, mobile, tablet | desktop |
zero_trace | boolean | Không lưu trữ phản hồi; zero_trace: optional | true |
category_token | string | Mã lựa chọn từ phản hồi mới nhất (category_token); category_token: optional; UTF-8 bytes: 2800; ^[A-Za-z0-9_-]+$ | - |
source_number | integer | Bộ lọc chỗ ở (source_number); source_number: optional; min: -1; max: 2147483647 | -1 |
Kiểm tra
Chỉ nhận tham số truy vấn, không có phần thân. Từ chối giá trị lạ, trùng lặp, trống hoặc không hợp lệ. Chỉ hỗ trợ JSON; không tự phân trang hay thử lại. Quy tắc: AND = cả hai, OR = hoặc, XOR = đúng một, NOT = loại trừ, => = yêu cầu.
GET query only; body = null; response = JSON; html, output, json_restrictor, no_cache: NOT supportedstring: UTF-8 bytes <= maxLength (default 8192); boolean = true OR false; integer: safe integerlanguage: /^[A-Za-z]{2,3}(?:[-_][A-Za-z]{2,4})?$/Tokens: copy the exact token from a fresh response; do not invent or reuse expired tokens; each page or token lookup is a separate billable successful request
Ví dụ
curl --get "https://api.apihop.ai/v1/google-hotels/reviews" \
-H "Authorization: Bearer YOUR_API_KEY" \
--data-urlencode "id=ChgI-N6n0Nnyw_K2ARoLL2cvMXRqZGgzMjkQAQ" \
--data-urlencode "limit=10"Phản hồi và lỗi
Giữ JSON gốc và độ chính xác. Ví dụ kết quả rỗng thành công. HTTP 400: đầu vào; 401: xác thực; 402: số dư; 403: quyền; 405: phương thức; 429: giới hạn; 5xx: dịch vụ. Giữ X-Request-Id.
{
"success": true,
"request_id": "example-request",
"data": {
"format": "json",
"content": {
"results": []
}
}
}