Passer au contenu principal
La documentation de référence de l’API est actuellement disponible en anglais uniquement. Si vous consultez cette page dans une autre langue, veuillez basculer vers la version anglaise — la liste complète des points de terminaison de l’API apparaîtra dans la barre latérale gauche.
FIM One fournit une API REST pour un accès programmatique aux agents IA, conversations, bases de connaissances, et bien plus encore.

URL de base

Authentification

Toutes les demandes d’API nécessitent une authentification via une clé API ou un jeton JWT.

Utilisation de la clé API

Incluez votre clé API dans l’en-tête Authorization :

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.

Format de réponse

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:

Réponses Paginées

Les points de terminaison de liste retournent des résultats paginés :

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).

Limitation de débit

La limitation de débit par clé est prévue pour une version future. Actuellement, il n’y a pas de limites de requêtes appliquées par clé, mais veuillez utiliser l’API de manière responsable.

Pagination

Les points de terminaison de liste prennent en charge la pagination via les paramètres de requête :
Paramètres :
  • page (par défaut : 1) — numéro de page, à partir de 1
  • size (par défaut : 20) — éléments par page, max 100

Horodatages

Tous les horodatages sont au format ISO 8601 avec le fuseau horaire UTC :

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.

Terrain de jeu API

Chaque page de point de terminaison inclut un terrain de jeu API interactif où vous pouvez :
  • Tester les demandes directement depuis votre navigateur
  • Afficher les réponses réelles
  • Copier le code de demande dans plusieurs langues
  • S’authentifier avec votre clé API
Le terrain de jeu API exécute les demandes depuis votre navigateur, assurez-vous donc que votre clé API dispose des autorisations CORS appropriées (généralement activées par défaut pour les demandes de même origine).

Disponibilité du SDK

Bien que l’API FIM One soit entièrement basée sur REST, des SDK sont disponibles (ou à venir) dans les langages populaires :
  • Python : À venir
  • JavaScript/TypeScript : À venir
  • Go : À venir

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.

Support

Pour les problèmes ou questions liés à l’API :
  • Documentation : Consultez les guides détaillés sur chaque endpoint
  • GitHub Issues : Signalez les bugs sur https://github.com/fim-ai/fim-one/issues
  • Communauté Discord : Rejoignez notre communauté pour discuter