Aliases pointing to this version.













Beta Prompts Endpoints
(beta) Prompts API.












Examples
Real world code examples
ListPrompts
GET /v2/prompts#
ListPrompts
Playground
Test the endpoints live
import { Mistral } from "@mistralai/mistralai";
const mistral = new Mistral({
apiKey: "MISTRAL_API_KEY",
});
async function run() {
const result = await mistral.beta.prompts.list();
for await (const page of result) {
console.log(page);
}
}
run();
import { Mistral } from "@mistralai/mistralai";
const mistral = new Mistral({
apiKey: "MISTRAL_API_KEY",
});
async function run() {
const result = await mistral.beta.prompts.list();
for await (const page of result) {
console.log(page);
}
}
run();
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
res = mistral.beta.prompts.list()
while res is not None:
# Handle items
res = res.next()
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
res = mistral.beta.prompts.list()
while res is not None:
# Handle items
res = res.next()
curl https://api.mistral.ai/v2/prompts \
-X GET \
-H 'Authorization: Bearer YOUR_APIKEY_HERE'curl https://api.mistral.ai/v2/prompts \
-X GET \
-H 'Authorization: Bearer YOUR_APIKEY_HERE'200
{
"data": [
{
"id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
"name": "support-answer-style",
"definition": {
"content": "Write a concise support answer for {{customer_name}} about {{issue}}.",
"variables": [
{
"name": "customer_name"
},
{
"name": "issue"
}
]
},
"version": 1,
"notes": "Initial prompt version.",
"aliases": [
"production"
],
"sharingScope": "workspace",
"createdAt": "2025-01-15T09:30:00Z",
"updatedAt": "2025-01-15T10:00:00Z",
"latestVersion": 1,
"title": "Support answer style",
"description": "Prompt used by the support assistant."
}
],
"nextPageToken": "eyJwYWdlIjoyfQ=="
}{
"data": [
{
"id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
"name": "support-answer-style",
"definition": {
"content": "Write a concise support answer for {{customer_name}} about {{issue}}.",
"variables": [
{
"name": "customer_name"
},
{
"name": "issue"
}
]
},
"version": 1,
"notes": "Initial prompt version.",
"aliases": [
"production"
],
"sharingScope": "workspace",
"createdAt": "2025-01-15T09:30:00Z",
"updatedAt": "2025-01-15T10:00:00Z",
"latestVersion": 1,
"title": "Support answer style",
"description": "Prompt used by the support assistant."
}
],
"nextPageToken": "eyJwYWdlIjoyfQ=="
}CreatePrompt
POST /v2/prompts#
CreatePrompt
Playground
Test the endpoints live
import { Mistral } from "@mistralai/mistralai";
const mistral = new Mistral({
apiKey: "MISTRAL_API_KEY",
});
async function run() {
const result = await mistral.beta.prompts.create({
name: "<value>",
definition: {
content: "<value>",
},
});
console.log(result);
}
run();
import { Mistral } from "@mistralai/mistralai";
const mistral = new Mistral({
apiKey: "MISTRAL_API_KEY",
});
async function run() {
const result = await mistral.beta.prompts.create({
name: "<value>",
definition: {
content: "<value>",
},
});
console.log(result);
}
run();
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
res = mistral.beta.prompts.create(name="<value>", definition={
"content": "<value>",
})
# Handle response
print(res)
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
res = mistral.beta.prompts.create(name="<value>", definition={
"content": "<value>",
})
# Handle response
print(res)
curl https://api.mistral.ai/v2/prompts \
-X POST \
-H 'Authorization: Bearer YOUR_APIKEY_HERE' \
-H 'Content-Type: application/json' \
-d '{
"definition": {
"content": "Example content."
},
"name": "My resource"
}'curl https://api.mistral.ai/v2/prompts \
-X POST \
-H 'Authorization: Bearer YOUR_APIKEY_HERE' \
-H 'Content-Type: application/json' \
-d '{
"definition": {
"content": "Example content."
},
"name": "My resource"
}'200
{
"id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
"name": "support-answer-style",
"definition": {
"content": "Write a concise support answer for {{customer_name}} about {{issue}}.",
"variables": [
{
"name": "customer_name"
},
{
"name": "issue"
}
]
},
"version": 1,
"notes": "Initial prompt version.",
"aliases": [
"production"
],
"sharingScope": "workspace",
"createdAt": "2025-01-15T09:30:00Z",
"updatedAt": "2025-01-15T10:00:00Z",
"latestVersion": 1,
"title": "Support answer style",
"description": "Prompt used by the support assistant."
}{
"id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
"name": "support-answer-style",
"definition": {
"content": "Write a concise support answer for {{customer_name}} about {{issue}}.",
"variables": [
{
"name": "customer_name"
},
{
"name": "issue"
}
]
},
"version": 1,
"notes": "Initial prompt version.",
"aliases": [
"production"
],
"sharingScope": "workspace",
"createdAt": "2025-01-15T09:30:00Z",
"updatedAt": "2025-01-15T10:00:00Z",
"latestVersion": 1,
"title": "Support answer style",
"description": "Prompt used by the support assistant."
}GetPrompt
GET /v2/prompts/{prompt_id}#
GetPrompt
Playground
Test the endpoints live
import { Mistral } from "@mistralai/mistralai";
const mistral = new Mistral({
apiKey: "MISTRAL_API_KEY",
});
async function run() {
const result = await mistral.beta.prompts.get({
promptId: "<id>",
version: 1,
});
console.log(result);
}
run();
import { Mistral } from "@mistralai/mistralai";
const mistral = new Mistral({
apiKey: "MISTRAL_API_KEY",
});
async function run() {
const result = await mistral.beta.prompts.get({
promptId: "<id>",
version: 1,
});
console.log(result);
}
run();
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
res = mistral.beta.prompts.get(prompt_id="<id>", version=1)
# Handle response
print(res)
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
res = mistral.beta.prompts.get(prompt_id="<id>", version=1)
# Handle response
print(res)
curl https://api.mistral.ai/v2/prompts/{prompt_id} \
-X GET \
-H 'Authorization: Bearer YOUR_APIKEY_HERE'curl https://api.mistral.ai/v2/prompts/{prompt_id} \
-X GET \
-H 'Authorization: Bearer YOUR_APIKEY_HERE'200
{
"id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
"name": "support-answer-style",
"definition": {
"content": "Write a concise support answer for {{customer_name}} about {{issue}}.",
"variables": [
{
"name": "customer_name"
},
{
"name": "issue"
}
]
},
"version": 1,
"notes": "Initial prompt version.",
"aliases": [
"production"
],
"sharingScope": "workspace",
"createdAt": "2025-01-15T09:30:00Z",
"updatedAt": "2025-01-15T10:00:00Z",
"latestVersion": 1,
"title": "Support answer style",
"description": "Prompt used by the support assistant."
}{
"id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
"name": "support-answer-style",
"definition": {
"content": "Write a concise support answer for {{customer_name}} about {{issue}}.",
"variables": [
{
"name": "customer_name"
},
{
"name": "issue"
}
]
},
"version": 1,
"notes": "Initial prompt version.",
"aliases": [
"production"
],
"sharingScope": "workspace",
"createdAt": "2025-01-15T09:30:00Z",
"updatedAt": "2025-01-15T10:00:00Z",
"latestVersion": 1,
"title": "Support answer style",
"description": "Prompt used by the support assistant."
}Playground
Test the endpoints live
import { Mistral } from "@mistralai/mistralai";
const mistral = new Mistral({
apiKey: "MISTRAL_API_KEY",
});
async function run() {
const result = await mistral.beta.prompts.delete({
promptId: "<id>",
});
console.log(result);
}
run();
import { Mistral } from "@mistralai/mistralai";
const mistral = new Mistral({
apiKey: "MISTRAL_API_KEY",
});
async function run() {
const result = await mistral.beta.prompts.delete({
promptId: "<id>",
});
console.log(result);
}
run();
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
res = mistral.beta.prompts.delete(prompt_id="<id>")
# Handle response
print(res)
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
res = mistral.beta.prompts.delete(prompt_id="<id>")
# Handle response
print(res)
curl https://api.mistral.ai/v2/prompts/{prompt_id} \
-X DELETE \
-H 'Authorization: Bearer YOUR_APIKEY_HERE' \
-H 'Content-Type: application/json'curl https://api.mistral.ai/v2/prompts/{prompt_id} \
-X DELETE \
-H 'Authorization: Bearer YOUR_APIKEY_HERE' \
-H 'Content-Type: application/json'200
{}{}UpdatePrompt
PATCH /v2/prompts/{prompt_id}#
UpdatePrompt
Playground
Test the endpoints live
import { Mistral } from "@mistralai/mistralai";
const mistral = new Mistral({
apiKey: "MISTRAL_API_KEY",
});
async function run() {
const result = await mistral.beta.prompts.updateMetadata("<id>", {});
console.log(result);
}
run();
import { Mistral } from "@mistralai/mistralai";
const mistral = new Mistral({
apiKey: "MISTRAL_API_KEY",
});
async function run() {
const result = await mistral.beta.prompts.updateMetadata("<id>", {});
console.log(result);
}
run();
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
res = mistral.beta.prompts.update_metadata(prompt_id="<id>")
# Handle response
print(res)
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
res = mistral.beta.prompts.update_metadata(prompt_id="<id>")
# Handle response
print(res)
curl https://api.mistral.ai/v2/prompts/{prompt_id} \
-X PATCH \
-H 'Authorization: Bearer YOUR_APIKEY_HERE' \
-H 'Content-Type: application/json' \
-d '{}'curl https://api.mistral.ai/v2/prompts/{prompt_id} \
-X PATCH \
-H 'Authorization: Bearer YOUR_APIKEY_HERE' \
-H 'Content-Type: application/json' \
-d '{}'200
{
"id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
"name": "support-answer-style",
"definition": {
"content": "Write a concise support answer for {{customer_name}} about {{issue}}.",
"variables": [
{
"name": "customer_name"
},
{
"name": "issue"
}
]
},
"version": 1,
"notes": "Initial prompt version.",
"aliases": [
"production"
],
"sharingScope": "workspace",
"createdAt": "2025-01-15T09:30:00Z",
"updatedAt": "2025-01-15T10:00:00Z",
"latestVersion": 1,
"title": "Support answer style",
"description": "Prompt used by the support assistant."
}{
"id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
"name": "support-answer-style",
"definition": {
"content": "Write a concise support answer for {{customer_name}} about {{issue}}.",
"variables": [
{
"name": "customer_name"
},
{
"name": "issue"
}
]
},
"version": 1,
"notes": "Initial prompt version.",
"aliases": [
"production"
],
"sharingScope": "workspace",
"createdAt": "2025-01-15T09:30:00Z",
"updatedAt": "2025-01-15T10:00:00Z",
"latestVersion": 1,
"title": "Support answer style",
"description": "Prompt used by the support assistant."
}ListPromptVersions
GET /v2/prompts/{prompt_id}/versions#
ListPromptVersions
200
Success
data#
Playground
Test the endpoints live
import { Mistral } from "@mistralai/mistralai";
const mistral = new Mistral({
apiKey: "MISTRAL_API_KEY",
});
async function run() {
const result = await mistral.beta.prompts.listVersions({
promptId: "<id>",
});
console.log(result);
}
run();
import { Mistral } from "@mistralai/mistralai";
const mistral = new Mistral({
apiKey: "MISTRAL_API_KEY",
});
async function run() {
const result = await mistral.beta.prompts.listVersions({
promptId: "<id>",
});
console.log(result);
}
run();
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
res = mistral.beta.prompts.list_versions(prompt_id="<id>")
# Handle response
print(res)
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
res = mistral.beta.prompts.list_versions(prompt_id="<id>")
# Handle response
print(res)
curl https://api.mistral.ai/v2/prompts/{prompt_id}/versions \
-X GET \
-H 'Authorization: Bearer YOUR_APIKEY_HERE'curl https://api.mistral.ai/v2/prompts/{prompt_id}/versions \
-X GET \
-H 'Authorization: Bearer YOUR_APIKEY_HERE'200
{
"data": [
{
"version": 1,
"definition": {
"content": "Write a concise support answer for {{customer_name}} about {{issue}}.",
"variables": [
{
"name": "customer_name"
},
{
"name": "issue"
}
]
},
"notes": "Initial prompt version.",
"aliases": [
"production"
],
"createdAt": "2025-01-15T09:30:00Z"
}
]
}{
"data": [
{
"version": 1,
"definition": {
"content": "Write a concise support answer for {{customer_name}} about {{issue}}.",
"variables": [
{
"name": "customer_name"
},
{
"name": "issue"
}
]
},
"notes": "Initial prompt version.",
"aliases": [
"production"
],
"createdAt": "2025-01-15T09:30:00Z"
}
]
}CreatePromptVersion
POST /v2/prompts/{prompt_id}/versions#
CreatePromptVersion
Playground
Test the endpoints live
import { Mistral } from "@mistralai/mistralai";
const mistral = new Mistral({
apiKey: "MISTRAL_API_KEY",
});
async function run() {
const result = await mistral.beta.prompts.createVersion("<id>", {
definition: {
content: "<value>",
},
});
console.log(result);
}
run();
import { Mistral } from "@mistralai/mistralai";
const mistral = new Mistral({
apiKey: "MISTRAL_API_KEY",
});
async function run() {
const result = await mistral.beta.prompts.createVersion("<id>", {
definition: {
content: "<value>",
},
});
console.log(result);
}
run();
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
res = mistral.beta.prompts.create_version(prompt_id="<id>", definition={
"content": "<value>",
})
# Handle response
print(res)
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
res = mistral.beta.prompts.create_version(prompt_id="<id>", definition={
"content": "<value>",
})
# Handle response
print(res)
curl https://api.mistral.ai/v2/prompts/{prompt_id}/versions \
-X POST \
-H 'Authorization: Bearer YOUR_APIKEY_HERE' \
-H 'Content-Type: application/json' \
-d '{
"definition": {
"content": "Example content."
}
}'curl https://api.mistral.ai/v2/prompts/{prompt_id}/versions \
-X POST \
-H 'Authorization: Bearer YOUR_APIKEY_HERE' \
-H 'Content-Type: application/json' \
-d '{
"definition": {
"content": "Example content."
}
}'200
{
"version": 2,
"deduplicated": false
}{
"version": 2,
"deduplicated": false
}GetPromptVersion
GET /v2/prompts/{prompt_id}/versions/{version}#
GetPromptVersion
Playground
Test the endpoints live
import { Mistral } from "@mistralai/mistralai";
const mistral = new Mistral({
apiKey: "MISTRAL_API_KEY",
});
async function run() {
const result = await mistral.beta.prompts.getVersion({
promptId: "<id>",
version: 1,
});
console.log(result);
}
run();
import { Mistral } from "@mistralai/mistralai";
const mistral = new Mistral({
apiKey: "MISTRAL_API_KEY",
});
async function run() {
const result = await mistral.beta.prompts.getVersion({
promptId: "<id>",
version: 1,
});
console.log(result);
}
run();
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
res = mistral.beta.prompts.get_version(prompt_id="<id>", version=1)
# Handle response
print(res)
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
res = mistral.beta.prompts.get_version(prompt_id="<id>", version=1)
# Handle response
print(res)
curl https://api.mistral.ai/v2/prompts/{prompt_id}/versions/{version} \
-X GET \
-H 'Authorization: Bearer YOUR_APIKEY_HERE'curl https://api.mistral.ai/v2/prompts/{prompt_id}/versions/{version} \
-X GET \
-H 'Authorization: Bearer YOUR_APIKEY_HERE'200
{
"id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
"name": "support-answer-style",
"definition": {
"content": "Write a concise support answer for {{customer_name}} about {{issue}}.",
"variables": [
{
"name": "customer_name"
},
{
"name": "issue"
}
]
},
"version": 1,
"notes": "Initial prompt version.",
"aliases": [
"production"
],
"sharingScope": "workspace",
"createdAt": "2025-01-15T09:30:00Z",
"updatedAt": "2025-01-15T10:00:00Z",
"latestVersion": 1,
"title": "Support answer style",
"description": "Prompt used by the support assistant."
}{
"id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
"name": "support-answer-style",
"definition": {
"content": "Write a concise support answer for {{customer_name}} about {{issue}}.",
"variables": [
{
"name": "customer_name"
},
{
"name": "issue"
}
]
},
"version": 1,
"notes": "Initial prompt version.",
"aliases": [
"production"
],
"sharingScope": "workspace",
"createdAt": "2025-01-15T09:30:00Z",
"updatedAt": "2025-01-15T10:00:00Z",
"latestVersion": 1,
"title": "Support answer style",
"description": "Prompt used by the support assistant."
}UpdatePromptVersionMetadata
PATCH /v2/prompts/{prompt_id}/versions/{version}#
UpdatePromptVersionMetadata
Playground
Test the endpoints live
import { Mistral } from "@mistralai/mistralai";
const mistral = new Mistral({
apiKey: "MISTRAL_API_KEY",
});
async function run() {
const result = await mistral.beta.prompts.updateVersionMetadata("<id>", 1, {});
console.log(result);
}
run();
import { Mistral } from "@mistralai/mistralai";
const mistral = new Mistral({
apiKey: "MISTRAL_API_KEY",
});
async function run() {
const result = await mistral.beta.prompts.updateVersionMetadata("<id>", 1, {});
console.log(result);
}
run();
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
res = mistral.beta.prompts.update_version_metadata(prompt_id="<id>", version=1)
# Handle response
print(res)
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
res = mistral.beta.prompts.update_version_metadata(prompt_id="<id>", version=1)
# Handle response
print(res)
curl https://api.mistral.ai/v2/prompts/{prompt_id}/versions/{version} \
-X PATCH \
-H 'Authorization: Bearer YOUR_APIKEY_HERE' \
-H 'Content-Type: application/json' \
-d '{}'curl https://api.mistral.ai/v2/prompts/{prompt_id}/versions/{version} \
-X PATCH \
-H 'Authorization: Bearer YOUR_APIKEY_HERE' \
-H 'Content-Type: application/json' \
-d '{}'200
{
"id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
"name": "support-answer-style",
"definition": {
"content": "Write a concise support answer for {{customer_name}} about {{issue}}.",
"variables": [
{
"name": "customer_name"
},
{
"name": "issue"
}
]
},
"version": 1,
"notes": "Promote this version after support review.",
"aliases": [
"production"
],
"sharingScope": "workspace",
"createdAt": "2025-01-15T09:30:00Z",
"updatedAt": "2025-01-15T10:00:00Z",
"latestVersion": 1,
"title": "Support answer style",
"description": "Prompt used by the support assistant."
}{
"id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
"name": "support-answer-style",
"definition": {
"content": "Write a concise support answer for {{customer_name}} about {{issue}}.",
"variables": [
{
"name": "customer_name"
},
{
"name": "issue"
}
]
},
"version": 1,
"notes": "Promote this version after support review.",
"aliases": [
"production"
],
"sharingScope": "workspace",
"createdAt": "2025-01-15T09:30:00Z",
"updatedAt": "2025-01-15T10:00:00Z",
"latestVersion": 1,
"title": "Support answer style",
"description": "Prompt used by the support assistant."
}