概述
API 提供对 Innvoria 中一个住宿数据的服务器到服务器访问。每个密钥只属于一个住宿;请求只能看到该住宿的数据。
API 在 Ultra 套餐中提供。密钥在面板的“管理 > API”中创建。
- 基础地址
https://innvoria.com/api/v1- 格式
- JSON, UTF-8
- 版本
- v1
- 从浏览器调用
- 不支持(无 CORS 许可);请从您的服务器发送请求。
快速入门
- 在面板的“管理 > API”中创建密钥并复制。密钥只显示一次。
- 在每个请求中加入“Authorization: Bearer KEY”请求头。
- 读取住宿信息以测试密钥:
curl https://innvoria.com/api/v1/property \
-H "Authorization: Bearer ivk_…"身份验证
密钥通过“Authorization: Bearer KEY”请求头发送。密钥以 ivk_ 开头。缺少密钥、密钥无效或已撤销时返回 401 unauthorized。
| 权限 | 允许的操作 |
|---|---|
仅读取 read | 所有 GET 端点。 |
读取 + 预订 write | 所有 GET 端点,以及创建和取消预订。 |
一个住宿最多可有 10 个有效密钥。撤销的密钥立即失效。密钥只保存在您的服务器上;切勿放入浏览器代码或公开代码库。
请求频率限制
每个密钥每分钟最多发送 120 个请求。超出时返回 429 rate_limited;Retry-After 请求头说明需等待的秒数。
响应格式
成功的响应包含“ok”: true 和“data”字段。列表端点还会在“meta”字段中返回分页信息。
出错时返回“ok”: false 和“error”对象:“code”为固定的错误代码,“message”为可读说明;与字段有关的错误还包含“field”。
{
"ok": false,
"error": {
"code": "invalid_parameter",
"message": "The \"arrival\" field must be a date in YYYY-MM-DD format.",
"field": "arrival"
}
}错误信息的语言取自 Accept-Language 请求头或 ?lang= 参数;支持 20 种语言,默认英语。您的软件应依据“code”字段,而不是信息内容。
错误代码
| 代码 | HTTP | 含义 |
|---|---|---|
unauthorized | 401 | 密钥缺失、无效或已撤销。 |
subscription_inactive | 402 | 住宿的订阅未激活。 |
plan_required | 403 | 住宿的套餐不包含 API(需要 Ultra)。 |
forbidden | 403 | 该密钥没有写入权限。 |
not_found | 404 | 未找到端点或预订。 |
method_not_allowed | 405 | 该端点不支持此 HTTP 方法。 |
invalid_body | 400 | 请求正文不是有效的 JSON 对象。 |
invalid_parameter | 422 | 某个字段缺失或无效;“field”指出是哪个字段。 |
no_availability | 409 | 所选日期没有空房,或该房型停售。 |
invalid_state | 409 | 该预订不允许此操作,例如客人已入住。 |
rate_limited | 429 | 超出每分钟请求上限;请按 Retry-After 所示时间等待。 |
busy | 503 | 同时收到的预订请求过多;请几秒后重试。 |
日期、时间和金额
- 日期格式为 YYYY-MM-DD。“departure”是退房日;晚数为“arrival”与“departure”之间相差的天数。
- 需要日期范围的端点中,“from”包含在内,“to”不包含(类似退房日);范围最多 366 晚。
- 日期时间字段使用住宿所在时区;时区见 /property 响应中的“timezone”字段。
- 金额为住宿币种(“currency”)的小数,含增值税。
接口
GET/property
设施信息:名称、货币、时区、入住和退房时间、营业日。
curl https://innvoria.com/api/v1/property \
-H "Authorization: Bearer ivk_…"{
"ok": true,
"data": {
"id": 12,
"name": "Hotel Am Hafen",
"currency": "EUR",
"timezone": "Europe/Istanbul",
"country": "DE",
"city": "Hamburg",
"check_in_time": "14:00",
"check_out_time": "12:00",
"business_date": "2026-12-05",
"api": {
"version": 1,
"scope": "read",
"rate_limit_per_minute": 120
}
}
}GET/room-types
房型:容量、基础价格、客房数量。
curl https://innvoria.com/api/v1/room-types \
-H "Authorization: Bearer ivk_…"{
"ok": true,
"data": [
{
"id": 1,
"code": "DLX",
"name": "Deluxe",
"description": "",
"base_occupancy": 2,
"max_adults": 3,
"max_children": 2,
"base_rate": 120,
"extra_adult": 35,
"extra_child": 15,
"rooms": 8
}
]
}GET/rooms
客房:房号、房型、楼层、清洁状态。
“housekeeping_status”的值:clean、dirty、inspected、out_of_order、out_of_service。
curl https://innvoria.com/api/v1/rooms \
-H "Authorization: Bearer ivk_…"{
"ok": true,
"data": [
{
"id": 7,
"number": "204",
"room_type_id": 1,
"floor": "2",
"housekeeping_status": "clean",
"features": ""
}
]
}GET/rate-plans
价格方案与餐食类型。
curl https://innvoria.com/api/v1/rate-plans \
-H "Authorization: Bearer ivk_…"{
"ok": true,
"data": {
"rate_plans": [
{
"id": 1,
"code": "STD",
"name": "Standard",
"is_default": true,
"discount_pct": 0,
"min_stay": 1,
"cancel_policy": ""
}
],
"boards": [
{
"id": 2,
"code": "BB",
"name": "Bed & breakfast",
"price_per_person": 12
}
]
}
}GET/availability
按房型逐日显示的空房数及停售日期(最多 366 天)。
参数
fromdate | 必填 | 第一晚。 |
todate | 必填 | 最后一晚的次日(不包含)。 |
room_type_idinteger | 可选 | 仅限此房型。 |
“available”是当晚可售的空房数;因维修关闭的房间已扣除。“closed”: true 表示该房型当晚停售。
curl "https://innvoria.com/api/v1/availability?from=2027-01-04&to=2027-01-06" \
-H "Authorization: Bearer ivk_…"{
"ok": true,
"data": [
{
"room_type_id": 1,
"name": "Deluxe",
"days": [
{
"date": "2027-01-04",
"available": 3,
"closed": false
},
{
"date": "2027-01-05",
"available": 0,
"closed": false
}
]
}
]
}GET/rates
每晚价格;可选 rate_plan_id、board_id、adults、children。
参数
fromdate | 必填 | 第一晚。 |
todate | 必填 | 最后一晚的次日(不包含)。 |
room_type_idinteger | 必填 | 房型。 |
rate_plan_idinteger | 可选 | 价格计划;其折扣会应用到价格上。未提供时返回不打折的价格。 |
board_idinteger | 可选 | 膳食类型;其每人价格会加到价格中。 |
adultsinteger | 可选 | 成人数;未提供时为房型的基础入住人数。 |
childreninteger | 可选 | 儿童数。 |
curl "https://innvoria.com/api/v1/rates?from=2027-01-04&to=2027-01-06&room_type_id=1&board_id=2&adults=2" \
-H "Authorization: Bearer ivk_…"{
"ok": true,
"data": {
"room_type_id": 1,
"rate_plan_id": null,
"board_id": 2,
"adults": 2,
"children": 0,
"currency": "EUR",
"nights": [
{
"date": "2027-01-04",
"price": 144,
"closed": false
},
{
"date": "2027-01-05",
"price": 144,
"closed": false
}
],
"total": 288
}
}GET/reservations
预订列表;from 和 to(时间重叠的住宿)、status、updated_since、page、per_page(最多 100)。
参数
from, todate | 可选 | 住宿期间与此范围重叠的预订。两个参数需一起发送。 |
statusstring | 可选 | 以逗号分隔的状态,例如 confirmed,option。 |
updated_sincedatetime | 可选 | 在此时间之后创建或修改的预订。 |
pageinteger | 可选 | 页码,从 1 开始。 |
per_pageinteger | 可选 | 每页记录数:默认 50,最多 100。 |
结果按创建顺序(id)排列。列表响应不含备注、取消原因和每晚价格;如需这些信息,请读取单个预订。
curl "https://innvoria.com/api/v1/reservations?updated_since=2026-12-05T08:00:00&per_page=100" \
-H "Authorization: Bearer ivk_…"{
"ok": true,
"data": [
{
"id": 1042,
"code": "R2611042",
"status": "confirmed",
"source": "api",
"channel_name": "Website",
"voucher": "WEB-58213",
"arrival": "2027-01-04",
"departure": "2027-01-06",
"nights": 2,
"eta": "15:30",
"adults": 2,
"children": 0,
"room_type": {
"id": 1,
"name": "Deluxe"
},
"room": null,
"rate_plan": {
"id": 1,
"name": "Standard"
},
"board": {
"id": 2,
"code": "BB",
"name": "Bed & breakfast"
},
"currency": "EUR",
"total_amount": 240,
"guest_name": "ADA YILMAZ",
"contact": {
"name": "ADA YILMAZ",
"email": "ada@example.com",
"phone": "+49 30 1234567"
},
"group_id": null,
"created_at": "2026-12-05 02:48:10",
"updated_at": null,
"cancelled_at": null
}
],
"meta": {
"page": 1,
"per_page": 100,
"total": 1,
"pages": 1
}
}GET/reservations/{code}
单条预订,含每晚及价格。
路径参数
codestring | 必填 | 预订代码。 |
curl https://innvoria.com/api/v1/reservations/R2611042 \
-H "Authorization: Bearer ivk_…"{
"ok": true,
"data": {
"id": 1042,
"code": "R2611042",
"status": "confirmed",
"source": "api",
"channel_name": "Website",
"voucher": "WEB-58213",
"arrival": "2027-01-04",
"departure": "2027-01-06",
"nights": 2,
"eta": "15:30",
"adults": 2,
"children": 0,
"room_type": {
"id": 1,
"name": "Deluxe"
},
"room": null,
"rate_plan": {
"id": 1,
"name": "Standard"
},
"board": {
"id": 2,
"code": "BB",
"name": "Bed & breakfast"
},
"currency": "EUR",
"total_amount": 240,
"guest_name": "ADA YILMAZ",
"contact": {
"name": "ADA YILMAZ",
"email": "ada@example.com",
"phone": "+49 30 1234567"
},
"group_id": null,
"created_at": "2026-12-05 02:48:10",
"updated_at": null,
"cancelled_at": null,
"note": "",
"cancel_reason": "",
"nightly": [
{
"date": "2027-01-04",
"price": 120
},
{
"date": "2027-01-05",
"price": 120
}
]
}
}POST/reservations
创建预订(写入权限)。请发送 Idempotency-Key 请求头,确保同一请求不会创建两条预订。
请求正文(JSON)
room_type_idinteger | 必填 | 房型。 |
arrivaldate | 必填 | 入住日期。 |
departuredate | 必填 | 退房日期。 |
adultsinteger | 可选 | 成人数;默认 1。 |
childreninteger | 可选 | 儿童数。 |
rate_plan_idinteger | 可选 | 价格计划。 |
board_idinteger | 可选 | 膳食类型;其每人价格会加到价格中。 |
guest.first_namestring | 必填 | 客人的名。 |
guest.last_namestring | 必填 | 客人的姓。 |
guest.emailstring | 可选 | 电子邮箱 |
guest.phonestring | 可选 | 电话 |
guest.nationalitystring | 可选 | 两位字母国家代码(ISO 3166-1),例如 DE。 |
statusstring | 可选 | confirmed(默认)或 option。 |
etastring | 可选 | 预计到达时间,HH:MM。 |
channel_namestring | 可选 | 预订来源渠道的名称;未提供时为密钥名称。 |
voucherstring | 可选 | 渠道的预订编号。 |
notestring | 可选 | 备注,最多 2000 个字符。 |
langstring | 可选 | 客人的语言,例如 en 或 de。 |
创建成功返回 201。价格由 Innvoria 按住宿的价格规则计算;房间在前台分配。
Idempotency-Key 请求头:最多 80 个字符的唯一值(例如您的订单号)。使用相同密钥和值的重复请求不会创建新预订,而是返回第一个预订,并带有“Idempotent-Replayed: true”请求头。
所选日期没有空房时返回 409 no_availability。同时到达的请求逐个处理,因此最后一间房不会被卖两次。
curl -X POST https://innvoria.com/api/v1/reservations \
-H "Authorization: Bearer ivk_…" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: order-58213" \
-d '{
"room_type_id": 1,
"arrival": "2027-01-04",
"departure": "2027-01-06",
"adults": 2,
"board_id": 2,
"voucher": "WEB-58213",
"guest": {"first_name": "Ada", "last_name": "Yilmaz", "email": "ada@example.com", "nationality": "DE"}
}'{
"ok": true,
"data": {
"id": 1042,
"code": "R2611042",
"status": "confirmed",
"source": "api",
"channel_name": "Website",
"voucher": "WEB-58213",
"arrival": "2027-01-04",
"departure": "2027-01-06",
"nights": 2,
"eta": "15:30",
"adults": 2,
"children": 0,
"room_type": {
"id": 1,
"name": "Deluxe"
},
"room": null,
"rate_plan": {
"id": 1,
"name": "Standard"
},
"board": {
"id": 2,
"code": "BB",
"name": "Bed & breakfast"
},
"currency": "EUR",
"total_amount": 240,
"guest_name": "ADA YILMAZ",
"contact": {
"name": "ADA YILMAZ",
"email": "ada@example.com",
"phone": "+49 30 1234567"
},
"group_id": null,
"created_at": "2026-12-05 02:48:10",
"updated_at": null,
"cancelled_at": null,
"note": "",
"cancel_reason": "",
"nightly": [
{
"date": "2027-01-04",
"price": 120
},
{
"date": "2027-01-05",
"price": 120
}
]
}
}POST/reservations/{code}/cancel
取消客人尚未入住的预订(写入权限);reason 可选。
请求正文(JSON)
reasonstring | 可选 | 取消原因,最多 200 个字符。 |
只有状态为 option 或 confirmed 的预订可以取消;否则返回 409 invalid_state。已取消的预订返回相同的响应,因此请求可以安全重复。
curl -X POST https://innvoria.com/api/v1/reservations/R2611042/cancel \
-H "Authorization: Bearer ivk_…" \
-H "Content-Type: application/json" \
-d '{"reason": "Guest request"}'{
"ok": true,
"data": {
"id": 1042,
"code": "R2611042",
"status": "cancelled",
"source": "api",
"channel_name": "Website",
"voucher": "WEB-58213",
"arrival": "2027-01-04",
"departure": "2027-01-06",
"nights": 2,
"eta": "15:30",
"adults": 2,
"children": 0,
"room_type": {
"id": 1,
"name": "Deluxe"
},
"room": null,
"rate_plan": {
"id": 1,
"name": "Standard"
},
"board": {
"id": 2,
"code": "BB",
"name": "Bed & breakfast"
},
"currency": "EUR",
"total_amount": 240,
"guest_name": "ADA YILMAZ",
"contact": {
"name": "ADA YILMAZ",
"email": "ada@example.com",
"phone": "+49 30 1234567"
},
"group_id": null,
"created_at": "2026-12-05 02:48:10",
"updated_at": "2026-12-05 02:48:10",
"cancelled_at": "2026-12-05 02:48:10",
"note": "",
"cancel_reason": "API: Guest request",
"nightly": [
{
"date": "2027-01-04",
"price": 120
},
{
"date": "2027-01-05",
"price": 120
}
]
}
}预订对象
预订端点返回以下字段。
| 字段 | 说明 |
|---|---|
idinteger | 唯一编号。 |
codestring | 预订代码,与面板中和客人看到的一致。 |
statusstring | option、confirmed、checked_in、checked_out、cancelled 或 no_show。 |
sourcestring | 预订来源;通过 API 创建的预订为 api。 |
channel_namestring | 渠道或代理商名称。 |
voucherstring | 渠道的预订编号。 |
arrivaldate | 入住日期。 |
departuredate | 退房日期。 |
nightsinteger | 晚数。 |
etastring|null | 预计到达时间,HH:MM。 |
adultsinteger | 成人数。 |
childreninteger | 儿童数。 |
room_typeobject | 房型:id、name。 |
roomobject|null | 已分配的房间:id、number。未分配房间时为 null。 |
rate_planobject|null | 价格计划:id、name。 |
boardobject|null | 膳食类型:id、code、name。 |
currencystring | 币种(ISO 4217)。 |
total_amountnumber | 预订金额。 |
guest_namestring | 主客人姓名。 |
contactobject | 联系方式:name、email、phone。 |
group_idinteger|null | 团体预订时为团体编号。 |
created_atdatetime | 创建时间。 |
updated_atdatetime|null | 最后修改时间。 |
cancelled_atdatetime|null | 取消时间。 |
notestring | 备注。 仅在单个预订、创建和取消的响应中提供。 |
cancel_reasonstring | 取消原因。 仅在单个预订、创建和取消的响应中提供。 |
nightlyarray | 每晚价格:date、price。 仅在单个预订、创建和取消的响应中提供。 |
建议的同步方式
目前没有即时通知(webhook)。要获取更改,请定期使用 updated_since 查询 /reservations 端点,并保存上次成功查询的时间。
近期日期的房态读取得频繁些,远期日期少些;将请求分散在时间上,以免超出每分钟上限。
支持
如有问题,请发送邮件至 info@innvoria.com。