Skip to main content
Version: 2026-04-15

API Forwarder

The 4C:me Safe AI Platform provides an API forwarder that allows external applications to interact with the platform's services using API keys. This enables programmatic access to agents, chat, transcription, and more — without requiring a browser session.

Overview

The API forwarder acts as a secure gateway between external applications and the platform's internal services. It validates API keys, enforces permission scopes, and forwards authenticated requests to the appropriate backend service.

Key features:

  • API key authentication — Use API keys instead of browser-based SSO
  • Granular scopes — Control exactly which capabilities each key can access
  • Expiration policies — Keys can be configured to expire after a set period
  • Audit trail — Track when keys were created and last used

Managing API Keys

API Keys management page

Navigate to Settings > API Keys to view and manage your API keys. Each key displays:

  • Name — A label you assigned when creating the key
  • Key prefix — The first characters of the key (e.g. afk_4d850c05...)
  • Expiration date — When the key will stop working
  • Last used — When the key was last used to make a request
  • Created date — When the key was generated
  • Scopes — The permission scopes assigned to the key

Creating an API Key

Create API Key dialog

  1. Click + Create Key on the API Keys page
  2. Enter a descriptive Name (e.g. "Production Bot")
  3. Select the Permissions the key should have (see Scopes below)
  4. Choose an Expiration period (default: 30 days)
  5. Click Create Key
warning

The full API key is only shown once at creation time. Copy and store it securely — it cannot be retrieved later.

Deleting an API Key

Click the trash icon next to any key to revoke it immediately. Revoked keys can no longer authenticate requests.

Authentication

Include the API key in the x-api-key header of every request:

curl -X POST https://your-platform-url/api/v1/completions \
-H "x-api-key: afk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"messages": [{"role": "user", "content": "Hello"}]}'

Scopes

Each API key is assigned one or more scopes that determine which endpoints it can access. Scopes are organized into two groups:

Agents

Scopes for managing knowledge agents — the AI personas backed by indexed documents and custom configurations.

ScopeDescription
View AgentsRead-only access to agents, their status, categories, search, and indexed documents
Edit AgentsModify existing agents, trigger indexing, and manage agent documents
Create AgentsCreate new agents
Delete AgentsRemove agents
Manage All AgentsFull agent access that bypasses user-group restrictions. Includes all of the above

Tools

Scopes for using the platform's AI tools.

ScopeDescription
Use ChatAccess the chat completion engine, conversation history, projects, and related features
Use TranscriptsAccess audio transcription and file upload

Endpoints by Scope

All endpoints are accessible through the API forwarder base URL. The forwarder routes requests to the appropriate internal service.

View Agents

Read-only access to agents and their data.

Agents

MethodEndpointDescription
GET/agentsList agents (supports ?page, ?pageSize, ?search, ?categories, ?isPublic, ?sortBy, ?sortDirection)
GET/agents/{agentId}Get agent details and configuration
GET/agents/indexed-countGet total count of indexed agents

Agent Indexing Status

MethodEndpointDescription
GET/agents/{agentId}/statusGet current indexing status
GET/indexing-tracking/{agentId}/progressGet indexing progress
GET/indexing-tracking/{agentId}/resultsGet final indexing results
GET/indexing-tracking/{agentId}/statusGet indexing session status
MethodEndpointDescription
POST/agents/{agentId}/searchSearch documents in an agent's index
POST/search/{agentId}/semantic-searchSemantic search
POST/search/{agentId}/vector-searchVector search (supports ?topK)
POST/search/{agentId}/hybrid-searchHybrid search combining multiple strategies
POST/search/{agentId}/iterative-hybrid-searchIterative hybrid search with LLM judge (supports ?maxRetries)
POST/search/{agentId}/enhanced-multipart-searchFile-processing RAG search (multipart/form-data)
POST/search/{agentId}/hyde-searchHyDE-enhanced search (supports ?method=single|multiple|reverse|adaptive)

Categories

MethodEndpointDescription
GET/categoriesList all agent categories
GET/categories/{id}Get a specific category

Files & Documents

MethodEndpointDescription
GET/files/download/{blobPath}Download a processed file
GET/files/agents/{agentId}/document-countsGet document counts for an agent

Template Documents

MethodEndpointDescription
GET/api/template-documents/{templateId}Get a specific template document
GET/api/template-documents/agent/{agentId}Get all templates for an agent
GET/api/template-documents/agent/{agentId}/prompt/{promptText}Get template for a specific prompt
GET/api/template-documents/processing/{processingId}Get template processing status
GET/api/template-documents/processing/{processingId}/streamStream processing status (SSE)
GET/api/template-documents/processing/agent/{agentId}/prompt/{promptIndex}Get processing status by prompt index

Edit Agents

Modify existing agents and their resources. Also includes all View Agents endpoints.

Agent Configuration

MethodEndpointDescription
PUT/agents/{agentId}Update agent configuration

Indexing

MethodEndpointDescription
POST/agents/{agentId}/index-allTrigger bulk indexing (supports ?stream=true for SSE progress)
POST/agents/{agentId}/documents/deleteDelete documents from an agent's index
POST/indexing-tracking/{agentId}/initializeInitialize an indexing session
PUT/indexing-tracking/{agentId}/file-resultUpdate a file processing result
DELETE/indexing-tracking/{agentId}/resetReset indexing status
DELETE/indexing-tracking/{agentId}/filesDelete file collection
POST/indexing-tracking/{agentId}/cancelCancel an active indexing session
POST/indexing-tracking/cleanup-stuck-sessionsClean up abandoned indexing sessions

File Processing

MethodEndpointDescription
POST/files/processProcess uploaded files (multipart/form-data)
POST/files/process-contentProcess and extract file content (multipart/form-data)
POST/files/circuit-breaker/resetReset image processing circuit breaker

Categories

MethodEndpointDescription
POST/categoriesCreate a new category
PUT/categories/{id}Update a category
DELETE/categories/{id}Delete a category

Template Documents

MethodEndpointDescription
POST/api/template-documentsCreate a template document
POST/api/template-documents/from-bufferCreate template from uploaded file (multipart/form-data)
POST/api/template-documents/cleanup-orphanedClean up orphaned template references
POST/api/template-documents/processing/agent/{agentId}/prompt/{promptIndex}/cancelCancel template processing
PUT/api/template-documents/agent/{agentId}/prompt/{promptText}Replace a template document
DELETE/api/template-documents/{templateId}Delete a template document
DELETE/api/template-documents/agent/{agentId}/prompt/{promptIndex}Remove template from a prompt
PATCH/api/template-documents/agent/{agentId}/prompt/{promptIndex}/textUpdate prompt text

Create Agents

Create new agents. Also includes all View Agents endpoints.

MethodEndpointDescription
POST/agentsCreate a new agent

Delete Agents

Delete agents. Also includes all View Agents endpoints.

MethodEndpointDescription
DELETE/agents/{agentId}Delete an agent

Manage All Agents

Grants full access to all agent endpoints listed above (View, Edit, Create, Delete), and additionally bypasses user-group restrictions. With this scope, the API key can manage agents regardless of which user groups they are assigned to.


Use Chat

Access the chat completion engine, conversation history, and related features.

Completions

MethodEndpointDescription
POST/api/v1/completionsSend a chat completion request (JSON body)
POST/api/v1/completions/multipartSend a completion with file attachments (multipart/form-data)

Messages

MethodEndpointDescription
POST/api/v1/messagesCreate a new message
POST/api/v1/messages/generate-titleGenerate a conversation title from chat history
GET/api/v1/messages/conversation-title/{conversationId}Get a conversation's title
PUT/api/v1/conversations/{conversationId}/messages/latest-assistant/rag-documentsUpdate RAG documents on the latest assistant message

Models

MethodEndpointDescription
GET/api/v1/modelsList available AI models

Prompt Templates

MethodEndpointDescription
GET/api/v1/templatesList prompt templates
POST/api/v1/templatesCreate a prompt template
PUT/api/v1/templates/{templateId}Update a prompt template
DELETE/api/v1/templates/{templateId}Delete a prompt template

Categories (Chat)

MethodEndpointDescription
GET/api/v1/categoriesList prompt template categories
POST/api/v1/categoriesCreate a category
PUT/api/v1/categories/{categoryId}Update a category
DELETE/api/v1/categories/{categoryId}Delete a category
POST/api/v1/categories/reorderReorder categories

Conversations

MethodEndpointDescription
POST/api/v1/history/conversations/Create a new conversation
PATCH/api/v1/history/conversations/{conversationId}/editEdit conversation name or pinned status
PATCH/api/v1/history/conversations/{conversationId}/deleteDelete a conversation
PATCH/api/v1/history/conversations/{conversationId}/readMark conversation as read
GET/api/v1/history/conversations/user/{userId}List all conversations for a user
GET/api/v1/history/conversations/user/{userId}/recentList recent conversations (supports ?limit, ?page, ?projectId)

Chat Messages (History)

MethodEndpointDescription
POST/api/v1/history/chat/messagesStore a chat message
GET/api/v1/history/chat/messages/{conversationId}Get messages for a conversation (supports ?limit, ?beforeId)
PATCH/api/v1/history/chat/messages/{id}Update a message
DELETE/api/v1/history/chat/messages/lastDelete the last message in a conversation
GET/api/v1/history/chat/messages/user-imagesGet user images from messages

Projects

MethodEndpointDescription
POST/api/v1/projects/Create a new project
PATCH/api/v1/projects/{projectId}Update a project
DELETE/api/v1/projects/{projectId}Delete a project
GET/api/v1/projects/user/{userId}List projects for a user
PATCH/api/v1/projects/{projectId}/conversations/{conversationId}/linkLink a conversation to a project
PATCH/api/v1/projects/conversations/{conversationId}/unlinkUnlink a conversation from a project
GET/api/v1/projects/{projectId}/conversations/{userId}Get conversations linked to a project

Presets

MethodEndpointDescription
POST/api/v1/presetCreate a new preset
PATCH/api/v1/preset/{presetId}Update a preset
DELETE/api/v1/preset/{presetId}Delete a preset
GET/api/v1/preset/user/{userId}List presets for a user

User Settings

MethodEndpointDescription
POST/api/v1/user-settings/getGet user settings
POST/api/v1/user-settingsCreate user settings
PUT/api/v1/user-settingsUpdate user settings
DELETE/api/v1/user-settingsDelete user settings

Files

MethodEndpointDescription
POST/api/v1/files/processProcess uploaded files
POST/api/v1/upload/imageUpload an image (multipart/form-data)
GET/api/v1/upload/image/downloadDownload an image (supports ?url, ?filename)

Image Generation

MethodEndpointDescription
POST/api/v1/generate/imageGenerate images from text prompts

Prompt Enhancer

MethodEndpointDescription
POST/api/v1/prompt-enhancer/enhanceEnhance a prompt
POST/api/v1/prompt-enhancer/basic-enhanceBasic prompt enhancement
GET/api/v1/prompt-enhancer/skillsList available enhancement skills

Tasks

MethodEndpointDescription
GET/api/v1/tasks/activeGet active tasks (supports ?conversationId, ?userId)
GET/api/v1/tasks/active/userGet active tasks by user
POST/api/v1/tasks/pre-createPre-create a task
POST/api/v1/tasks/{taskId}/acknowledgeAcknowledge a task
POST/api/v1/tasks/{taskId}/stopStop a task

Use Transcripts

Access audio transcription features.

Transcription

MethodEndpointDescription
POST/api/transcriptionSubmit a transcription job (body: BlobUrl or BlobUrls)
GET/api/transcription/{jobId}/statusGet transcription job status
GET/api/transcription/{jobId}/resultDownload transcription results
GET/api/transcription/previousList previous transcriptions for the user
GET/api/transcription/{jobId}/detailsGet full transcription details (supports ?resultId)
PATCH/api/transcription/{jobId}/detailsUpdate transcription details (supports ?resultId)
DELETE/api/transcription/{jobId}Delete a transcription (supports ?resultId)

File Upload

MethodEndpointDescription
POST/api/upload/uploadUpload an audio file for transcription (multipart/form-data)

Projects (Transcription)

MethodEndpointDescription
PATCH/api/v1/projects/{projectId}/transcriptions/{jobId}/linkLink a transcription to a project
PATCH/api/v1/projects/transcriptions/{jobId}/unlinkUnlink a transcription from a project