Skip to main content

Models

List All Available Models

GET /api/v1/user/model List all available models in your account.
curl -X GET https://api.4minds.ai/api/v1/user/model \
  -H "Authorization: Bearer YOUR_API_KEY"

Get Model Details

GET /api/v1/user/model/{model_id} Get details about a specific model.

Parameters

ParameterTypeRequiredDescription
model_idstringYesThe unique identifier of the model
curl -X GET https://api.4minds.ai/api/v1/user/model/{model_id} \
  -H "Authorization: Bearer YOUR_API_KEY"

Create a New Model

POST /api/v1/user/model Create a new model (optionally with a dataset attached).
curl -X POST https://api.4minds.ai/api/v1/user/model \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "your-model-name",
    "dataset": "optional-dataset-id"
  }'

Delete a Model

DELETE /api/v1/user/model/{id} Delete a model by ID.

Parameters

ParameterTypeRequiredDescription
idstringYesThe unique identifier of the model to delete
curl -X DELETE https://api.4minds.ai/api/v1/user/model/{id} \
  -H "Authorization: Bearer YOUR_API_KEY"

Conversations

List All Conversations

GET /api/v1/user/conversations Retrieves all conversations for a specific model.

Query Parameters

ParameterTypeRequiredDescription
model_idstringYesThe ID of the model to list conversations for
curl -X GET "https://api.4minds.ai/api/v1/user/conversations?model_id=1" \
  -H "Authorization: Bearer YOUR_API_KEY"

Create a New Conversation

POST /api/v1/user/conversations Creates a new conversation thread.
curl -X POST "https://api.4minds.ai/api/v1/user/conversations" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model_id": "1",
    "title": "New Conversation"
  }'

Rename a Conversation

PATCH /api/v1/user/conversations/{conversation_id} Updates the title of an existing conversation.

Path Parameters

ParameterTypeRequiredDescription
conversation_idstringYesThe ID of the conversation to rename
curl -X PATCH "https://api.4minds.ai/api/v1/user/conversations/conversation_id" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Updated Conversation Title"
  }'

Delete a Conversation

DELETE /api/v1/user/conversations/{conversation_id} Permanently deletes a conversation and all its messages.

Path Parameters

ParameterTypeRequiredDescription
conversation_idstringYesThe ID of the conversation to delete
curl -X DELETE "https://api.4minds.ai/api/v1/user/conversations/conversation_id" \
  -H "Authorization: Bearer YOUR_API_KEY"

Get All Messages from a Conversation

GET /api/v1/user/conversations/{conversation_id}/messages Retrieves all messages from a specific conversation thread.

Path Parameters

ParameterTypeRequiredDescription
conversation_idstringYesThe ID of the conversation
curl -X GET "https://api.4minds.ai/api/v1/user/conversations/conversation_id/messages" \
  -H "Authorization: Bearer YOUR_API_KEY"

Datasets

List All Datasets

GET /api/v1/user/dataset Retrieves a list of all available datasets.
curl -X GET "https://api.4minds.ai/api/v1/user/dataset" \
  -H "Authorization: Bearer YOUR_API_KEY"

Get Dataset Details

GET /api/v1/user/dataset/{id} Retrieves detailed information about a specific dataset.

Path Parameters

ParameterTypeRequiredDescription
idstringYesThe unique identifier of the dataset
curl -X GET "https://api.4minds.ai/api/v1/user/dataset/dataset_123" \
  -H "Authorization: Bearer YOUR_API_KEY"

Create a New Dataset

POST /api/v1/user/dataset Creates a new dataset by uploading files or providing URLs to scrape.

Request Body

ParameterTypeRequiredDescription
namestringYesName of the dataset
descriptionstringNoDescription of the dataset
filesarrayNoArray of files to upload
urlsarrayNoArray of URLs to scrape for data
curl -X POST  https://api.4minds.ai/api/v1/user/dataset \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "files=@training_data.jsonl" \
  -F "files=@additional_data.csv" \
  -F "dataset_name=Customer Support Dataset" \
  -F "description=Training data for customer support bot" \
  -F "tags=support,training,chatbot"

Upload Files to Dataset

POST /api/v1/user/dataset/upload Adds files to an existing dataset.

Request Body

Multipart form data with the following fields:
ParameterTypeRequiredDescription
dataset_idstringYesThe ID of the dataset
filefileYesThe file to upload
curl -X POST  https://api.4minds.ai/api/v1/user/dataset/upload \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "dataset_id=123" \
  -F "files=@training_data.jsonl" \
  -F "files=@additional_data.csv"

Delete a Dataset

DELETE /api/v1/user/dataset/{id} Deletes a dataset. This can be a soft delete (by default), or a permanent delete.

Path Parameters

ParameterTypeRequiredDescription
idstringYesThe unique identifier of the dataset

Query Parameters

ParameterTypeRequiredDescription
permanentbooleanNoSet to true for permanent deletion. Default is false (soft delete)
curl -X DELETE  https://api.4minds.ai/api/v1/user/dataset/123 \
  -H "Authorization: Bearer YOUR_API_KEY"

Evaluations

List All Evaluations

GET /api/v1/evaluations List all evaluations with pagination and filtering.

Query Parameters

ParameterTypeRequiredDescription
pageintegerNoPage number for pagination
per_pageintegerNoNumber of results per page (default: 20)
curl -X GET " https://api.4minds.ai/api/v1/evaluations?page=1&per_page=20" \
  -H "Authorization: Bearer YOUR_API_KEY"

Create a New Evaluation

POST /api/v1/evaluations Create a new evaluation for a model.

Request Body

ParameterTypeRequiredDescription
model_idstringYesThe ID of the model to evaluate
namestringYesName of the evaluation
configobjectNoModel-specific configuration for evaluation
curl -X POST  https://api.4minds.ai/api/v1/evaluations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "GPT-4 RAGAS Evaluation",
    "description": "Evaluate GPT-4 on BEIR dataset",
    "type": "ragas",
    "model_id": 123,
    "benchmark_type": "beir",
    "question_count": 700
  }'

Get Evaluation Details

GET /api/v1/evaluations/{evaluation_id} Get details about a specific evaluation.

Path Parameters

ParameterTypeRequiredDescription
evaluation_idstringYesThe unique identifier of the evaluation
curl -X GET  https://api.4minds.ai/api/v1/evaluations/456 \
  -H "Authorization: Bearer YOUR_API_KEY"

Start Running an Evaluation

POST /api/v1/evaluations/{evaluation_id}/start Start running an evaluation.

Path Parameters

ParameterTypeRequiredDescription
evaluation_idstringYesThe unique identifier of the evaluation
curl -X POST  https://api.4minds.ai/api/v1/evaluations/456/start \
  -H "Authorization: Bearer YOUR_API_KEY"

Run RAGAS Evaluation

POST /api/v1/evaluations/{evaluation_id}/run-ragas Run RAGAS evaluation with benchmark data.

Path Parameters

ParameterTypeRequiredDescription
evaluation_idstringYesThe unique identifier of the evaluation
Executes a RAGAS (Retrieval Augmented Generation Assessment) benchmark evaluation on the specified evaluation.
curl -X POST  https://api.4minds.ai/api/v1/evaluations/456/run-ragas \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "samples": [],
    "selected_questions": []
  }'

Update Evaluation Metadata

PUT /api/v1/evaluations/{evaluation_id} Update an evaluation’s metadata.

Path Parameters

ParameterTypeRequiredDescription
evaluation_idstringYesThe unique identifier of the evaluation

Request Body

ParameterTypeRequiredDescription
namestringNoUpdated name for the evaluation
descriptionstringNoUpdated description
curl -X PUT  https://api.4minds.ai/api/v1/evaluations/456 \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Updated Evaluation Name",
    "description": "Updated description"
  }'

Delete an Evaluation

DELETE /api/v1/evaluations/{evaluation_id} Delete an evaluation (cannot delete running evaluations).

Path Parameters

ParameterTypeRequiredDescription
evaluation_idstringYesThe unique identifier of the evaluation
Note: You cannot delete evaluations that are currently running.
curl -X DELETE  https://api.4minds.ai/api/v1/evaluations/456 \
  -H "Authorization: Bearer YOUR_API_KEY"

Check Evaluation Name Availability

GET /api/v1/evaluations/check-name Check if an evaluation name is available.

Query Parameters

ParameterTypeRequiredDescription
namestringYesThe evaluation name to check
curl -X GET " https://api.4minds.ai/api/v1/evaluations/check-name?name=My%20Evaluation" \
  -H "Authorization: Bearer YOUR_API_KEY"

Inference

Perform direct inference queries without streaming, perfect for simple question-answering and batch processing workflows using knowledge graphs.

Run a Single Query

POST /api/v1/user/inference Run a single query with your knowledge graph.

Required Parameters

ParameterTypeRequiredDescription
querystringYesThe question or query to process
model_idintegerYesThe ID of the model to use for inference

Optional Parameters

ParameterTypeRequiredDescription
conversation_idstringNoContinue an existing conversation by providing its ID
thread_idstringNoThread identifier for managing conversation history
enable_web_searchbooleanNoEnable web search to enhance responses (default: false)
max_tokensintegerNoMaximum response length (default: model-specific)
temperaturefloatNoResponse randomness from 0.0 to 1.0 (default: model-specific)
image_generationbooleanNoEnable image generation in responses (default: false)
image_parametersobjectNoImage generation config: width, height, steps, guidance
personaobjectNoUser persona configuration for customized responses
base_modelbooleanNoBypass RAG and use base model directly, useful for evaluations (default: false)
session_idstringNoSession tracking identifier
user_idstringNoUser identifier for tracking and personalization
tenant_idstringNoMulti-tenancy identifier for organization-level isolation

Advanced sampling overrides

These parameters provide fine-grained control over response generation and are typically used for specialized use cases.
ParameterTypeRequiredDescription
top_kintegerNoTop-K sampling: limits token selection to top K options
top_pfloatNoNucleus sampling: cumulative probability threshold
response_length_preferencestringNoResponse verbosity: “concise”, “balanced”, or “detailed”
creativity_levelfloatNoBalance between creative and deterministic outputs
factual_precisionfloatNoPreference for factual accuracy in responses
curl -X POST  https://api.4minds.ai/api/v1/user/inference \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "What is machine learning?",
    "model_id": 1
  }'

Authentication

All API requests require authentication using a Bearer token in the Authorization header:
Authorization: Bearer YOUR_API_KEY
You can obtain your API key from your 4Minds dashboard.

Response Format

All responses are returned in JSON format.

Success Response

{
  "status": "success",
  "data": { ... }
}

Error Response

{
  "status": "error",
  "message": "Error description"
}