Help Phuket
Русская версия

HelpPhuket

HelpPhuket Partner API

One way to send us your listings, prices and available dates, and to receive booking requests from us. Version v1. Every address starts with https://<your partner account host>/partner-api/v1.

Русская версия: Русская версия. Machine-readable description: openapi.yaml.

In short

  1. Register in the partner account and issue a key in the “API” section.
  2. Sign every request (see “Request signature”). A working Python example is below; it runs as is.
  3. Create listings: PUT /listings/{external_id}.
  4. Upload the calendar: PUT /listings/{external_id}/calendar — and update it whenever something changes on your side.
  5. Answer booking requests: GET /booking-requests, then confirm or decline. If you have not connected the API for answers, a request can be confirmed with a button in the partner account.

What we never send

Registration and key

  1. Open the invitation link from your manager and register your company in the partner account.
  2. In the account open the “API” section and press “Issue a key”. A key is a pair:
  1. Up to five keys can be active at once, which lets you rotate a key without downtime. Revocation is immediate.
  2. The same “API” section holds the webhook address and your working hours, and shows the log of recent requests with response codes (without request bodies).

The currency of your prices, the booking request answer deadline and the calendar freshness threshold are set by your manager when you are connected.

Request signature

Every request carries four headers:

HeaderValue
X-HP-Keythe key_id of your key
X-HP-Timestampcurrent time in UTC, ISO 8601: 2026-11-25T10:00:00Z
X-HP-Noncea one-time value: 16–64 characters of A-Z a-z 0-9 _ -, new for every request
X-HP-SignatureHMAC-SHA256 of the string to sign, lowercase hex

Exact content of the string to sign

Five parts joined with the line feed character \n (one byte 0x0A), in exactly this order:

METHOD \n PATH_WITH_QUERY \n TIMESTAMP \n NONCE \n RAW_BODY
  1. Method — upper case: GET, PUT, POST.
  2. Path with the query string — exactly as sent in the request, without scheme and host, including ? and the parameters when present: /partner-api/v1/listings?limit=2. No parameters — no ?.
  3. Timestamp — the same value as in the X-HP-Timestamp header.
  4. Nonce — the same value as in the X-HP-Nonce header.
  5. Raw body — the request body bytes exactly as sent (not re-formatted JSON). An empty body is an empty string: the string to sign then ends with the \n after the nonce.

The HMAC key is the whole secret as text, including the hps_ prefix.

Verification rules:

If you get a 401

Do not repeat the request blindly: a repeat without a fix gets the same refusal and uses up the rate limit.

Control example

Check your implementation: with this input the signature must match to the last character.

secret:    hps_ZXhhbXBsZS1zZWNyZXQtZG8tbm90LXVzZS1pbi1wcm8
method:    PUT
path:      /partner-api/v1/listings/villa-12/calendar
timestamp: 2026-11-25T10:00:00Z
nonce:     b1946ac92492d2347c6235b4d2611184
body:      {"currency":"THB","days":[{"date":"2027-01-15","available":true,"rates":{"night":450000},"min_stay":{"value":2,"unit":"night"}}]}
signature: 218daed5f0a24007339833ef8524eebd573d641cea472dbad1ff3ceca2559e6e

The same secret, a request without a body (the string to sign ends with a line feed after the nonce):

secret:    hps_ZXhhbXBsZS1zZWNyZXQtZG8tbm90LXVzZS1pbi1wcm8
method:    GET
path:      /partner-api/v1/listings?limit=2
timestamp: 2026-11-25T10:00:00Z
nonce:     b1946ac92492d2347c6235b4d2611184
body:
signature: 9dedb07a9bea6b0975a457bf63b3fb5a152af3acff900c8a51bd5677dd682ac4

The secret in the example is for training only; it does not work on any server.

Example: curl and openssl

#!/usr/bin/env bash
# Environment variables: HP_BASE_URL (https://<your partner account host>), HP_KEY_ID, HP_SECRET.
set -euo pipefail
hp_request() {
  local method="$1" path="$2" body="${3:-}"
  local ts nonce sig
  ts="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
  nonce="$(openssl rand -hex 16)"
  sig="$(printf '%s\n%s\n%s\n%s\n%s' "$method" "$path" "$ts" "$nonce" "$body" \
        | openssl dgst -sha256 -hmac "$HP_SECRET" -r | cut -d' ' -f1)"
  local args=(-sS -X "$method" "$HP_BASE_URL$path"
    -H "X-HP-Key: $HP_KEY_ID" -H "X-HP-Timestamp: $ts" -H "X-HP-Nonce: $nonce" -H "X-HP-Signature: $sig")
  if [ -n "$body" ]; then args+=(-H "Content-Type: application/json" --data-binary "$body"); fi
  curl "${args[@]}"
}

hp_request GET "/partner-api/v1/listings?limit=2"
hp_request PUT "/partner-api/v1/listings/villa-12" \
  '{"kind":"housing","title":"Villa by the sea","type":"villa","city":"Phuket","district":"Rawai","capacity":6,"bedrooms":3}'

Example: Python without third-party libraries

#!/usr/bin/env python3
"""Partner API client example. Needs the environment variables HP_BASE_URL, HP_KEY_ID, HP_SECRET."""
import datetime
import hashlib
import hmac
import json
import os
import secrets
import urllib.error
import urllib.request

BASE_URL = os.environ["HP_BASE_URL"].rstrip("/")  # https://<your partner account host>
KEY_ID = os.environ["HP_KEY_ID"]
SECRET = os.environ["HP_SECRET"]


def call(method, path, payload=None, idempotency_key=None):
    """Signs and sends a request. path includes the query string when there is one."""
    body = b"" if payload is None else json.dumps(payload, ensure_ascii=False).encode("utf-8")
    timestamp = datetime.datetime.now(datetime.timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
    nonce = secrets.token_hex(16)
    to_sign = b"\n".join([method.encode(), path.encode(), timestamp.encode(), nonce.encode(), body])
    signature = hmac.new(SECRET.encode(), to_sign, hashlib.sha256).hexdigest()
    headers = {
        "X-HP-Key": KEY_ID,
        "X-HP-Timestamp": timestamp,
        "X-HP-Nonce": nonce,
        "X-HP-Signature": signature,
    }
    if body:
        headers["Content-Type"] = "application/json"
    if idempotency_key:
        headers["Idempotency-Key"] = idempotency_key
    request = urllib.request.Request(BASE_URL + path, data=body or None, method=method, headers=headers)
    try:
        with urllib.request.urlopen(request, timeout=30) as response:
            return response.status, json.loads(response.read() or b"null")
    except urllib.error.HTTPError as error:
        return error.code, json.loads(error.read() or b"null")


if __name__ == "__main__":
    tomorrow = datetime.date.today() + datetime.timedelta(days=1)
    week = tomorrow + datetime.timedelta(days=6)

    status, listing = call("PUT", "/partner-api/v1/listings/villa-12", {
        "kind": "housing", "title": "Villa by the sea", "type": "villa",
        "city": "Phuket", "district": "Rawai", "capacity": 6, "bedrooms": 3,
    }, idempotency_key="villa-12-create-" + secrets.token_hex(4))
    print("listing", status, listing.get("review", {}).get("status"))

    status, result = call("PUT", "/partner-api/v1/listings/villa-12/calendar", {
        "currency": "THB",
        "days": [{
            "from": tomorrow.isoformat(), "to": week.isoformat(), "available": True,
            "rates": {"night": 450000, "month": 9000000},
            "min_stay": {"value": 2, "unit": "night"},
        }],
    })
    print("calendar", status, result.get("days"))

    status, page = call("GET", "/partner-api/v1/listings?limit=2")
    print("listings", status, len(page["items"]))

    status, page = call("GET", "/partner-api/v1/booking-requests?status=pending")
    print("requests", status, len(page["items"]))

General rules

Pagination

Lists (GET /listings, GET /booking-requests) are returned page by page:

Response: {"items": [...], "next_cursor": "…"}. next_cursor: null means the last page. The cursor is an opaque string: do not parse or build it yourself.

Repeating a request: Idempotency-Key

For requests that modify data (PUT, POST) you may send the Idempotency-Key header — 8–128 characters of A-Z a-z 0-9 _ . : -. If the connection broke and you do not know whether the request arrived, repeat it with the same key and the same body (the signature, timestamp and nonce are new):

Limits

WhatLimit
Request body size1 MB (413 body_too_large)
Rate120 requests per minute per key, the window is a minute from the first request (429 rate_limited, Retry-After header in seconds). In addition, no more than 240 requests per minute from one address
Timestamp window±5 minutes
Nonce memory24 hours
Idempotency-Key lifetime24 hours
Days in one calendar request731 (after ranges are expanded)
days entries in one request800
Length of one {from, to} range730 days
Calendar horizon730 days from the current date in the listing's time zone
Photos per listing30 links, up to 20 MB each
List page sizeup to 100
Active keys5

Which responses to retry

Listings

PUT /listings/{external_id} — create or update

external_id is the listing identifier in your system: 1–64 characters of A-Z a-z 0-9 _ . : -. You use it to address the listing afterwards.

{
  "kind": "housing",
  "title": "Villa by the sea",
  "type": "villa",
  "description": "Three bedrooms, a pool, 400 m to the beach",
  "city": "Phuket",
  "district": "Rawai",
  "capacity": 6,
  "bedrooms": 3,
  "bathrooms": 2,
  "amenities": ["pool", "wifi", "air_conditioning"],
  "address": "59/12 Moo 6, Soi Saiyuan",
  "photos": ["https://cdn.example.com/villa-12/1.jpg", "https://cdn.example.com/villa-12/2.jpg"]
}
FieldRequiredMeaning
kindyeshousing or transport. Cannot be changed once the listing exists
titleyesName, up to 200 characters
typeyesHousing: apartment, house, villa, condo, townhouse, studio, land. Transport: car, suv, pickup, van, minivan, scooter, motorbike
cityyesCity
districtnoDistrict
descriptionnoDescription
capacitynoCapacity: guests (housing) or seats (transport)
bedrooms, bathroomsnoHousing only
amenitiesnoAmenity codes from our dictionary; an unknown code gives 422 invalid_amenity. Your manager provides the list of codes
addressnoInternal address: our manager needs it; it is never shared externally or returned by the API
photosnohttps:// links to photos. We download them ourselves and strip the metadata (EXIF, shooting location)

What happens next:

The response is the listing card (201 on creation, 200 on update):

{
  "external_id": "villa-12",
  "kind": "housing",
  "title": "Villa by the sea",
  "type": "villa",
  "description": "Three bedrooms, a pool, 400 m to the beach",
  "city": "Phuket",
  "district": "Rawai",
  "capacity": 6,
  "bedrooms": 3,
  "bathrooms": 2,
  "amenities": ["air_conditioning", "pool", "wifi"],
  "review": {"status": "review", "comment": "", "change_pending": false},
  "photos": [{"url": "https://cdn.example.com/villa-12/1.jpg", "status": "pending", "error": null}],
  "calendar": {"synced_at": null, "stale": true},
  "created_at": "2026-11-25T10:00:00Z"
}

review.status: review — in review, accepted — accepted, returned — returned with a comment (review.comment), draft — a draft from the account. photos[].status: pending — queued, done — accepted, failed — not accepted (error: not_image, too_large, blocked, http_404 and so on).

GET /listings and GET /listings/{external_id}

What we hold and the review state. The list is paginated, ordered by external_id.

{"items": [{"external_id": "villa-12", "kind": "housing", "title": "Villa by the sea", "...": "..."}], "next_cursor": null}

Calendar of prices and available dates

PUT /listings/{external_id}/calendar

{
  "currency": "THB",
  "timezone": "Asia/Bangkok",
  "replace_all": false,
  "days": [
    {"date": "2027-01-15", "available": true, "rates": {"night": 450000}, "min_stay": {"value": 2, "unit": "night"}},
    {"from": "2027-01-16", "to": "2027-01-31", "available": true, "rates": {"night": 450000, "month": 9000000}},
    {"from": "2027-02-01", "to": "2027-02-05", "available": false}
  ]
}
FieldMeaning
currencyCurrency of your prices, three letters. Must match the currency set when you were connected, otherwise 422 currency_mismatch
timezoneOptional. The time zone in which “today” is computed; defaults to the listing's zone
replace_allOptional, default false. See the rules below
days[]Entries: one day {"date": …} or a range {"from": …, "to": …} (both dates inclusive)
days[].availabletrue — the day is free, false — it is taken
days[].ratesYour prices by rental period, any set of night, month, year
days[].min_stayMinimum term: {"value": 3, "unit": "night"} or {"value": 2, "unit": "month"}. Default is one night

Day. For housing a day is the night starting on that day. If the night from the 15th to the 16th is taken, the day of the 15th is taken; a guest leaving and the next guest arriving on the same day do not conflict. For transport a day is 24 hours in the listing's time zone.

Currency and time zone. One currency for all your listings; it is set when you are connected. Amounts are in its minor units: for the baht and the dollar these are hundredths (450000 = 4,500.00), for currencies without a fractional part (for example yen) — the unit itself. The listing's time zone defaults to Asia/Bangkok; it is not set or returned through the API, so if your listing is in another zone, send timezone with every upload. Booking request dates (check_in, check_out) are calendar days in the listing's zone.

Our bookings and your calendar. Your upload changes only your calendar with us — it does not touch our bookings. A day taken by our booking (including one created by your confirmation) stays taken on our side even if you send available: true; it is not offered to guests. GET …/calendar shows only what you sent: our bookings are not in it. You learn about bookings created by your confirmations from requests in the confirmed state (GET /booking-requests?status=confirmed); after confirming, mark the days as taken on your side and send them in the calendar.

Rates. night is your price per night (per 24 hours for transport), month — per calendar month, year — per year. Send the periods you actually rent by. A period missing from the set means the listing is not rented by that period. A listing may be long-term only: send just month and/or year.

Response 200:

{"snapshot_id": "0b6f…", "mode": "merge", "days": 22, "from": "2027-01-15", "to": "2027-02-05", "synced_at": "2026-11-25T10:00:00Z"}

Every upload is stored as a separate immutable snapshot; the latest one is in effect.

Three examples

One day:

{"currency": "THB", "days": [{"date": "2027-01-15", "available": false}]}

A range:

{"currency": "THB", "days": [{"from": "2027-03-01", "to": "2027-03-31", "available": true, "rates": {"night": 520000, "month": 11000000}, "min_stay": {"value": 3, "unit": "night"}}]}

Full replacement:

{"currency": "THB", "replace_all": true, "days": [
  {"from": "2027-01-01", "to": "2027-01-20", "available": true, "rates": {"night": 450000}},
  {"from": "2027-01-25", "to": "2027-01-31", "available": false}
]}

After the third request January 21–24 are “no data”: the listing is not offered for terms that cross those days.

Eight calendar rules

  1. Ordinary upload (replace_all omitted or false): the entry of every day you send is replaced as a whole — rates and the minimum term come only from the new entry, nothing is kept from the previous one. Days you did not send are not touched.
  2. replace_all: true replaces everything from the earliest to the latest date you sent. A day inside that span without an entry becomes “no data” (state: "no_data") and is not offered. Days outside the span are not touched.
  3. rates is required for a free day (available: true) — at least one rate, otherwise 422 rates_required. For a taken day (available: false) it is not needed and is not stored.
  4. The nightly price is computed by the rate of each night: nights with different prices are summed. Monthly and yearly prices use the rate of the first day of the term: if the rate changes inside the term, the one on the arrival day applies.
  5. A month is a calendar month: from the 15th to the 15th (from January 31 — to the last day of February). A term that is not a whole number of months is computed as whole months from the start plus the remainder by nights — if the remainder nights have a nightly rate. If they do not, the listing is not offered for such a term. The same with a year: a year, then months, then nights. Of the combinations your rates allow, the least expensive one is taken; with equal sums — the one with larger periods.
  6. Listing freshness is the time of the last successful upload of its calendar, any upload: full or a single day. If the calendar has not been updated for longer than the threshold (48 hours by default, set for you by the manager), the listing is marked “data is outdated” and is not offered until you send a new upload. If nothing changed on your side, send an upload of at least one day.
  7. 409 dates_conflict on confirmation means one thing only: the dates are taken in our calendar. We do not check or know your actual occupancy. Before confirm, check on your side that the listing is really free for those dates: a confirmation creates a booking even if your calendar with us already marks that day as taken.
  8. The time allowed to answer a booking request is counted in elapsed hours (2 hours by default). A request that arrives outside your working hours starts counting from the beginning of your working day: with hours 09:00–18:00 a request at 20:00 expires at 11:00 the next day; a request at 07:00 expires at 11:00 the same day. You set the working hours and time zone in the account, “API” section. No hours set — the deadline runs from the request time.

Calculation example for rules 4–5 with "rates": {"night": 1000, "month": 20000, "year": 200000} on every day:

TermHow it is computedSum
3 nights3 × night3,000
March 15 to April 151 month20,000
March 15 to April 201 month + 5 nights25,000
March 15 to April 4 (20 nights)not a full month: 20 × night20,000
12 months1 year (cheaper than twelve months)200,000
13 months and 2 nightsyear + month + 2 nights222,000

A month from the end of a month: January 31 to February 28 is exactly one month (20,000); January 31 to March 3 is the same month plus three remainder nights (February 28, March 1 and 2) — 23,000.

Without a nightly rate ({"month": 20000}) the term “a month and 5 nights” would not be offered at all.

The minimum term is taken from the entry of the arrival day: {"value": 3, "unit": "night"} — at least three nights, {"value": 2, "unit": "month"} — at least two calendar months.

GET /listings/{external_id}/calendar?from=&to=

What we hold. from and to are YYYY-MM-DD (inclusive), default is 90 days from today; no more than 731 days.

{
  "external_id": "villa-12",
  "currency": "THB",
  "from": "2027-01-15",
  "to": "2027-01-17",
  "synced_at": "2026-11-25T10:00:00Z",
  "stale": false,
  "days": [
    {"date": "2027-01-15", "state": "free", "available": true, "rates": {"night": 450000}, "min_stay": {"value": 2, "unit": "night"}},
    {"date": "2027-01-16", "state": "busy", "available": false},
    {"date": "2027-01-17", "state": "no_data", "available": false}
  ]
}

Days you have never sent are absent from the response.

Booking requests

When our manager needs your listing for a guest's dates, a request is sent to you. Until you answer, nothing is promised to the guest. States: pending — waiting for an answer, confirmed, declined, expired — the answer deadline has passed (the dates can be requested again).

GET /booking-requests?status= and GET /booking-requests/{id}

status is optional: pending, confirmed, declined, expired. The list is paginated, newest first.

{
  "items": [{
    "id": "4c1d0a3e-5f1b-4b53-9a51-0f2f6f8f4a11",
    "number": "BR-000128",
    "listing": {"external_id": "villa-12", "kind": "housing", "title": "Villa by the sea"},
    "check_in": "2027-01-15",
    "check_out": "2027-01-20",
    "nights": 5,
    "guests": 4,
    "status": "pending",
    "your_price": {"amount_minor": 2250000, "currency": "THB"},
    "requested_at": "2026-11-25T10:00:00Z",
    "respond_by": "2026-11-25T12:00:00Z",
    "responded_at": null
  }],
  "next_cursor": null
}

your_price is your price for the requested term, computed from your calendar (rules 4–5). null if the listing has no calendar.

POST /booking-requests/{id}/confirm

Empty body. Response 200 — the request is confirmed. From this moment the dates are taken on our side.

Always send Idempotency-Key with confirm and decline. If the response was lost, repeat the request with the same key — you get the same response as the first time. Without a key a repeat gives 409 already_answered, and its body has the status field — the current state of the request (confirmed — your confirmation has been accepted, declined, expired); the same is visible in GET /booking-requests/{id} (status, responded_at). Only your account answers a request — through the API or with the button in the partner account.

POST /booking-requests/{id}/decline

{"reason": "dates_taken"}

The reason field is required: without it, or with a reason that is not in the list — 422 invalid_reason. In the response and later in the request the reason is shown in the decline_reason field.

Reasons: dates_taken, price_changed, not_available — the listing is not rented, maintenance — repair or maintenance, other.

Webhook booking.requested

Optional: set an address in the account (“API” section) and we will send new booking requests to it.

Error codes

HTTPCodeMeaning
400bad_nonceThe nonce has a wrong format
400bad_idempotency_keyIdempotency-Key has a wrong format
400bad_external_idThe listing identifier has a wrong format
400bad_limit, bad_cursor, bad_status, bad_periodA query parameter has a wrong format
401bad_signatureSignature not accepted: wrong signature, unknown or revoked key
401stale_timestampTimestamp outside the 5-minute window or not ISO 8601 UTC
401replayed_nonceThe nonce has already been used
404not_foundNo such listing or request (or it is not yours)
409kind_disabledThe line of business is not enabled in your profile
409kind_mismatchThe listing with this identifier has another kind
409no_managerNo manager is assigned to you yet
409change_pendingThe previous change of an accepted listing is still in review
409dates_conflictThe dates are taken in our calendar, no booking is created
409expiredThe answer deadline has passed
409already_answeredThe request already has an answer; the status field says which
413body_too_largeThe body is larger than 1 MB
422invalid_jsonThe body cannot be parsed or has an unknown field
422invalid_kind, invalid_fields, invalid_amenity, invalid_photo_url, too_many_photosAn error in listing fields
422invalid_currency, currency_mismatch, invalid_timezoneAn error in the calendar currency or time zone
422days_required, available_required, invalid_date, duplicate_dateAn error in days entries (the index field is the entry number from zero)
422rates_required, invalid_rate, invalid_min_stayAn error in rates or the minimum term
422past_date, too_far, range_too_long, too_many_daysA day in the past, beyond 730 days, a range longer than 730 days, more than 731 days in a request
422invalid_reasonThe decline reason is not from the list
422idempotency_mismatchIdempotency-Key has already been used with another request
429rate_limitedToo many requests; retry after Retry-After seconds
500, 502, 504—A failure on our side: retry later with the same Idempotency-Key
503partner_api_disabledThe API is temporarily switched off on our side