API & configuration

API reference

Backend HTTP interfaces for the default workspace, projects, sessions, datasets, construction, files, memory, and skills. Examples target a running iGraph service; the documentation site itself does not execute API calls.

#Conventions

Examples use the Compose public entry point http://localhost:21108. When running Backend separately, use http://localhost:21109 instead. Business APIs use /api. Send Content-Type: application/json for JSON and multipart/form-data for uploads. The running service serves its complete schema at /openapi.json and Swagger at /docs.

In the tables, {sid}, {pid}, and {did} represent server-issued session_id, project_id, and dataset_id; {rid} is run_id and {jid} is job_id. Replace these readability abbreviations with the corresponding identifiers. This is an index of main entry points; use /openapi.json from the same deployment for complete request constraints and response schemas.

#Single-user workspace

GET/api/workspace

Public /api/* requests are bound to the workspace owner selected by IGRAPH_ADMIN_USER_ID, defaulting to admin. Clients do not need X-User-ID; if an older client sends it, Backend replaces it with the fixed owner, so it cannot switch accounts. This endpoint takes no body and returns workspace state and available models. It neither authenticates users nor issues login tokens.

json
{
  "valid": true,
  "single_user": true,
  "user_id": "admin",
  "is_admin": true,
  "available_models": [
    "CONFIGURED_MODEL"
  ],
  "default_model": "CONFIGURED_MODEL"
}

CONFIGURED_MODEL is a placeholder; use the workspace response and GET /api/models for the actual catalog. The old POST /api/auth/validate remains only as a hidden compatibility endpoint returning the same workspace context. /api/admin/users and its account-management operations have been removed. is_admin is an internal compatibility field, not an administrator sign-in flow.

Model API keys and IGRAPH_CONTROL_SERVICE_KEY still configure provider connections and authenticate internal service calls, respectively. Project, session, dataset, and file-scope checks remain in effect. The single-user application is accessed through loopback or an SSH tunnel by default; removing the login page does not make internal services public endpoints.

#Create a session

POST/api/sessions
FieldType / defaultMeaning
client_session_idUUID string | nullOptional client idempotency UUID, up to 64 characters; invalid UUIDs return 400.
modelstring | nullOptional model ID; choose an available, enabled model with a complete connection configuration.
project_idstring | nullProject ownership; null for a non-project session.
active_dataset_idstring | nullOptional active dataset; it must fall within the workspace and project scope accessible to the session.
initial_message_previewstring / ""Up to 1,000 characters, used for session metadata such as title.
reasoning_mode"direct" | "staged" / "direct"Reasoning mode.
planning_mode"never" | "auto" | "always" / "auto"Planning policy.
json
{
  "client_session_id": "799888e3-5ae2-43ad-bec3-5b1e8e64fa25",
  "reasoning_mode": "direct",
  "planning_mode": "auto"
}

Successful responses include success, session_id, and information such as model, project_id, and active_dataset_id. Reusing a client ID may return reused: true. Send a message using chat/stream after creation.

#Session and run endpoints

MethodPathPurpose
GET / POST/api/sessionsList / create sessions in the default workspace
POST/api/sessions/{sid}/activateActivate a session and restore available state
GET/api/sessions/{sid}/messagesRead persisted messages and recoverable UI content
GET/api/sessions/{sid}/infoSession metadata, active data, and run state
GET/api/sessions/{sid}/context-usageContext-usage information
PATCH/api/sessions/{sid}Update session metadata such as the title
PATCH/api/sessions/{sid}/modelSwitch to an available workspace model
PATCH/api/sessions/{sid}/datasetUpdate the session dataset binding
PATCH/api/sessions/{sid}/reasoning-modeUpdate reasoning mode
PATCH/api/sessions/{sid}/planning-modeUpdate planning mode
DELETE/api/sessions/{sid}Delete a session; active work may need to stop first
POST/api/sessions/{sid}/chat/streamSubmit a message and receive SSE
POST/api/sessions/{sid}/feedback/streamSubmit a tool-approval decision and continue the original run
POST/api/sessions/{sid}/runs/{rid}/resumeResume observing a run from last_event_index
GET/api/sessions/{sid}/runs/{rid}/snapshotRead a phase snapshot; inspect snapshot_complete
GET/api/capabilitiesRead cancellation and latest-turn editing capabilities
POST/api/sessions/{sid}/runs/cancelStop a targeted run when run_cancel_v1 is enabled
GET/api/sessions/{sid}/runs/controlQuery control state by run_id or start_request_id
POST/api/sessions/{sid}/jobs/{jid}/cancelStop a targeted job when job_cancel_v1 is enabled
GET/api/sessions/{sid}/jobs/{jid}/controlRead job stop and persistence state

Project and dataset endpoints preserve separate scopes: project data uses /api/projects/{pid}/datasets, while personal data uses /api/personal-datasets. Read project sessions and recorded training experiments from the conversations and training-runs subpaths respectively. Reading the training summary does not start training.

MethodPathPurpose
GET / POST/api/projectsList / create projects
GET / PATCH / DELETE/api/projects/{pid}Read / update / delete a project
GET/api/projects/{pid}/conversationsProject sessions
GET/api/projects/{pid}/training-runsRecorded project training configuration, metrics, and model information
GET/api/server-datasetsList server-provided datasets
POST/api/projects/{pid}/datasets/from-serverAdd an accessible server dataset to a project
GET / POST/api/models/customList / save workspace custom-model configuration
DELETE/api/models/custom/{model_id}Delete workspace custom-model configuration
GET/api/modelsRead the model catalog and default model
PUT/api/models/defaultSet the default model
GET / POST/api/model-providersList / save model service providers
GET/api/construction-modelsRead available construction models
GET / POST/api/construction-model-settingsRead / save the separate construction-model connection

Workspace files, memories, and skills also have public APIs. Skill upload uses a multipart/form-data file field, accepts .md and .zip, and currently has a 2 MiB Backend limit. Candidate skill review is separate from approval of a pending tool execution.

MethodPathPurpose
GET/api/sessions/{sid}/workspace/filesList visible uploads and published outputs
GET/api/sessions/{sid}/workspace/derived/{artifact_path}Download Derived outputs after session and file-scope checks
GET / POST/api/memoryQuery / create memory; GET accepts scope, query, and limit
PATCH / DELETE/api/memory/{memory_id}Update / delete a memory record
GET/api/memory/eventsRead memory-related events
GET/api/memory/usageRead memory-usage information
GET / POST/api/skillsList / create skills
POST/api/skills/uploadUpload a skill file or archive
GET / PUT / DELETE/api/skills/{name}Read full content / edit / delete a skill
POST/api/skills/{name}/approveApprove a candidate skill
POST/api/skills/{name}/rejectReject a candidate skill
GET/api/export/sftExport input/output samples from existing workspace sessions

/api/export/sft accepts format=alpaca, sharegpt, or raw, plus min_turns and require_tool_calls filters, and returns JSON containing items. It exports recorded data, not automatically quality-reviewed or training-ready samples. The current frontend has no dedicated SFT export button; distinguish this API from workspace downloads and report display.

#Upload a dataset

POST/api/projects/{project_id}/datasets
POST/api/personal-datasets

Dataset upload uses multipart/form-data. Supply at least one file or files field; repeat files for a multi-file upload. Multi-table CSV files can be combined with schema JSON describing relationships into one dataset, subject to upload validation. Use the matching project or personal endpoint.

FieldDescription
file / filesUpload one or more files; at least one is required
csv_schemaOptional CSV schema JSON text
name / descriptionOptional dataset name and description
session_idOptional associated session, subject to ownership checks
set_as_defaultProject upload only; defaults to false
bash
curl -X POST "http://localhost:21108/api/projects/PROJECT_ID/datasets" \
  -F "files=@customers.csv" \
  -F "files=@orders.csv" \
  -F "files=@schema.json" \
  -F "name=Commerce tables"

Chat attachments use the file field on POST /api/sessions/{sid}/upload. Use the returned file_token in a later chat request; workspace_path identifies the workspace file. A browser-local path cannot replace file_token. CSV, SQL, and TXT attachments can be registered as construction sources. Upload success, source-preview success, completed construction, and loading the graph into the current session are separate states.

Read source samples at /api/projects/{pid}/datasets/{did}/construction/source-preview or /api/personal-datasets/{did}/construction/source-preview. This read-only endpoint works before construction; CSV accepts an optional delimiter. Its tables, text, limits, and warnings describe bounded table samples or text excerpts. SQL field descriptions distinguish comments, structural information, and unavailable descriptions; structural inference is not a business definition. Successful preview parsing also does not guarantee SQL-dialect compatibility with construction.

#Errors and retries

StatusTypical meaningClient handling
403Internal service credential or data-scope check failedInspect detail, internal service keys, and project / session scope; signing in again is not required
404Resource missing or inaccessibleVerify IDs and workspace / project / session scope; removed account-management endpoints also return 404
409State or graph-revision conflictRead current state before retrying a write
422Invalid request parametersInspect detail and field types
429Construction capacity exhausted: construction_capacity_exhaustedNo build was started; back off before retrying.
504Construction still running or unconfirmed: construction_running_unconfirmedRead construction state first; do not immediately submit a duplicate build after a timeout.

FastAPI detail can be a string, a structured object, or a validation-error array. Do not assume one universal error envelope. After a stream starts, combine terminal events, snapshots, and control state to handle failures.

iGraphDocumentation