API reference

HTS APIs

Every endpoint, schema and error code, rendered from the published OpenAPI files, in the order you integrate them.

PUT/api/lodging/v1/catalogCatalog

Get catalog of lodging changes

https://travel-distribution.staging.htsapis.com/api/lodging/v1/catalog

Retrieve a catalog of lodging IDs that have been added, updated, or delisted since a given timestamp.

This endpoint supports pagination through two request types:

Initial Request:

  • Specify a starting timestamp (after), event type (event_type), and page size
  • Returns the first page of lodging IDs matching the criteria
  • If more results are available, the response includes a next_cursor
  • The total_results field indicates the total number of lodgings at the time of the initial request

Follow-up Request:

  • Use the cursor from a previous response (send the value of next_cursor) to fetch the next page
  • Continue making follow-up requests until next_cursor is null/empty
  • Each response returns the next batch of lodging IDs

Data Consistency Guarantees

Live Data and Concurrent Changes:

The catalog endpoint returns a live view of lodging changes, which has important implications for data consistency:

  • Changes During Pagination: While you are paginating through results for a specific event_type, lodgings may undergo changes (added, updated, or delisted) in real-time. If a lodging experiences a change that matches your query criteria during the pagination process, it will be automatically appended to the result set and returned in subsequent pages.

  • Dynamic Total Count: The total_results value from the initial response represents the count at that moment. As new matching changes occur during pagination, the actual number of results returned across all pages may exceed this initial count. Always continue paginating until next_cursor is null rather than relying on total_results to determine when to stop.

Consistency and Replay Guarantees:

The catalog endpoint provides the following guarantees for reliable change tracking:

  • Completeness Guarantee: You will never miss a change. Any lodging that experienced a matching change at or after your after timestamp will eventually be returned, even if the change occurred while you were paginating through results.

  • Monotonic Consistency: Using the same after timestamp in multiple requests will always return at least the same set of changes. If new changes occurred between requests, the result set will grow to include them. This allows safe replay without data loss.

  • Safe Retries and Catch-Up: If you need to restart your synchronization process from a specific timestamp, you can safely reuse the same after value. This ensures complete change coverage without gaps. Implement deduplication in your client to handle lodgings that may appear in multiple synchronization runs.

  • Ordering Guarantee: Changes are always returned in ascending order by their change timestamp, ensuring predictable and consistent ordering across all pagination sessions and replay attempts.

Complete Change Synchronization

IMPORTANT: To obtain a complete snapshot of all catalog changes since a given timestamp, you must poll all three event types separately.

Required Polling Cycles:

The catalog endpoint filters changes by a single event_type per request. To retrieve all changes that occurred after your after timestamp, you must perform three independent polling cycles:

  1. Poll for Added Lodgings:

    • Set event_type=added and your desired after timestamp
    • Paginate through all pages until next_cursor is null
    • Collect all lodging IDs that were newly added to the catalog
  2. Poll for Updated Lodgings:

    • Set event_type=updated and the same after timestamp
    • Paginate through all pages until next_cursor is null
    • Collect all lodging IDs that had content or metadata updates
  3. Poll for Delisted Lodgings:

    • Set event_type=delisted and the same after timestamp
    • Paginate through all pages until next_cursor is null
    • Collect all lodging IDs that were removed from the catalog

Synchronization Pattern:

timestamp = get_last_sync_timestamp()

// Poll all three event types with the same timestamp
added_response = poll_all_pages(after=timestamp, event_type="added")
updated_response = poll_all_pages(after=timestamp, event_type="updated")
delisted_response = poll_all_pages(after=timestamp, event_type="delisted")

// Now you have a complete snapshot of all changes
apply_changes(added_response.lodging_ids, updated_response.lodging_ids, delisted_response.lodging_ids)

// Use next_after from any of the responses for your next sync cycle
// All three responses will have the same or very similar next_after values
save_last_sync_timestamp(added_response.next_after)

Understanding next_after vs next_cursor:

  • next_cursor: Used for pagination within a single poll cycle for one event type. When present, make another request with this token as the cursor to get the next page of results for the same event type. Continue until next_cursor is null.

  • next_after: Indicates the timestamp to use for your next synchronization cycle across all event types. This field is always present in every response. After completing pagination for all three event types (added, updated, delisted), use the next_after value from the final page as your new after timestamp for the next complete synchronization cycle.

Only after completing all three event type polls will you have a complete and accurate view of all catalog changes that occurred since your after timestamp.

Integration Best Practices

  • Persistence: Always persist the next_after timestamp from your last completed synchronization cycle. This ensures you can resume from the correct point if your synchronization process is interrupted.

  • Event Type Processing: You can execute the three event type polls (added, updated, delisted) either in parallel or sequentially. While uncommon, a single lodging may appear in multiple event types if it underwent multiple state changes during the polling window (e.g., a lodging could be added, then updated, then delisted). This is an edge case but possible. Sequential processing (added → updated → delisted) may be preferable if maintaining temporal ordering is important for your application. Parallel execution can minimize synchronization time if you plan to fetch the latest content for each lodging ID regardless of the event type order.

  • Continuation Point: After completing all pagination for all three event types, use the next_after value from any of the final responses as your after timestamp for the next synchronization cycle.

  • Deduplication: Implement deduplication logic in your client to handle lodgings that may appear in multiple event types within the same synchronization cycle, or in multiple synchronization runs due to concurrent changes occurring during pagination.

  • Monitoring: Monitor the difference between total_results and actual results received to detect high-velocity change periods that may require more frequent synchronization.

Request body application/json · required

Catalog query criteria - either initial selection with timestamp and filters, or follow-up selection with cursor

Exactly one of the following, selected by type:
initial (catalog_request_initial) catalog_request_initial
request_id
string · uuid
required

Unique value used to identify this request. If provided to us during operational questions, it will help us provide better support.

Example 123e4567-e89b-12d3-a456-426614174000
type
string enum
required

Discriminator value for initial catalog request

Values initial · Example initial
after
string · date-time
required

Return catalog changes that occurred after this timestamp (ISO 8601 format)

Example 2025-01-01T00:00:00Z
event_type
string enum
required

Type of catalog event for filtering lodging changes

Values addedupdateddelisted · Example added
page_size
integer
required

Number of results per page

Range ≥ 1, ≤ 200 · Example 10
follow_up (catalog_request_follow_up) catalog_request_follow_up
request_id
string · uuid
required

Unique value used to identify this request. If provided to us during operational questions, it will help us provide better support.

Example 123e4567-e89b-12d3-a456-426614174000
type
string enum
required

Discriminator for follow-up selection

Values follow_up · Example follow_up
cursor
string

The opaque pagination token from the previous CatalogResponse (next_cursor).

Example eyJvZmZzZXQiOjIwfQ==

Responses

200List of lodging IDs matching the catalog criteria
lodging_ids
array of lodging_id
required

List of lodging IDs matching the catalog criteria

total_results
integer
required

Total number of results available across all pages

Example 150
has_more
boolean
required

Indicates whether more results are available beyond the current page within the same poll cycle.

Example true
next_after
string · date-time
required

Timestamp to use as the 'after' parameter for the next synchronization cycle. This represents the continuation point after completing the current poll cycle. When pagination is complete (next_cursor is null), use this value for your next polling cycle to avoid gaps in change tracking. If no results were returned, this will match the 'after' timestamp from your request.

Example 2025-01-15T10:30:00Z
response_id
string · uuid
required

Unique identifier of the specific response. Use this identifier when you need to refer to a specific response, when requiring technical support.

Example 123e4567-e89b-12d3-a456-426614174000
next_cursor
string

Opaque token for retrieving the next page of results. Include this as cursor in a follow-up request to continue pagination within the same poll cycle. If null or omitted, no further results are available for this cycle.

Example eyJvZmZzZXQiOjIwfQ==
400Invalid Request. There will be an error code in the response detailing the issue.
error_code
string enum
required

Error code for catalog operation failures

Values invalid_requestinternal_errorunauthorized
description
string
required

Human-readable description of the error

response_id
string · uuid
required

Unique identifier of the specific response. Use this identifier when you need to refer to a specific response, when requiring technical support.

Example 123e4567-e89b-12d3-a456-426614174000
Example
{
  "error_code": "invalid_request",
  "description": "string",
  "response_id": "123e4567-e89b-12d3-a456-426614174000"
}
500Internal server error
error_code
string enum
required

Error returned when an internal server error occurs.

Values internal_server_error
description
string
required

A human-readable description of the error.

response_id
string · uuid
required

Unique identifier of the specific response. Use this identifier when you need to refer to a specific response, when requiring technical support.

Example 123e4567-e89b-12d3-a456-426614174000
Example
{
  "error_code": "internal_server_error",
  "description": "string",
  "response_id": "123e4567-e89b-12d3-a456-426614174000"
}
Request
curl -X PUT "https://travel-distribution.staging.htsapis.com/api/lodging/v1/catalog" \
  -H "HTS-API-KEY: $HTS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": "123e4567-e89b-12d3-a456-426614174000",
  "type": "initial",
  "after": "2025-01-01T00:00:00Z",
  "event_type": "added",
  "page_size": 10
}'
Response 200
{
  "lodging_ids": [
    "123e4567-e89b-12d3-a456-426614174000"
  ],
  "total_results": 150,
  "has_more": true,
  "next_cursor": "eyJvZmZzZXQiOjIwfQ==",
  "next_after": "2025-01-15T10:30:00Z",
  "response_id": "123e4567-e89b-12d3-a456-426614174000"
}

Examples are generated from the schema where the spec publishes none; field values are illustrative.