The type of entity, used to share a library.













Beta Libraries Accesses Endpoints
(beta) Libraries API - manage access to a library.












Examples
Real world code examples
List all of the access to this library.
GET /v1/libraries/{library_id}/share
Given a library, list all of the Entity that have access and to what level.
library_id
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.libraries.accesses.list({
libraryId: "d2169833-d8e2-416e-a372-76518d3d99c2",
});
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.accesses.list({
libraryId: "d2169833-d8e2-416e-a372-76518d3d99c2",
});
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.accesses.list(library_id="d2169833-d8e2-416e-a372-76518d3d99c2")
# 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.accesses.list(library_id="d2169833-d8e2-416e-a372-76518d3d99c2")
# Handle response
print(res)
curl https://api.mistral.ai/v1/libraries/{library_id}/share \
-X GET \
-H 'Authorization: Bearer YOUR_APIKEY_HERE'curl https://api.mistral.ai/v1/libraries/{library_id}/share \
-X GET \
-H 'Authorization: Bearer YOUR_APIKEY_HERE'200
{
"data": [
{
"library_id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
"org_id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
"role": "user",
"share_with_type": "User",
"share_with_uuid": null
}
]
}{
"data": [
{
"library_id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
"org_id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
"role": "user",
"share_with_type": "User",
"share_with_uuid": null
}
]
}Create or update an access level.
PUT /v1/libraries/{library_id}/share
Given a library id, you can create or update the access level of an entity. You have to be owner of the library to share a library. An owner cannot change their own role. A library cannot be shared outside of the organization.
library_id
level
org_id
share_with_type
share_with_uuid
The id of the entity (user, workspace or organization) to share with
200
Successful Response
library_id
org_id
role
share_with_type
share_with_uuid
user_id
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.libraries.accesses.updateOrCreate({
libraryId: "36de3a24-5b1c-4c8f-9d84-d5642205a976",
sharingIn: {
orgId: "aadd9ae1-f285-4437-884a-091c77efa6fd",
level: "Viewer",
shareWithUuid: "0ae92ecb-21ed-47c5-9f7e-0b2cbe325a20",
shareWithType: "User",
},
});
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.accesses.updateOrCreate({
libraryId: "36de3a24-5b1c-4c8f-9d84-d5642205a976",
sharingIn: {
orgId: "aadd9ae1-f285-4437-884a-091c77efa6fd",
level: "Viewer",
shareWithUuid: "0ae92ecb-21ed-47c5-9f7e-0b2cbe325a20",
shareWithType: "User",
},
});
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.accesses.update_or_create(library_id="36de3a24-5b1c-4c8f-9d84-d5642205a976", level="Viewer", share_with_uuid="0ae92ecb-21ed-47c5-9f7e-0b2cbe325a20", share_with_type="User")
# 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.accesses.update_or_create(library_id="36de3a24-5b1c-4c8f-9d84-d5642205a976", level="Viewer", share_with_uuid="0ae92ecb-21ed-47c5-9f7e-0b2cbe325a20", share_with_type="User")
# Handle response
print(res)
curl https://api.mistral.ai/v1/libraries/{library_id}/share \
-X PUT \
-H 'Authorization: Bearer YOUR_APIKEY_HERE' \
-H 'Content-Type: application/json' \
-d '{
"level": "Viewer",
"share_with_type": "User",
"share_with_uuid": "019b2bd7-96e7-7219-8c0b-45a73da50088"
}'curl https://api.mistral.ai/v1/libraries/{library_id}/share \
-X PUT \
-H 'Authorization: Bearer YOUR_APIKEY_HERE' \
-H 'Content-Type: application/json' \
-d '{
"level": "Viewer",
"share_with_type": "User",
"share_with_uuid": "019b2bd7-96e7-7219-8c0b-45a73da50088"
}'200
{
"library_id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
"org_id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
"role": "user",
"share_with_type": "User",
"share_with_uuid": null
}{
"library_id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
"org_id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
"role": "user",
"share_with_type": "User",
"share_with_uuid": null
}Delete an access level.
DELETE /v1/libraries/{library_id}/share
Given a library id, you can delete the access level of an entity. An owner cannot delete their own access. You have to be the owner of the library to delete an access other than yours. Warning: the response will change from 200 (returning the deleted sharing) to 204 No Content in a future version.
library_id
org_id
share_with_type
The type of entity, used to share a library.
share_with_uuid
The id of the entity (user, workspace or organization) to share with
200
Successful Response
library_id
org_id
role
share_with_type
share_with_uuid
user_id
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.libraries.accesses.delete({
libraryId: "709e3cad-9fb2-4f4e-bf88-143cf1808107",
sharingDelete: {
orgId: "0814a235-c2d0-4814-875a-4b85f93d3dc7",
shareWithUuid: "b843cc47-ce8f-4354-8cfc-5fcd7fb2865b",
shareWithType: "User",
},
});
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.accesses.delete({
libraryId: "709e3cad-9fb2-4f4e-bf88-143cf1808107",
sharingDelete: {
orgId: "0814a235-c2d0-4814-875a-4b85f93d3dc7",
shareWithUuid: "b843cc47-ce8f-4354-8cfc-5fcd7fb2865b",
shareWithType: "User",
},
});
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.accesses.delete(library_id="709e3cad-9fb2-4f4e-bf88-143cf1808107", share_with_uuid="b843cc47-ce8f-4354-8cfc-5fcd7fb2865b", share_with_type="User")
# 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.accesses.delete(library_id="709e3cad-9fb2-4f4e-bf88-143cf1808107", share_with_uuid="b843cc47-ce8f-4354-8cfc-5fcd7fb2865b", share_with_type="User")
# Handle response
print(res)
curl https://api.mistral.ai/v1/libraries/{library_id}/share \
-X DELETE \
-H 'Authorization: Bearer YOUR_APIKEY_HERE' \
-H 'Content-Type: application/json' \
-d '{
"share_with_type": "User",
"share_with_uuid": "019b2bd7-96e7-7219-8c0b-45a73da50088"
}'curl https://api.mistral.ai/v1/libraries/{library_id}/share \
-X DELETE \
-H 'Authorization: Bearer YOUR_APIKEY_HERE' \
-H 'Content-Type: application/json' \
-d '{
"share_with_type": "User",
"share_with_uuid": "019b2bd7-96e7-7219-8c0b-45a73da50088"
}'200
{
"library_id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
"org_id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
"role": "user",
"share_with_type": "User",
"share_with_uuid": null
}{
"library_id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
"org_id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
"role": "user",
"share_with_type": "User",
"share_with_uuid": null
}