メインコンテンツへスキップ
API リファレンスドキュメントは現在英語のみで利用可能です。このページを別の言語で表示している場合は、英語版に切り替えてください。左側のサイドバーに完全なAPIエンドポイントリストが表示されます。
FIM One は、AI 智能体、会話、ナレッジベースなどへのプログラマティックアクセスのための REST API を提供します。

ベースURL

認証

すべてのAPI リクエストは、APIキーまたはJWTトークンを使用した認証が必要です。

APIキーの使用

AuthorizationヘッダーにAPIキーを含めます:

Using JWT Token

The SSE streaming endpoints (/api/react, /api/dag and /api/auto) read the token from the request body, not from the Authorization header. The value can be a JWT access token or an API key:
See Authentication for detailed setup instructions.

レスポンス形式

Success Response

Most endpoints that return a single resource or an acknowledgement wrap it in this structure (list endpoints and the sign-in endpoints return their payload directly):

Error Response

Error responses carry a human-readable detail, a machine-readable error_code (null for a few generic errors), and error_args with values for the message:

ページネーション付きレスポンス

リストエンドポイントはページネーション付きの結果を返します:

Streaming (Server-Sent Events)

Chat endpoints (POST /api/react, POST /api/dag and POST /api/auto) return Server-Sent Events for real-time streaming. Each event has a type field indicating its content: The conversation title is generated in the background after end; read it from GET /api/conversations/{id}.

Example SSE Stream

Cursor-based resume

Every persisted SSE event is sent as {"cursor": <int>, "data": {...}}; the cursor increases monotonically within the assistant turn. Clients should track the highest cursor seen. When the connection drops mid-turn (network error, proxy timeout, server restart), the client can re-subscribe without re-running the agent:
The response is an SSE stream that replays cached events with cursor > 42 and ends with a terminal event: resume_done frame. Pass cursor: -1 to request a full replay from the beginning. Error responses:
  • 404 conversation_not_found — conversation id is invalid or not owned by the authenticated user
  • 404 no_recent_assistant_message — conversation has no persisted assistant turn to resume from (e.g., a brand-new conversation with no user messages yet)
  • 400 invalid_cursor — cursor is not a non-negative integer or -1
The reference frontend implementation (useSseResume hook in the playground) auto-retries network disconnects with exponential backoff (300ms → 1s → 3s, max 3 attempts) and distinguishes user-initiated abort from network error to avoid unintended reconnects. See the playground-page.tsx integration for the full pattern.
Resume is stateless — it replays from the assistant message’s stored sse_events array. If the agent’s turn was interrupted before any assistant message was persisted (e.g., a crash before done), the dangling tool_use block is auto-repaired by DbMemory._repair_dangling_tool_calls on the next turn. Synthetic tool_result rows are persisted with metadata_.synthetic=true and metadata_.reason="interrupted" for audit.

Business References

A system that embeds FIM One can tag each conversation with the id of the business object it is about, such as a contract number or a ticket id, and later reopen the latest conversation for that object.
  • business_ref is optional text. It is normalized to Unicode NFC, then surrounding whitespace is trimmed; an empty value means no reference. A value longer than 200 characters after normalization, or one containing control characters (C0 or C1), zero-width or other format characters, or the line and paragraph separators U+2028 and U+2029, is refused with 422 (invalid_business_ref for query parameters). The value is otherwise stored as given: it is not unique, not interpreted, and never passed to the model.
  • Filters and lookups match exactly and case-sensitively, after the same NFC normalization: HT-1 does not find ht-1, while a reference sent in decomposed form finds the one stored in composed form.
  • A reference belongs to the conversation’s owner. Filters and lookups only ever consider the caller’s own conversations, and administrator lists and exports do not show it. The administrators’ full backup (GET /api/admin/export/full-backup) leaves it out, so anything rebuilt from that backup has no references. The owner’s data export (GET /api/auth/me/export) includes it.
GET /api/conversations/latest orders by the newest message, falling back to the creation time, and considers active conversations unless status=archived is given. The list keeps its own order (starred first, then newest created).

レート制限

キーごとのレート制限は将来のリリースで予定されています。現在、キーごとのリクエスト制限は強制されていませんが、APIを責任を持って使用してください。

ページネーション

リストエンドポイントはクエリパラメータを使用したページネーションをサポートしています:
パラメータ:
  • page (デフォルト: 1) — ページ番号、1から始まります
  • size (デフォルト: 20) — ページあたりのアイテム数、最大 100

タイムスタンプ

すべてのタイムスタンプはUTCタイムゾーン付きのISO 8601形式です:

Error Codes

Common error codes and their meanings: Errors raised by the authentication layer for a bad Authorization header (Invalid token, Token has expired, Invalid API key, API key is disabled) return 401 with error_code: null; rely on the status code and detail for those. Request validation failures return 422.

API プレイグラウンド

各エンドポイントページには、以下のことができるインタラクティブな API プレイグラウンドが含まれています:
  • ブラウザから直接リクエストをテストする
  • 実際のレスポンスを表示する
  • 複数の言語でリクエストコードをコピーする
  • API キーで認証する
API プレイグラウンドはブラウザからリクエストを実行するため、API キーに適切な CORS パーミッションがあることを確認してください (通常、同一オリジンのリクエストではデフォルトで有効になっています)。

SDK の利用可能性

FIM One API は完全に REST ベースですが、一般的なプログラミング言語で SDK が利用可能です (またはまもなく利用可能になります):
  • Python: 近日公開予定
  • JavaScript/TypeScript: 近日公開予定
  • Go: 近日公開予定

Versioning

The API carries the application version, reported by GET /api/version. Version is not included in the URL path; breaking changes will be signaled through major version bumps and a migration period.

サポート

API の問題または質問については:
  • ドキュメント: 各エンドポイントの詳細ガイドを参照してください
  • GitHub Issues: バグを報告してください https://github.com/fim-ai/fim-one/issues
  • Discord コミュニティ: コミュニティに参加して議論してください