Chuyển tới nội dung chính

Getting Started

Cohost API là REST API được xây dựng trên FastAPI, hỗ trợ quản lý đặt phòng thông minh.

Base URL

EnvironmentURL
Productionhttps://api.cohost.vn
Staginghttps://v2-staging.api.cohost.ai
Localhttp://localhost:8000

API Versioning

Tất cả endpoints đều có prefix /api/v1/.

GET https://api.cohost.vn/api/v1/listings

Quick Start

1. Lấy Access Token (Internal API)

Cohost dùng Auth0 để xác thực. Lấy JWT token từ Auth0 và đính kèm vào header:

curl -X GET https://api.cohost.vn/api/v1/listings \
-H "Authorization: Bearer <your_jwt_token>" \
-H "X-Team-ID: <your_team_id>"

2. External / OTA API

Đối tác OTA dùng API Key thay vì JWT:

curl -X GET https://api.cohost.vn/api/v1/external/listings \
-H "X-API-Key: <your_api_key>"

Interactive Docs

FastAPI tự động sinh OpenAPI docs:

  • Swagger UI (internal): GET /docs
  • ReDoc (internal): GET /redoc
  • Swagger UI (external): GET /external-docs

Từ đây, bạn có thể:

Health Check

curl https://api.cohost.vn/health
# {"status": "ok", "version": "1.0.0"}