シンプルなREST APIで旅行の作成、旅程の管理、コラボレーションが可能です。
すべてのAPIリクエストには、AuthorizationヘッダーにBearerトークンとしてAPIキーが必要です。
設定 → APIキーでキーを生成してください。キーはすぐにコピーしてください。再度表示されません。
curl https://keen-sturgeon-487.convex.site/api/v1/trips \ -H "Authorization: Bearer osk_your_key_here"
The four base scopes are trips:read, trips:write, messages:read, and messages:write. Each can be limited to a single trip by appending :<tripId>. For example, a key with only the scope trips:write:jx7abc... can create and update content on that one trip but nothing else. In the settings UI, leave "Limit to trip" blank for a key that works everywhere, or paste a trip ID to scope it down.
You do not need a client to use the REST API, but the official TypeScript SDK takes care of the tedious bits: auto-generated idempotency keys, retry with exponential backoff on 429 and 5xx, cursor pagination iterators, typed errors, and an unauthenticated share-token consumer.
npm install @osoto/api-client
import { OsotoClient } from '@osoto/api-client';
const client = new OsotoClient({
apiKey: process.env.OSOTO_API_KEY!,
baseUrl: 'https://keen-sturgeon-487.convex.site/api/v1',
});
const me = await client.me();
const { _id: tripId } = await client.createTrip({
groupId: me.defaultGroupId!,
title: 'Cotswolds',
startDate: '2026-07-15',
endDate: '2026-07-22',
});
// Async iterator loops every page automatically.
for await (const leg of client.iterateLegs(tripId)) {
console.log(leg.title);
}Agents that speak MCP (Claude Desktop, Claude Code, Cursor, Windsurf, OpenClaw) can consume the REST API through @osoto/mcp-server without writing any client code.
npx @osoto/mcp-server
APIキーは1分あたり60リクエストに制限されています。レート制限の状態はレスポンスヘッダーで返されます。
| Parameter | Type | Description |
|---|---|---|
| X-RateLimit-Limit | integer | ウィンドウあたりの許可リクエスト数 |
| X-RateLimit-Remaining | integer | 現在のウィンドウの残りリクエスト数 |
| Retry-After | integer | ウィンドウリセットまでの秒数(429の場合のみ) |
Retries are safe. You have two tools for making sure a flaky network does not create duplicates: an Idempotency-Key header for individual mutations, and a clientRef field for upserting rows by a caller-supplied identifier.
Any POST, PATCH, or DELETE may include an Idempotency-Key header (max 255 characters). Retries with the same key replay the cached response; retries with the same key but a different body return 409 IDEMPOTENCY_CONFLICT. Cached responses expire after 24 hours.
curl -X POST https://keen-sturgeon-487.convex.site/api/v1/trips \
-H "Authorization: Bearer osk_..." \
-H "Idempotency-Key: create-trip-42" \
-H "Content-Type: application/json" \
-d '{"groupId":"...","title":"Cotswolds","startDate":"2026-07-15","endDate":"2026-07-22"}'Pass a clientRef when creating legs, action items, map pins, or stays. It is unique per trip (or per leg for stays). Passing the same value on a retry diff-merges into the existing row instead of inserting a duplicate. clientRef pairs naturally with the batch upsert endpoints when importing a full itinerary.
エラーはコードとメッセージを含むJSONオブジェクトで返されます。
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Missing required fields: title, startDate",
"requestId": "req_0f9a8b7c-...",
"details": [
{ "path": "title", "reason": "required" },
{ "path": "startDate", "reason": "required" }
]
}
}Every response carries an X-Request-Id header (mirrored in error.requestId for error responses). Include it when filing support issues so we can trace the request end-to-end.
| Parameter | Type | Description |
|---|---|---|
| UNAUTHORIZED | 401 | 無効または欠落しているAPIキー |
| FORBIDDEN | 403 | 必要なスコープまたは旅行アクセスが不足 |
| NOT_FOUND | 404 | リソースが存在しません |
| VALIDATION_ERROR | 400 | リクエストフィールドが欠落または無効 |
| IDEMPOTENCY_CONFLICT | 409 | Same Idempotency-Key was replayed with a different request body |
| RATE_LIMITED | 429 | リクエストが多すぎます |
/meReturn the authenticated user, their groups, and the default group ID. Call this once at startup to discover groupId values for trip creation.
curl https://keen-sturgeon-487.convex.site/api/v1/me \ -H "Authorization: Bearer osk_..."
/trips認証ユーザーがアクセスできるすべての旅行を一覧表示します。
curl https://keen-sturgeon-487.convex.site/api/v1/trips \ -H "Authorization: Bearer osk_..."
/trips新しい旅行を作成します。
| Parameter | Type | Description |
|---|---|---|
| groupId* | string | 旅行を作成するグループ |
| title* | string | 旅行タイトル |
| startDate* | string | 開始日(YYYY-MM-DD) |
| endDate* | string | 終了日(YYYY-MM-DD) |
curl -X POST https://keen-sturgeon-487.convex.site/api/v1/trips \
-H "Authorization: Bearer osk_..." \
-H "Content-Type: application/json" \
-d '{"groupId":"...","title":"Summer in the Cotswolds","startDate":"2026-07-15","endDate":"2026-07-22"}'/trips/{tripId}旅行の詳細を取得します。
/trips/{tripId}/exportCanonical trip snapshot. Returns trip, legs, map pins, action items, commitments, and members in a single response. Use this to answer questions like "where am I staying on Tuesday" without issuing multiple reads.
curl https://keen-sturgeon-487.convex.site/api/v1/trips/TRIP_ID/export \ -H "Authorization: Bearer osk_..."
/trips/{tripId}/syncDiff-based snapshot import. Pass any combination of legs, actionItems, and mapPins; items with a matching clientRef are diff-merged, items without are created. Set dryRun=true to preview the change set without writing. Returns per-category created/updated/errors counts and per-item outcomes.
curl -X POST "https://keen-sturgeon-487.convex.site/api/v1/trips/TRIP_ID/sync?dryRun=true" \
-H "Authorization: Bearer osk_..." \
-H "Content-Type: application/json" \
-d '{"legs":[{"order":0,"title":"Tokyo","destination":"Tokyo","startDate":"2026-07-15","endDate":"2026-07-20","timezone":"Asia/Tokyo","clientRef":"leg-tok-1"}],"mapPins":[{"name":"Sensoji","lat":35.7148,"lng":139.7967,"clientRef":"pin-sensoji"}]}'/trips/{tripId}旅行のメタデータを更新します。
| Parameter | Type | Description |
|---|---|---|
| title | string | 新しいタイトル |
| startDate | string | 新しい開始日 |
| endDate | string | 新しい終了日 |
| status | string | draft、active、またはcompleted |
/trips/{tripId}旅行をアーカイブします(ステータスをcompletedに設定)。
/trips/{tripId}/legs旅行の区間を順序で並べ替えて一覧表示します。
| Parameter | Type | Description |
|---|---|---|
| limit | integer | Max results (default 100, max 200) |
| cursor | string | Pagination cursor from previous response |
/trips/{tripId}/legs旅程区間を追加します。
| Parameter | Type | Description |
|---|---|---|
| order* | number | 並び順(0始まり) |
| title* | string | 区間タイトル |
| destination* | string | 目的地名 |
| startDate* | string | 開始日 |
| endDate* | string | 終了日 |
| timezone* | string | IANAタイムゾーン(例:Europe/London) |
| accommodation | object | 宿泊施設の詳細 |
| flights | array | フライトの詳細 |
| rentalCar | object | レンタカーの詳細 |
| clientRef | string | Caller-supplied unique reference (per trip). Retries upsert instead of duplicating. |
/trips/{tripId}/legs:batchBatch upsert up to 50 legs in a single call. Items with a matching clientRef are diff-merged; items without are created. Partial success: a 207 response lists per-item results.
curl -X POST https://keen-sturgeon-487.convex.site/api/v1/trips/TRIP_ID/legs:batch \
-H "Authorization: Bearer osk_..." \
-H "Content-Type: application/json" \
-d '{"items":[{"order":0,"title":"Tokyo","destination":"Tokyo","startDate":"2026-07-15","endDate":"2026-07-20","timezone":"Asia/Tokyo","clientRef":"leg-tok-1"}]}'/trips/{tripId}/legs/{legId}旅程区間を更新します。
/trips/{tripId}/legs/{legId}旅程区間を削除します。
/trips/{tripId}/action-items旅行のチェックリスト項目を一覧表示します。
/trips/{tripId}/action-itemsチェックリスト項目を作成します。
| Parameter | Type | Description |
|---|---|---|
| text* | string | 項目テキスト |
| urgency* | string | now、before_trip、またはnice_to_have |
| owner | string | 割り当てるユーザーID |
| clientRef | string | Caller-supplied unique reference (per trip). Retries upsert instead of duplicating. |
/trips/{tripId}/action-items:batchBatch upsert up to 50 action items. Supports clientRef for retry-safe upserts.
/trips/{tripId}/action-items/{itemId}アクションアイテムの更新または完了の切り替え。
/trips/{tripId}/action-items/{itemId}アクションアイテムを削除します。
/trips/{tripId}/commitmentsList scheduled events on a trip: dinners, activities, birthdays, meetings. Paginated — default limit 100, max 200, ordered by startDate and startTime.
/trips/{tripId}/commitmentsCreate a scheduled event. Optionally link it to a leg or a map pin.
| Parameter | Type | Description |
|---|---|---|
| title* | string | Event title |
| startDate* | string | Date (YYYY-MM-DD) |
| category* | string | dinner, activity, birthday, meeting, or other |
| startTime | string | Local time HH:mm (24-hour) |
| endTime | string | Local time HH:mm (24-hour) |
| isAllDay | boolean | True for all-day events (startTime and endTime are ignored) |
| timezone | string | IANA timezone (e.g., Europe/London) |
| legId | string | Link to an existing trip leg |
| mapPinId | string | Link to an existing map pin |
| notes | string | Free-form notes about the event |
/trips/{tripId}/commitments/{commitmentId}Update a commitment.
/trips/{tripId}/commitments/{commitmentId}Remove a commitment.
/trips/{tripId}/map-pins旅行のマップピンを一覧表示します。
/trips/{tripId}/map-pins旅行マップに場所をピン留めします。
| Parameter | Type | Description |
|---|---|---|
| name* | string | 場所名 |
| lat* | number | 緯度 |
| lng* | number | 経度 |
| category | string | カテゴリ(例:レストラン、ホテル) |
| notes | string | 場所に関するメモ |
| clientRef | string | Caller-supplied unique reference (per trip). Retries upsert instead of duplicating. |
/trips/{tripId}/map-pins:batchBatch upsert up to 50 map pins. Supports clientRef for retry-safe upserts.
/trips/{tripId}/map-pins/{pinId}マップピンを更新します。
/trips/{tripId}/map-pins/{pinId}マップピンを削除します。
/trips/{tripId}/channels旅行のチャンネルを一覧表示します。
/trips/{tripId}/channels/{channelId}/messagesチャンネルのメッセージを一覧表示します。ページネーション: 次のページにはcursorを渡してください。
| Parameter | Type | Description |
|---|---|---|
| limit | integer | 最大結果数(デフォルト50、最大100) |
| cursor | string | 前回のレスポンスからのページネーションカーソル |
/trips/{tripId}/channels/{channelId}/messagesチャンネルにメッセージを送信します。
| Parameter | Type | Description |
|---|---|---|
| content* | string | メッセージ内容 |
| parentId | string | 返信先メッセージID |
/trips/{tripId}/members旅行のメンバーとその役割・連絡先を一覧表示します。
Generate a share token with POST /trips/{tripId}/share-token. The token grants unauthenticated read access to the safe projection of the trip. Sensitive fields like wifiPassword, doorCode, hostPhone, confirmationNumber, and check-in instructions are stripped. Revoke with DELETE /trips/{tripId}/share-token.
/shared/trips/{token}Read-only share view. No Authorization header required.
curl https://keen-sturgeon-487.convex.site/api/v1/shared/trips/SHARE_TOKEN
/shared/trips/{token}/exportCanonical share snapshot with the same shape as /trips/{tripId}/export but using the safe-allowlist projection.