Output formats
Endpoints return JSON by default. The /v1/datasets/{id} endpoint streams data
in either JSON or CSV — useful for downloading large async job results.
JSON (default)
curl https://api.stayingapi.com/v1/stays/1135700964697993602 \ -H "Authorization: Bearer sk_live_..."Response:
{ "data": { "id": "1135700964697993602", "title": "Beachfront flat in Estoril" }}CSV
The dataset endpoint accepts a format query parameter. CSV streaming is faster
for downloads bigger than ~5MB.
curl "https://api.stayingapi.com/v1/datasets/ds_abc?format=csv" \ -H "Authorization: Bearer sk_live_..." > stays.csvimport fs from "node:fs";import { pipeline } from "node:stream/promises";
const res = await fetch("https://api.stayingapi.com/v1/datasets/ds_abc?format=csv", { headers: { Authorization: "Bearer sk_live_..." },});await pipeline(res.body, fs.createWriteStream("stays.csv"));Content negotiation
Both Accept headers and format= query params work:
Accept: application/json(default)Accept: text/csv?format=json?format=csv
If both are present, the query string wins.