Tree BG 1
Tree
Tree
TreeLeaves
TreeLeaves
Cat IdleGrassGrassRockRock

Beta Libraries Accesses Endpoints

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

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.

200

Successful Response

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();
from mistralai 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'

200

{
  "data": [
    {
      "library_id": "ipsum eiusmod",
      "org_id": "consequat do",
      "role": "reprehenderit ut dolore",
      "share_with_type": "occaecat dolor sit",
      "share_with_uuid": "nostrud"
    }
  ]
}

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.

200

Successful Response

library_id
*string
org_id
*string
role
*string
share_with_type
*string
share_with_uuid
*string
user_id
string|null

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();
from mistralai 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", org_id="aadd9ae1-f285-4437-884a-091c77efa6fd", 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' \
 -d '{
  "level": "Viewer",
  "org_id": "ipsum eiusmod",
  "share_with_type": "User",
  "share_with_uuid": "consequat do"
}'

200

{
  "library_id": "ipsum eiusmod",
  "org_id": "consequat do",
  "role": "reprehenderit ut dolore",
  "share_with_type": "occaecat dolor sit",
  "share_with_uuid": "nostrud"
}

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 it's own access. You have to be the owner of the library to delete an acces other than yours.

200

Successful Response

library_id
*string
org_id
*string
role
*string
share_with_type
*string
share_with_uuid
*string
user_id
string|null

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();
from mistralai 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", org_id="0814a235-c2d0-4814-875a-4b85f93d3dc7", 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' \
 -d '{
  "org_id": "ipsum eiusmod",
  "share_with_type": "User",
  "share_with_uuid": "consequat do"
}'

200

{
  "library_id": "ipsum eiusmod",
  "org_id": "consequat do",
  "role": "reprehenderit ut dolore",
  "share_with_type": "occaecat dolor sit",
  "share_with_uuid": "nostrud"
}