Token de continuation opaque pour la page suivante. Transmettez-le en tant que page_token pour récupérer la page suivante. Null lorsqu'il n'y a plus de résultats. Préférez ceci au paramètre obsolète de décalage page.













Bibliothèques bêta
API Libraries (bêta) pour créer et gérer des bibliothèques - indexez vos documents afin d'améliorer les capacités des agents.












Exemples
Exemples réels de code
Lister toutes les bibliothèques auxquelles vous avez accès.
GET /v1/libraries#
Lister toutes les bibliothèques que vous avez créées ou qui ont été partagées avec vous.
200
Réponse réussie
next_page_token#
pagination#
Obsolète : métadonnées de pagination par décalage. Renseignées uniquement pour les appelants utilisant le paramètre obsolète page ; omises lorsque page_token est utilisé. Pendant le déploiement du filtrage RBAC, total_items est une estimation approximative (nombre de candidats avant les vérifications par bibliothèque). Utilisez next_page_token à la place — ce champ sera supprimé une fois la pagination par décalage retirée.
Playground
Testez les endpoints en direct
import { Mistral } from "@mistralai/mistralai";
const mistral = new Mistral({
apiKey: "MISTRAL_API_KEY",
});
async function run() {
const result = await mistral.beta.libraries.list({});
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.libraries.list({});
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.libraries.list(page_size=100, page=0)
# 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.libraries.list(page_size=100, page=0)
# Handle response
print(res)
curl https://api.mistral.ai/v1/libraries \
-X GET \
-H 'Authorization: Bearer YOUR_APIKEY_HERE'curl https://api.mistral.ai/v1/libraries \
-X GET \
-H 'Authorization: Bearer YOUR_APIKEY_HERE'200
{
"data": [
{
"chunk_size": null,
"created_at": "2025-12-17T10:25:07.818693Z",
"id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
"name": "My resource",
"nb_documents": "426",
"owner_id": null,
"owner_type": "User",
"total_size": "6436546",
"updated_at": "2025-12-17T10:41:03.469341Z"
}
]
}{
"data": [
{
"chunk_size": null,
"created_at": "2025-12-17T10:25:07.818693Z",
"id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
"name": "My resource",
"nb_documents": "426",
"owner_id": null,
"owner_type": "User",
"total_size": "6436546",
"updated_at": "2025-12-17T10:41:03.469341Z"
}
]
}Créer une nouvelle bibliothèque.
POST /v1/libraries#
Créer une nouvelle bibliothèque, vous serez désigné comme le propriétaire et seul vous aurez la possibilité de la partager avec d'autres. Lors de sa création initiale, elle ne sera accessible que par vous.
chunk_size#
La taille des morceaux (en caractères) pour diviser le texte du document. Doit être comprise entre 256 et 32768.
description#
owner_type#
Détermine le propriétaire de la bibliothèque créée. 'User' crée une bibliothèque privée accessible uniquement à son propriétaire. 'Workspace' crée une bibliothèque partagée avec l'espace de travail. La valeur par défaut est 'Workspace' pour les sessions avec une clé API. Seules les clés API avec le périmètre d'accès 'Private and shared connectors' peuvent créer des bibliothèques privées, appartenant à l'utilisateur.
Playground
Testez les endpoints en direct
import { Mistral } from "@mistralai/mistralai";
const client = new Mistral({ apiKey: process.env.MISTRAL_API_KEY });
const library = await client.beta.libraries.create({
name: "Product documentation",
});
console.log(library.id);
import { Mistral } from "@mistralai/mistralai";
const client = new Mistral({ apiKey: process.env.MISTRAL_API_KEY });
const library = await client.beta.libraries.create({
name: "Product documentation",
});
console.log(library.id);
import os
from mistralai import Mistral
client = Mistral(api_key=os.environ["MISTRAL_API_KEY"])
library = client.beta.libraries.create(name="Product documentation")
print(library.id)
import os
from mistralai import Mistral
client = Mistral(api_key=os.environ["MISTRAL_API_KEY"])
library = client.beta.libraries.create(name="Product documentation")
print(library.id)
curl https://api.mistral.ai/v1/libraries \
-X POST \
-H 'Authorization: Bearer YOUR_APIKEY_HERE' \
-H 'Content-Type: application/json' \
-d '{
"name": "My Library"
}'curl https://api.mistral.ai/v1/libraries \
-X POST \
-H 'Authorization: Bearer YOUR_APIKEY_HERE' \
-H 'Content-Type: application/json' \
-d '{
"name": "My Library"
}'201
{
"chunk_size": null,
"created_at": "2025-12-17T10:25:07.818693Z",
"id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
"name": "My resource",
"nb_documents": "426",
"owner_id": null,
"owner_type": "User",
"total_size": "6436546",
"updated_at": "2025-12-17T10:41:03.469341Z"
}{
"chunk_size": null,
"created_at": "2025-12-17T10:25:07.818693Z",
"id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
"name": "My resource",
"nb_documents": "426",
"owner_id": null,
"owner_type": "User",
"total_size": "6436546",
"updated_at": "2025-12-17T10:41:03.469341Z"
}Informations détaillées sur une bibliothèque spécifique.
GET /v1/libraries/{library_id}#
Étant donné un identifiant de bibliothèque, fournit des informations détaillées sur cette bibliothèque.
Playground
Testez les endpoints en direct
import { Mistral } from "@mistralai/mistralai";
const mistral = new Mistral({
apiKey: "MISTRAL_API_KEY",
});
async function run() {
const result = await mistral.beta.libraries.get({
libraryId: "d0d23a1e-bfe5-45e7-b7bb-22a4ea78d47f",
});
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.libraries.get({
libraryId: "d0d23a1e-bfe5-45e7-b7bb-22a4ea78d47f",
});
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.libraries.get(library_id="d0d23a1e-bfe5-45e7-b7bb-22a4ea78d47f")
# 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.libraries.get(library_id="d0d23a1e-bfe5-45e7-b7bb-22a4ea78d47f")
# Handle response
print(res)
curl https://api.mistral.ai/v1/libraries/{library_id} \
-X GET \
-H 'Authorization: Bearer YOUR_APIKEY_HERE'curl https://api.mistral.ai/v1/libraries/{library_id} \
-X GET \
-H 'Authorization: Bearer YOUR_APIKEY_HERE'200
{
"chunk_size": null,
"created_at": "2025-12-17T10:25:07.818693Z",
"id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
"name": "My resource",
"nb_documents": "426",
"owner_id": null,
"owner_type": "User",
"total_size": "6436546",
"updated_at": "2025-12-17T10:41:03.469341Z"
}{
"chunk_size": null,
"created_at": "2025-12-17T10:25:07.818693Z",
"id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
"name": "My resource",
"nb_documents": "426",
"owner_id": null,
"owner_type": "User",
"total_size": "6436546",
"updated_at": "2025-12-17T10:41:03.469341Z"
}Mettre à jour une bibliothèque.
PUT /v1/libraries/{library_id}#
Étant donné un identifiant de bibliothèque, vous pouvez mettre à jour le nom et la description.
Playground
Testez les endpoints en direct
import { Mistral } from "@mistralai/mistralai";
const mistral = new Mistral({
apiKey: "MISTRAL_API_KEY",
});
async function run() {
const result = await mistral.beta.libraries.librariesUpdateV1({
libraryId: "e01880c3-d0b5-4a29-8b1b-abdb8ce917e4",
updateLibraryRequest: {},
});
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.libraries.librariesUpdateV1({
libraryId: "e01880c3-d0b5-4a29-8b1b-abdb8ce917e4",
updateLibraryRequest: {},
});
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.libraries.libraries_update_v1(library_id="e01880c3-d0b5-4a29-8b1b-abdb8ce917e4")
# 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.libraries.libraries_update_v1(library_id="e01880c3-d0b5-4a29-8b1b-abdb8ce917e4")
# Handle response
print(res)
curl https://api.mistral.ai/v1/libraries/{library_id} \
-X PUT \
-H 'Authorization: Bearer YOUR_APIKEY_HERE' \
-H 'Content-Type: application/json' \
-d '{}'curl https://api.mistral.ai/v1/libraries/{library_id} \
-X PUT \
-H 'Authorization: Bearer YOUR_APIKEY_HERE' \
-H 'Content-Type: application/json' \
-d '{}'200
{
"chunk_size": null,
"created_at": "2025-12-17T10:25:07.818693Z",
"id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
"name": "My resource",
"nb_documents": "426",
"owner_id": null,
"owner_type": "User",
"total_size": "6436546",
"updated_at": "2025-12-17T10:41:03.469341Z"
}{
"chunk_size": null,
"created_at": "2025-12-17T10:25:07.818693Z",
"id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
"name": "My resource",
"nb_documents": "426",
"owner_id": null,
"owner_type": "User",
"total_size": "6436546",
"updated_at": "2025-12-17T10:41:03.469341Z"
}Supprimer une bibliothèque et tous ses documents.
DELETE /v1/libraries/{library_id}#
Étant donné un identifiant de bibliothèque, la supprime ainsi que tous les documents qui y ont été téléversés. Avertissement : la réponse passera de 200 (renvoyant la bibliothèque supprimée) à 204 No Content dans une version future.
Playground
Testez les endpoints en direct
import { Mistral } from "@mistralai/mistralai";
const mistral = new Mistral({
apiKey: "MISTRAL_API_KEY",
});
async function run() {
const result = await mistral.beta.libraries.delete({
libraryId: "6cad0b6e-fd2e-4d11-a48b-21d30fb7c17a",
});
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.libraries.delete({
libraryId: "6cad0b6e-fd2e-4d11-a48b-21d30fb7c17a",
});
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.libraries.delete(library_id="6cad0b6e-fd2e-4d11-a48b-21d30fb7c17a")
assert res is not None
# 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.libraries.delete(library_id="6cad0b6e-fd2e-4d11-a48b-21d30fb7c17a")
assert res is not None
# Handle response
print(res)
curl https://api.mistral.ai/v1/libraries/{library_id} \
-X DELETE \
-H 'Authorization: Bearer YOUR_APIKEY_HERE' \
-H 'Content-Type: application/json'curl https://api.mistral.ai/v1/libraries/{library_id} \
-X DELETE \
-H 'Authorization: Bearer YOUR_APIKEY_HERE' \
-H 'Content-Type: application/json'200
{
"chunk_size": null,
"created_at": "2025-12-17T10:25:07.818693Z",
"id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
"name": "My resource",
"nb_documents": "426",
"owner_id": null,
"owner_type": "User",
"total_size": "6436546",
"updated_at": "2025-12-17T10:41:03.469341Z"
}{
"chunk_size": null,
"created_at": "2025-12-17T10:25:07.818693Z",
"id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
"name": "My resource",
"nb_documents": "426",
"owner_id": null,
"owner_type": "User",
"total_size": "6436546",
"updated_at": "2025-12-17T10:41:03.469341Z"
}Mettre à jour une bibliothèque.
PATCH /v1/libraries/{library_id}#
Étant donné un identifiant de bibliothèque, vous pouvez mettre à jour le nom et la description.
Playground
Testez les endpoints en direct
import { Mistral } from "@mistralai/mistralai";
const mistral = new Mistral({
apiKey: "MISTRAL_API_KEY",
});
async function run() {
const result = await mistral.beta.libraries.update({
libraryId: "74a30b7a-ba52-49f7-a8a3-7157e1adf565",
updateLibraryRequest: {},
});
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.libraries.update({
libraryId: "74a30b7a-ba52-49f7-a8a3-7157e1adf565",
updateLibraryRequest: {},
});
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.libraries.update(library_id="74a30b7a-ba52-49f7-a8a3-7157e1adf565")
# 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.libraries.update(library_id="74a30b7a-ba52-49f7-a8a3-7157e1adf565")
# Handle response
print(res)
curl https://api.mistral.ai/v1/libraries/{library_id} \
-X PATCH \
-H 'Authorization: Bearer YOUR_APIKEY_HERE' \
-H 'Content-Type: application/json' \
-d '{}'curl https://api.mistral.ai/v1/libraries/{library_id} \
-X PATCH \
-H 'Authorization: Bearer YOUR_APIKEY_HERE' \
-H 'Content-Type: application/json' \
-d '{}'200
{
"chunk_size": null,
"created_at": "2025-12-17T10:25:07.818693Z",
"id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
"name": "My resource",
"nb_documents": "426",
"owner_id": null,
"owner_type": "User",
"total_size": "6436546",
"updated_at": "2025-12-17T10:41:03.469341Z"
}{
"chunk_size": null,
"created_at": "2025-12-17T10:25:07.818693Z",
"id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
"name": "My resource",
"nb_documents": "426",
"owner_id": null,
"owner_type": "User",
"total_size": "6436546",
"updated_at": "2025-12-17T10:41:03.469341Z"
}