> For the complete documentation index, see [llms.txt](https://docs.planetcrust.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.planetcrust.com/human-connections/mistral-ai/mistral-ai.md).

# Mistral AI

<p align="center"><a class="button primary" data-icon="circle-caret-right">Try @Human</a><a class="button primary" data-icon="check">Buy @Human Subscription</a><a class="button primary" data-icon="comments">Join @Human Community</a></p>

<figure><img src="/files/xGPpOtCl2I3cNvjZWNMy" alt="" width="188"><figcaption></figcaption></figure>

<h3 align="center">Put Mistral AI to Work with @Human Automations and @Human Agents</h3>

<p align="center">The Mistral AI Connection documents all Triggers, Actions and Query Operations available for creating automations via the Mistral AI API.</p>

{% embed url="<https://www.youtube.com/watch?v=CyuUuaBSZzA>" %}

#### What can you do with the Mistral AI Connection?

* Connect to the Mistral AI API in a few clicks
* Use the related Mistral AI Operations (see below) in @Human Automations or @Human Agents

### Related Operations

#### Trigger Operations

**Chat Completion Created**

Triggers on: chat-completions/chat\_completion.created

Triggered when a new chat completion is successfully generated.

**FIM Completion Created**

Triggers on: fim-completions/fim\_completion.created

Triggered when a fill-in-the-middle code completion is successfully generated.

**Embeddings Generated**

Triggers on: embeddings/embeddings.generated

Triggered when vector embeddings are successfully generated for the provided input.

**Model Deleted**

Triggers on: models/model.deleted

Triggered when a fine-tuned model is successfully deleted.

**File Uploaded**

Triggers on: files/file.uploaded

Triggered when a new file is successfully uploaded to Mistral AI.

**File Deleted**

Triggers on: files/file.deleted

Triggered when a file is successfully deleted from Mistral AI.

**Fine-tuning Job Created**

Triggers on: fine-tuning-jobs/fine\_tuning\_job.created

Triggered when a new fine-tuning job is successfully created and queued.

**Fine-tuning Job Succeeded**

Triggers on: fine-tuning-jobs/fine\_tuning\_job.succeeded

Triggered when a fine-tuning job completes successfully.

**Fine-tuning Job Failed**

Triggers on: fine-tuning-jobs/fine\_tuning\_job.failed

Triggered when a fine-tuning job fails to complete.

**Batch Job Created**

Triggers on: batch-jobs/batch\_job.created

Triggered when a new high-volume batch inference job is successfully created.

**Batch Job Succeeded**

Triggers on: batch-jobs/batch\_job.succeeded

Triggered when a batch inference job completes successfully.

**Batch Job Failed**

Triggers on: batch-jobs/batch\_job.failed

Triggered when a batch inference job fails to complete.

**Agent Completion Created**

Triggers on: agents-completions/agent\_completion.created

Triggered when a response is successfully generated by a Mistral agent.

**OCR Completed**

Triggers on: ocr/ocr.completed

Triggered when text and structured content extraction from a document or image is completed.

#### Action Operations

[Action: Create Chat Completion](/human-connections/mistral-ai/mistral-ai/action-create-chat-completion.md)

[Action: Analyze Image](/human-connections/mistral-ai/mistral-ai/action-analyze-image.md)

[Action: Create Embeddings](/human-connections/mistral-ai/mistral-ai/action-create-embeddings.md)

[Action: API Request](/human-connections/docusign/docusign/action-api-request.md)

#### Query Operations

Example link

### Related Automations

Example link

### Obtaining Access Credentials

To obtain a **Personal Access Token (PAT)** for **Mistral AI Studio,** follow these steps:

#### **Prerequisites:**

* Any **Mistral AI Studio account** (free or paid). No additional subscription needed unless accessing premium features.

#### **Steps:**

1. **Log in** to [Mistral AI Studio](https://studio.mistral.ai/) with your **Mistral account** (free or paid subscription).
2. Click on your **profile icon** (top-right).
3. Navigate to **API Keys**.
4. Click on **Create New Key**.
5. Enter a **name** (e.g., `API-Access`) and set an **expiration** (or leave as "No Expiration").
6. Click on **Create New Key**.
7. **Copy this token** (treat it like a password—store securely).
   * This is your **PAT** for system-to-system access.

### Configuring Webhooks

1. **Set up a webhook trigger** on a third-party automation platform (e.g., Zapier, Make, or n8n) to receive external events.
2. **Configure an action** that utilizes the Mistral AI API with your generated **API Key**.
3. **Implement a polling mechanism** to monitor asynchronous operations, such as the **Batch API**.
4. **Periodically check the status** of your batch jobs via the `GET /v1/batch/jobs/{job_id}` endpoint.
5. **Trigger downstream actions** once the job status reaches a terminal state (`succeeded`, `failed`, or `cancelled`).

### Code (Apache v2.0): Service Connectivity and Metadata

```
{
  "handle": "mistral-ai",
  "status": "active",
  "meta": {
    "short": "Mistral AI",
    "description": "A connector for interacting with Mistral AI's API services.",
    "icon": "mistral",
    "tags": ["AI", "LLM", "API"]
  },
  "service": {
    "baseURL": {
      "value": "https://api.mistral.ai/v1"
    },
    "protocol": "https",
    "contentType": "application/json",
    "headers": {
      "Accept": {
        "value": "application/json"
      }
    },
    "auth": {
      "method": "api_token",
      "params": {
        "apiToken": {
          "token": {
            "value": "{{apiToken}}",
            "placeholders": [
              {
                "name": "apiToken",
                "type": "String",
                "description": "API token for Mistral AI",
                "required": true
              }
            ]
          },
          "headerName": {
            "value": "Authorization",
            "placeholders": [
              {
                "name": "headerName",
                "type": "String",
                "description": "Name of the header for the API token",
                "required": true,
                "default": "Authorization"
              }
            ]
          }
        }
      }
    }
  }
}

```

### Code (Apache v2.0): List of External Resources and Internal Mapping

```
[
  {
    "handle": "chat-completions",
    "meta": {
      "short": "Chat Completions",
      "description": "Generate conversational responses using Mistral chat models."
    },
    "endpoint": {
      "value": "/chat/completions"
    },
    "fields": [
      {
        "name": "id",
        "type": "String",
        "selector": ["id"],
        "meta": { "description": "Unique identifier for the chat completion." }
      },
      {
        "name": "object",
        "type": "String",
        "selector": ["object"],
        "meta": { "description": "Object type, always 'chat.completion'." }
      },
      {
        "name": "created",
        "type": "Integer",
        "selector": ["created"],
        "meta": { "description": "Unix timestamp when the completion was created." }
      },
      {
        "name": "model",
        "type": "String",
        "selector": ["model"],
        "meta": { "description": "Model used to generate the response." }
      },
      {
        "name": "choices_message_role",
        "type": "String",
        "selector": ["choices", 0, "message", "role"],
        "meta": { "description": "Role of the response message (assistant)." },
        "multivalue": true
      },
      {
        "name": "choices_message_content",
        "type": "String",
        "selector": ["choices", 0, "message", "content"],
        "meta": { "description": "Text content of the response message." },
        "multivalue": true
      },
      {
        "name": "choices_finish_reason",
        "type": "String",
        "selector": ["choices", 0, "finish_reason"],
        "meta": { "description": "Reason the generation stopped (stop, length, tool_calls)." },
        "multivalue": true
      },
      {
        "name": "usage_prompt_tokens",
        "type": "Integer",
        "selector": ["usage", "prompt_tokens"],
        "meta": { "description": "Number of tokens in the prompt." }
      },
      {
        "name": "usage_completion_tokens",
        "type": "Integer",
        "selector": ["usage", "completion_tokens"],
        "meta": { "description": "Number of tokens in the completion." }
      },
      {
        "name": "usage_total_tokens",
        "type": "Integer",
        "selector": ["usage", "total_tokens"],
        "meta": { "description": "Total tokens used." }
      }
    ],
    "operations": {
      "create": {
        "method": "POST",
        "path": { "value": "" },
        "headers": { "Content-Type": "application/json" },
        "queryParams": {},
        "bodyTemplate": {
          "value": "{\"model\": \"{{model}}\", \"messages\": [{\"role\": \"user\", \"content\": \"{{content}}\"}], \"temperature\": {{temperature}}, \"max_tokens\": {{maxTokens}}}",
          "placeholders": [
            { "name": "model", "type": "String", "description": "Mistral model ID to use.", "required": true },
            { "name": "content", "type": "String", "description": "User message content.", "required": true },
            { "name": "temperature", "type": "Number", "description": "Sampling temperature (0-2).", "required": false, "default": "0.7" },
            { "name": "maxTokens", "type": "Integer", "description": "Maximum tokens to generate.", "required": false, "default": "1024" }
          ]
        }
      }
    },
    "webhooks": [
      {
        "event": "chat_completion.created",
        "path": "/webhooks/mistral-ai/chat_completion/created",
        "payload": [
          { "name": "id", "type": "String", "selector": ["id"], "meta": { "description": "Unique identifier for the chat completion." } },
          { "name": "model", "type": "String", "selector": ["model"], "meta": { "description": "Model used to generate the response." } },
          { "name": "content", "type": "String", "selector": ["choices", 0, "message", "content"], "meta": { "description": "Text content of the response message." } },
          { "name": "usage_total_tokens", "type": "Integer", "selector": ["usage", "total_tokens"], "meta": { "description": "Total tokens used." } }
        ]
      }
    ]
  },
  {
    "handle": "fim-completions",
    "meta": {
      "short": "FIM Completions",
      "description": "Fill-in-the-middle code completions using Codestral."
    },
    "endpoint": {
      "value": "/fim/completions"
    },
    "fields": [
      {
        "name": "id",
        "type": "String",
        "selector": ["id"],
        "meta": { "description": "Unique identifier for the FIM completion." }
      },
      {
        "name": "object",
        "type": "String",
        "selector": ["object"],
        "meta": { "description": "Object type." }
      },
      {
        "name": "created",
        "type": "Integer",
        "selector": ["created"],
        "meta": { "description": "Unix timestamp when the completion was created." }
      },
      {
        "name": "model",
        "type": "String",
        "selector": ["model"],
        "meta": { "description": "Model used for the FIM completion." }
      },
      {
        "name": "choices_text",
        "type": "String",
        "selector": ["choices", 0, "text"],
        "meta": { "description": "Generated code text to fill in." },
        "multivalue": true
      },
      {
        "name": "choices_finish_reason",
        "type": "String",
        "selector": ["choices", 0, "finish_reason"],
        "meta": { "description": "Reason the generation stopped." },
        "multivalue": true
      },
      {
        "name": "usage_prompt_tokens",
        "type": "Integer",
        "selector": ["usage", "prompt_tokens"],
        "meta": { "description": "Tokens used in the prompt." }
      },
      {
        "name": "usage_completion_tokens",
        "type": "Integer",
        "selector": ["usage", "completion_tokens"],
        "meta": { "description": "Tokens generated in the completion." }
      }
    ],
    "operations": {
      "create": {
        "method": "POST",
        "path": { "value": "" },
        "headers": { "Content-Type": "application/json" },
        "queryParams": {},
        "bodyTemplate": {
          "value": "{\"model\": \"{{model}}\", \"prompt\": \"{{prompt}}\", \"suffix\": \"{{suffix}}\", \"max_tokens\": {{maxTokens}}, \"temperature\": {{temperature}}}",
          "placeholders": [
            { "name": "model", "type": "String", "description": "Codestral model ID.", "required": true },
            { "name": "prompt", "type": "String", "description": "Code prefix before the completion.", "required": true },
            { "name": "suffix", "type": "String", "description": "Code suffix after the completion.", "required": false },
            { "name": "maxTokens", "type": "Integer", "description": "Maximum tokens to generate.", "required": false, "default": "256" },
            { "name": "temperature", "type": "Number", "description": "Sampling temperature.", "required": false, "default": "0" }
          ]
        }
      }
    },
    "webhooks": [
      {
        "event": "fim_completion.created",
        "path": "/webhooks/mistral-ai/fim_completion/created",
        "payload": [
          { "name": "id", "type": "String", "selector": ["id"], "meta": { "description": "Unique identifier for the FIM completion." } },
          { "name": "model", "type": "String", "selector": ["model"], "meta": { "description": "Model used for the FIM completion." } },
          { "name": "text", "type": "String", "selector": ["choices", 0, "text"], "meta": { "description": "Generated code text to fill in." } },
          { "name": "usage_completion_tokens", "type": "Integer", "selector": ["usage", "completion_tokens"], "meta": { "description": "Tokens generated in the completion." } }
        ]
      }
    ]
  },
  {
    "handle": "embeddings",
    "meta": {
      "short": "Embeddings",
      "description": "Generate vector embeddings for text and code."
    },
    "endpoint": {
      "value": "/embeddings"
    },
    "fields": [
      {
        "name": "object",
        "type": "String",
        "selector": ["object"],
        "meta": { "description": "Object type, always 'list'." }
      },
      {
        "name": "model",
        "type": "String",
        "selector": ["model"],
        "meta": { "description": "Model used for generating embeddings." }
      },
      {
        "name": "data_index",
        "type": "Integer",
        "selector": ["data", 0, "index"],
        "meta": { "description": "Index of the embedding object." },
        "multivalue": true
      },
      {
        "name": "data_embedding",
        "type": "Number",
        "selector": ["data", 0, "embedding", 0],
        "meta": { "description": "First value of the embedding vector." },
        "multivalue": true
      },
      {
        "name": "usage_prompt_tokens",
        "type": "Integer",
        "selector": ["usage", "prompt_tokens"],
        "meta": { "description": "Tokens used to generate the embedding." }
      }
    ],
    "operations": {
      "create": {
        "method": "POST",
        "path": { "value": "" },
        "headers": { "Content-Type": "application/json" },
        "queryParams": {},
        "bodyTemplate": {
          "value": "{\"model\": \"{{model}}\", \"input\": [\"{{input}}\"]}",
          "placeholders": [
            { "name": "model", "type": "String", "description": "Embedding model ID (e.g. mistral-embed).", "required": true },
            { "name": "input", "type": "String", "description": "Text to embed.", "required": true }
          ]
        }
      }
    },
    "webhooks": [
      {
        "event": "embeddings.generated",
        "path": "/webhooks/mistral-ai/embeddings/generated",
        "payload": [
          { "name": "model", "type": "String", "selector": ["model"], "meta": { "description": "Model used for generating embeddings." } },
          { "name": "object", "type": "String", "selector": ["object"], "meta": { "description": "Object type, always 'list'." } },
          { "name": "usage_prompt_tokens", "type": "Integer", "selector": ["usage", "prompt_tokens"], "meta": { "description": "Tokens used to generate the embedding." } }
        ]
      }
    ]
  },
  {
    "handle": "models",
    "meta": {
      "short": "Models",
      "description": "List and retrieve available Mistral AI models."
    },
    "endpoint": {
      "value": "/models"
    },
    "fields": [
      {
        "name": "id",
        "type": "String",
        "selector": ["id"],
        "meta": { "description": "Model identifier." }
      },
      {
        "name": "object",
        "type": "String",
        "selector": ["object"],
        "meta": { "description": "Object type, always 'model'." }
      },
      {
        "name": "created",
        "type": "Integer",
        "selector": ["created"],
        "meta": { "description": "Unix timestamp when the model was created." }
      },
      {
        "name": "owned_by",
        "type": "String",
        "selector": ["owned_by"],
        "meta": { "description": "Organization that owns the model." }
      },
      {
        "name": "capabilities_completion_chat",
        "type": "Boolean",
        "selector": ["capabilities", "completion_chat"],
        "meta": { "description": "Whether the model supports chat completions." }
      },
      {
        "name": "capabilities_completion_fim",
        "type": "Boolean",
        "selector": ["capabilities", "completion_fim"],
        "meta": { "description": "Whether the model supports FIM completions." }
      },
      {
        "name": "capabilities_fine_tuning",
        "type": "Boolean",
        "selector": ["capabilities", "fine_tuning"],
        "meta": { "description": "Whether the model supports fine-tuning." }
      },
      {
        "name": "capabilities_vision",
        "type": "Boolean",
        "selector": ["capabilities", "vision"],
        "meta": { "description": "Whether the model supports vision/image inputs." }
      },
      {
        "name": "max_context_length",
        "type": "Integer",
        "selector": ["max_context_length"],
        "meta": { "description": "Maximum context window size in tokens." }
      },
      {
        "name": "deprecation",
        "type": "String",
        "selector": ["deprecation"],
        "meta": { "description": "Deprecation date of the model, if applicable." }
      }
    ],
    "operations": {
      "list": {
        "method": "GET",
        "path": { "value": "" },
        "headers": {},
        "queryParams": {},
        "bodyTemplate": null
      },
      "read": {
        "method": "GET",
        "path": {
          "value": "/{{modelId}}",
          "placeholders": [
            { "name": "modelId", "type": "String", "description": "The ID of the model to retrieve.", "required": true }
          ]
        },
        "headers": {},
        "queryParams": {},
        "bodyTemplate": null
      },
      "delete": {
        "method": "DELETE",
        "path": {
          "value": "/{{modelId}}",
          "placeholders": [
            { "name": "modelId", "type": "String", "description": "The ID of the fine-tuned model to delete.", "required": true }
          ]
        },
        "headers": {},
        "queryParams": {},
        "bodyTemplate": null
      }
    },
    "webhooks": [
      {
        "event": "model.deleted",
        "path": "/webhooks/mistral-ai/model/deleted",
        "payload": [
          { "name": "id", "type": "String", "selector": ["id"], "meta": { "description": "Model identifier." } },
          { "name": "owned_by", "type": "String", "selector": ["owned_by"], "meta": { "description": "Organization that owns the model." } }
        ]
      }
    ]
  },
  {
    "handle": "files",
    "meta": {
      "short": "Files",
      "description": "Upload and manage files used for fine-tuning and batch processing."
    },
    "endpoint": {
      "value": "/files"
    },
    "fields": [
      {
        "name": "id",
        "type": "String",
        "selector": ["id"],
        "meta": { "description": "Unique identifier for the file." }
      },
      {
        "name": "object",
        "type": "String",
        "selector": ["object"],
        "meta": { "description": "Object type, always 'file'." }
      },
      {
        "name": "size",
        "type": "Integer",
        "selector": ["size"],
        "meta": { "description": "Size of the file in bytes." }
      },
      {
        "name": "created_at",
        "type": "Integer",
        "selector": ["created_at"],
        "meta": { "description": "Unix timestamp when the file was created." }
      },
      {
        "name": "filename",
        "type": "String",
        "selector": ["filename"],
        "meta": { "description": "Name of the uploaded file." }
      },
      {
        "name": "purpose",
        "type": "String",
        "selector": ["purpose"],
        "meta": { "description": "Intended use of the file (fine-tune, batch)." }
      },
      {
        "name": "sample_type",
        "type": "String",
        "selector": ["sample_type"],
        "meta": { "description": "Type of samples in the file." }
      },
      {
        "name": "num_lines",
        "type": "Integer",
        "selector": ["num_lines"],
        "meta": { "description": "Number of lines in the file." }
      },
      {
        "name": "source",
        "type": "String",
        "selector": ["source"],
        "meta": { "description": "Source of the file (upload, repository, etc.)." }
      }
    ],
    "operations": {
      "list": {
        "method": "GET",
        "path": { "value": "" },
        "headers": {},
        "queryParams": {
          "page": { "type": "Integer", "description": "Page number for pagination." },
          "page_size": { "type": "Integer", "description": "Number of results per page." },
          "purpose": { "type": "String", "description": "Filter by file purpose (fine-tune, batch)." }
        },
        "bodyTemplate": null
      },
      "read": {
        "method": "GET",
        "path": {
          "value": "/{{fileId}}",
          "placeholders": [
            { "name": "fileId", "type": "String", "description": "The ID of the file to retrieve.", "required": true }
          ]
        },
        "headers": {},
        "queryParams": {},
        "bodyTemplate": null
      },
      "delete": {
        "method": "DELETE",
        "path": {
          "value": "/{{fileId}}",
          "placeholders": [
            { "name": "fileId", "type": "String", "description": "The ID of the file to delete.", "required": true }
          ]
        },
        "headers": {},
        "queryParams": {},
        "bodyTemplate": null
      }
    },
    "webhooks": [
      {
        "event": "file.uploaded",
        "path": "/webhooks/mistral-ai/file/uploaded",
        "payload": [
          { "name": "id", "type": "String", "selector": ["id"], "meta": { "description": "Unique identifier for the file." } },
          { "name": "filename", "type": "String", "selector": ["filename"], "meta": { "description": "Name of the uploaded file." } },
          { "name": "purpose", "type": "String", "selector": ["purpose"], "meta": { "description": "Intended use of the file (fine-tune, batch)." } },
          { "name": "size", "type": "Integer", "selector": ["size"], "meta": { "description": "Size of the file in bytes." } }
        ]
      },
      {
        "event": "file.deleted",
        "path": "/webhooks/mistral-ai/file/deleted",
        "payload": [
          { "name": "id", "type": "String", "selector": ["id"], "meta": { "description": "Unique identifier for the file." } }
        ]
      }
    ]
  },
  {
    "handle": "fine-tuning-jobs",
    "meta": {
      "short": "Fine-tuning Jobs",
      "description": "Create and manage fine-tuning jobs to customize Mistral models."
    },
    "endpoint": {
      "value": "/fine_tuning/jobs"
    },
    "fields": [
      {
        "name": "id",
        "type": "String",
        "selector": ["id"],
        "meta": { "description": "Unique identifier for the fine-tuning job." }
      },
      {
        "name": "object",
        "type": "String",
        "selector": ["object"],
        "meta": { "description": "Object type, always 'job'." }
      },
      {
        "name": "model",
        "type": "String",
        "selector": ["model"],
        "meta": { "description": "Base model to fine-tune." }
      },
      {
        "name": "status",
        "type": "String",
        "selector": ["status"],
        "meta": { "description": "Current status of the job (queued, running, succeeded, failed, cancelled)." }
      },
      {
        "name": "created_at",
        "type": "Integer",
        "selector": ["created_at"],
        "meta": { "description": "Unix timestamp when the job was created." }
      },
      {
        "name": "modified_at",
        "type": "Integer",
        "selector": ["modified_at"],
        "meta": { "description": "Unix timestamp when the job was last modified." }
      },
      {
        "name": "fine_tuned_model",
        "type": "String",
        "selector": ["fine_tuned_model"],
        "meta": { "description": "Name of the resulting fine-tuned model." }
      },
      {
        "name": "training_files",
        "type": "String",
        "selector": ["training_files", 0],
        "meta": { "description": "ID of the training file." },
        "multivalue": true
      },
      {
        "name": "validation_files",
        "type": "String",
        "selector": ["validation_files", 0],
        "meta": { "description": "ID of the validation file." },
        "multivalue": true
      },
      {
        "name": "hyperparameters_training_steps",
        "type": "Integer",
        "selector": ["hyperparameters", "training_steps"],
        "meta": { "description": "Number of training steps." }
      },
      {
        "name": "hyperparameters_learning_rate",
        "type": "Number",
        "selector": ["hyperparameters", "learning_rate"],
        "meta": { "description": "Learning rate multiplier." }
      },
      {
        "name": "trained_tokens",
        "type": "Integer",
        "selector": ["trained_tokens"],
        "meta": { "description": "Total tokens used for training." }
      },
      {
        "name": "job_type",
        "type": "String",
        "selector": ["job_type"],
        "meta": { "description": "Type of job (FT for fine-tuning)." }
      }
    ],
    "operations": {
      "list": {
        "method": "GET",
        "path": { "value": "" },
        "headers": {},
        "queryParams": {
          "page": { "type": "Integer", "description": "Page number." },
          "page_size": { "type": "Integer", "description": "Results per page." },
          "model": { "type": "String", "description": "Filter by model name." },
          "status": { "type": "String", "description": "Filter by job status." }
        },
        "bodyTemplate": null
      },
      "read": {
        "method": "GET",
        "path": {
          "value": "/{{jobId}}",
          "placeholders": [
            { "name": "jobId", "type": "String", "description": "The ID of the fine-tuning job.", "required": true }
          ]
        },
        "headers": {},
        "queryParams": {},
        "bodyTemplate": null
      },
      "create": {
        "method": "POST",
        "path": { "value": "" },
        "headers": { "Content-Type": "application/json" },
        "queryParams": {},
        "bodyTemplate": {
          "value": "{\"model\": \"{{model}}\", \"training_files\": [{\"file_id\": \"{{trainingFileId}}\", \"weight\": 1}], \"hyperparameters\": {\"training_steps\": {{trainingSteps}}, \"learning_rate\": {{learningRate}}}}",
          "placeholders": [
            { "name": "model", "type": "String", "description": "Base model to fine-tune.", "required": true },
            { "name": "trainingFileId", "type": "String", "description": "ID of the uploaded training file.", "required": true },
            { "name": "trainingSteps", "type": "Integer", "description": "Number of training steps.", "required": false, "default": "100" },
            { "name": "learningRate", "type": "Number", "description": "Learning rate.", "required": false, "default": "0.0001" }
          ]
        }
      },
      "delete": {
        "method": "DELETE",
        "path": {
          "value": "/{{jobId}}/cancel",
          "placeholders": [
            { "name": "jobId", "type": "String", "description": "The ID of the fine-tuning job to cancel.", "required": true }
          ]
        },
        "headers": {},
        "queryParams": {},
        "bodyTemplate": null
      }
    },
    "webhooks": [
      {
        "event": "fine_tuning_job.created",
        "path": "/webhooks/mistral-ai/fine_tuning_job/created",
        "payload": [
          { "name": "id", "type": "String", "selector": ["id"], "meta": { "description": "Unique identifier for the fine-tuning job." } },
          { "name": "status", "type": "String", "selector": ["status"], "meta": { "description": "Current status of the job." } },
          { "name": "model", "type": "String", "selector": ["model"], "meta": { "description": "Base model to fine-tune." } }
        ]
      },
      {
        "event": "fine_tuning_job.succeeded",
        "path": "/webhooks/mistral-ai/fine_tuning_job/succeeded",
        "payload": [
          { "name": "id", "type": "String", "selector": ["id"], "meta": { "description": "Unique identifier for the fine-tuning job." } },
          { "name": "status", "type": "String", "selector": ["status"], "meta": { "description": "Current status of the job." } },
          { "name": "fine_tuned_model", "type": "String", "selector": ["fine_tuned_model"], "meta": { "description": "Name of the resulting fine-tuned model." } },
          { "name": "trained_tokens", "type": "Integer", "selector": ["trained_tokens"], "meta": { "description": "Total tokens used for training." } }
        ]
      },
      {
        "event": "fine_tuning_job.failed",
        "path": "/webhooks/mistral-ai/fine_tuning_job/failed",
        "payload": [
          { "name": "id", "type": "String", "selector": ["id"], "meta": { "description": "Unique identifier for the fine-tuning job." } },
          { "name": "status", "type": "String", "selector": ["status"], "meta": { "description": "Current status of the job." } }
        ]
      }
    ]
  },
  {
    "handle": "batch-jobs",
    "meta": {
      "short": "Batch Jobs",
      "description": "Submit and manage high-volume batch inference requests."
    },
    "endpoint": {
      "value": "/batch/jobs"
    },
    "fields": [
      {
        "name": "id",
        "type": "String",
        "selector": ["id"],
        "meta": { "description": "Unique identifier for the batch job." }
      },
      {
        "name": "object",
        "type": "String",
        "selector": ["object"],
        "meta": { "description": "Object type, always 'batch'." }
      },
      {
        "name": "input_files",
        "type": "String",
        "selector": ["input_files", 0],
        "meta": { "description": "ID of the input file containing batch requests." },
        "multivalue": true
      },
      {
        "name": "endpoint",
        "type": "String",
        "selector": ["endpoint"],
        "meta": { "description": "API endpoint the batch requests target." }
      },
      {
        "name": "model",
        "type": "String",
        "selector": ["model"],
        "meta": { "description": "Model used for the batch requests." }
      },
      {
        "name": "status",
        "type": "String",
        "selector": ["status"],
        "meta": { "description": "Current batch job status (queued, running, success, failed, timeout, cancellation_requested, cancelled)." }
      },
      {
        "name": "created_at",
        "type": "Integer",
        "selector": ["created_at"],
        "meta": { "description": "Unix timestamp when the batch job was created." }
      },
      {
        "name": "completed_at",
        "type": "Integer",
        "selector": ["completed_at"],
        "meta": { "description": "Unix timestamp when the batch job completed." }
      },
      {
        "name": "total_requests",
        "type": "Integer",
        "selector": ["total_requests"],
        "meta": { "description": "Total number of requests in the batch." }
      },
      {
        "name": "completed_requests",
        "type": "Integer",
        "selector": ["completed_requests"],
        "meta": { "description": "Number of successfully completed requests." }
      },
      {
        "name": "failed_requests",
        "type": "Integer",
        "selector": ["failed_requests"],
        "meta": { "description": "Number of failed requests." }
      },
      {
        "name": "output_file",
        "type": "String",
        "selector": ["output_file"],
        "meta": { "description": "ID of the output results file." }
      },
      {
        "name": "error_file",
        "type": "String",
        "selector": ["error_file"],
        "meta": { "description": "ID of the error file." }
      }
    ],
    "operations": {
      "list": {
        "method": "GET",
        "path": { "value": "" },
        "headers": {},
        "queryParams": {
          "page": { "type": "Integer", "description": "Page number." },
          "page_size": { "type": "Integer", "description": "Results per page." },
          "model": { "type": "String", "description": "Filter by model." },
          "status": { "type": "String", "description": "Filter by job status." }
        },
        "bodyTemplate": null
      },
      "read": {
        "method": "GET",
        "path": {
          "value": "/{{jobId}}",
          "placeholders": [
            { "name": "jobId", "type": "String", "description": "The ID of the batch job.", "required": true }
          ]
        },
        "headers": {},
        "queryParams": {},
        "bodyTemplate": null
      },
      "create": {
        "method": "POST",
        "path": { "value": "" },
        "headers": { "Content-Type": "application/json" },
        "queryParams": {},
        "bodyTemplate": {
          "value": "{\"input_files\": [\"{{inputFileId}}\"], \"endpoint\": \"{{endpoint}}\", \"model\": \"{{model}}\"}",
          "placeholders": [
            { "name": "inputFileId", "type": "String", "description": "ID of the uploaded batch input file.", "required": true },
            { "name": "endpoint", "type": "String", "description": "Target endpoint (e.g. /v1/chat/completions).", "required": true },
            { "name": "model", "type": "String", "description": "Model to use for all requests in the batch.", "required": true }
          ]
        }
      },
      "delete": {
        "method": "DELETE",
        "path": {
          "value": "/{{jobId}}/cancel",
          "placeholders": [
            { "name": "jobId", "type": "String", "description": "The ID of the batch job to cancel.", "required": true }
          ]
        },
        "headers": {},
        "queryParams": {},
        "bodyTemplate": null
      }
    },
    "webhooks": [
      {
        "event": "batch_job.created",
        "path": "/webhooks/mistral-ai/batch_job/created",
        "payload": [
          { "name": "id", "type": "String", "selector": ["id"], "meta": { "description": "Unique identifier for the batch job." } },
          { "name": "status", "type": "String", "selector": ["status"], "meta": { "description": "Current batch job status." } },
          { "name": "model", "type": "String", "selector": ["model"], "meta": { "description": "Model used for the batch requests." } }
        ]
      },
      {
        "event": "batch_job.succeeded",
        "path": "/webhooks/mistral-ai/batch_job/succeeded",
        "payload": [
          { "name": "id", "type": "String", "selector": ["id"], "meta": { "description": "Unique identifier for the batch job." } },
          { "name": "status", "type": "String", "selector": ["status"], "meta": { "description": "Current batch job status." } },
          { "name": "output_file", "type": "String", "selector": ["output_file"], "meta": { "description": "ID of the output results file." } },
          { "name": "total_requests", "type": "Integer", "selector": ["total_requests"], "meta": { "description": "Total number of requests in the batch." } }
        ]
      },
      {
        "event": "batch_job.failed",
        "path": "/webhooks/mistral-ai/batch_job/failed",
        "payload": [
          { "name": "id", "type": "String", "selector": ["id"], "meta": { "description": "Unique identifier for the batch job." } },
          { "name": "status", "type": "String", "selector": ["status"], "meta": { "description": "Current batch job status." } },
          { "name": "error_file", "type": "String", "selector": ["error_file"], "meta": { "description": "ID of the error file." } }
        ]
      }
    ]
  },
  {
    "handle": "agents-completions",
    "meta": {
      "short": "Agents Completions",
      "description": "Interact with pre-built Mistral agents that can use tools and maintain memory."
    },
    "endpoint": {
      "value": "/agents/completions"
    },
    "fields": [
      {
        "name": "id",
        "type": "String",
        "selector": ["id"],
        "meta": { "description": "Unique identifier for the agent completion." }
      },
      {
        "name": "object",
        "type": "String",
        "selector": ["object"],
        "meta": { "description": "Object type." }
      },
      {
        "name": "created",
        "type": "Integer",
        "selector": ["created"],
        "meta": { "description": "Unix timestamp when the response was created." }
      },
      {
        "name": "model",
        "type": "String",
        "selector": ["model"],
        "meta": { "description": "Model underlying the agent." }
      },
      {
        "name": "choices_message_role",
        "type": "String",
        "selector": ["choices", 0, "message", "role"],
        "meta": { "description": "Role of the response message." },
        "multivalue": true
      },
      {
        "name": "choices_message_content",
        "type": "String",
        "selector": ["choices", 0, "message", "content"],
        "meta": { "description": "Content of the agent response." },
        "multivalue": true
      },
      {
        "name": "choices_finish_reason",
        "type": "String",
        "selector": ["choices", 0, "finish_reason"],
        "meta": { "description": "Reason the generation stopped." },
        "multivalue": true
      },
      {
        "name": "usage_total_tokens",
        "type": "Integer",
        "selector": ["usage", "total_tokens"],
        "meta": { "description": "Total tokens used." }
      }
    ],
    "operations": {
      "create": {
        "method": "POST",
        "path": { "value": "" },
        "headers": { "Content-Type": "application/json" },
        "queryParams": {},
        "bodyTemplate": {
          "value": "{\"agent_id\": \"{{agentId}}\", \"messages\": [{\"role\": \"user\", \"content\": \"{{content}}\"}]}",
          "placeholders": [
            { "name": "agentId", "type": "String", "description": "ID of the agent to interact with.", "required": true },
            { "name": "content", "type": "String", "description": "User message content.", "required": true }
          ]
        }
      }
    },
    "webhooks": [
      {
        "event": "agent_completion.created",
        "path": "/webhooks/mistral-ai/agent_completion/created",
        "payload": [
          { "name": "id", "type": "String", "selector": ["id"], "meta": { "description": "Unique identifier for the agent completion." } },
          { "name": "model", "type": "String", "selector": ["model"], "meta": { "description": "Model underlying the agent." } },
          { "name": "content", "type": "String", "selector": ["choices", 0, "message", "content"], "meta": { "description": "Content of the agent response." } },
          { "name": "usage_total_tokens", "type": "Integer", "selector": ["usage", "total_tokens"], "meta": { "description": "Total tokens used." } }
        ]
      }
    ]
  },
  {
    "handle": "ocr",
    "meta": {
      "short": "OCR",
      "description": "Extract text and structured content from documents and images using Mistral OCR."
    },
    "endpoint": {
      "value": "/ocr"
    },
    "fields": [
      {
        "name": "pages_index",
        "type": "Integer",
        "selector": ["pages", 0, "index"],
        "meta": { "description": "Page index of the processed document." },
        "multivalue": true
      },
      {
        "name": "pages_markdown",
        "type": "String",
        "selector": ["pages", 0, "markdown"],
        "meta": { "description": "Extracted text in markdown format for this page." },
        "multivalue": true
      },
      {
        "name": "pages_width",
        "type": "Integer",
        "selector": ["pages", 0, "dimensions", "width"],
        "meta": { "description": "Width of the page in pixels." },
        "multivalue": true
      },
      {
        "name": "pages_height",
        "type": "Integer",
        "selector": ["pages", 0, "dimensions", "height"],
        "meta": { "description": "Height of the page in pixels." },
        "multivalue": true
      },
      {
        "name": "model",
        "type": "String",
        "selector": ["model"],
        "meta": { "description": "OCR model used for processing." }
      },
      {
        "name": "usage_pages_processed",
        "type": "Integer",
        "selector": ["usage_info", "pages_processed"],
        "meta": { "description": "Number of pages processed." }
      },
      {
        "name": "usage_doc_size_bytes",
        "type": "Integer",
        "selector": ["usage_info", "doc_size_bytes"],
        "meta": { "description": "Size of the processed document in bytes." }
      }
    ],
    "operations": {
      "create": {
        "method": "POST",
        "path": { "value": "" },
        "headers": { "Content-Type": "application/json" },
        "queryParams": {},
        "bodyTemplate": {
          "value": "{\"model\": \"{{model}}\", \"document\": {\"type\": \"{{documentType}}\", \"document_url\": \"{{documentUrl}}\"}}",
          "placeholders": [
            { "name": "model", "type": "String", "description": "OCR model ID (e.g. mistral-ocr-latest).", "required": true },
            { "name": "documentType", "type": "String", "description": "Type of document input (document_url, image_url).", "required": true },
            { "name": "documentUrl", "type": "String", "description": "URL of the document or image to process.", "required": true }
          ]
        }
      }
    },
    "webhooks": [
      {
        "event": "ocr.completed",
        "path": "/webhooks/mistral-ai/ocr/completed",
        "payload": [
          { "name": "model", "type": "String", "selector": ["model"], "meta": { "description": "OCR model used for processing." } },
          { "name": "pages_processed", "type": "Integer", "selector": ["usage_info", "pages_processed"], "meta": { "description": "Number of pages processed." } },
          { "name": "doc_size_bytes", "type": "Integer", "selector": ["usage_info", "doc_size_bytes"], "meta": { "description": "Size of the processed document in bytes." } }
        ]
      }
    ]
  }
]
```

<p align="center"><a class="button primary" data-icon="square-caret-right">Try @Human</a><a class="button primary" data-icon="check">Buy @Human Subscription</a><a class="button primary" data-icon="comments">Join @Human Community</a></p>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.planetcrust.com/human-connections/mistral-ai/mistral-ai.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
