Tree BG 1
Tree
Tree
TreeLeaves
TreeLeaves
Cat IdleGrassGrassRockRock

Beta Service Accounts Endpoints

(beta) Service Accounts API.

List Service Accounts

GET /v1/service-accounts#

List the service accounts in a workspace, or across the organization.

Scoped to a workspace, this requires the Workspace admin (workspace_admin) role on it. Omitting the workspace lists the whole organization and requires the Organization admin (organization_admin) role instead.

200

Successful Response

Playground

Test the endpoints live

curl https://api.mistral.ai/v1/service-accounts \
 -X GET \
 -H 'Authorization: Bearer YOUR_APIKEY_HERE'
import { Mistral } from "@mistralai/mistralai";

const mistral = new Mistral({
  apiKey: process.env["MISTRAL_API_KEY"] ?? "",
});

async function run() {
  const result = await mistral.beta.serviceAccounts.list({
    offset: 615331,
    limit: 383701,
  });

  for await (const page of result) {
    console.log(page);
  }
}

run();

200

{
  "items": [
    {
      "created_at": "2025-12-17T10:25:07.818693Z",
      "customer_id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
      "deleted_at": null,
      "description": null,
      "id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
      "name": "My resource",
      "organization_id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
      "updated_at": "2025-12-17T10:41:03.469341Z",
      "workspace_id": "019b2bd7-96e7-7219-8c0b-45a73da50088"
    }
  ]
}

Create Service Account

POST /v1/service-accounts#

Create a service account in a workspace. Requires the Workspace admin (workspace_admin) role.

201

Successful Response

created_at#
*date-time
customer_id#
*string
deleted_at#
*date-time|null
description#
*string|null
id#
*string
name#
*string
organization_id#
*string
updated_at#
*date-time
workspace_id#
*string

Playground

Test the endpoints live

curl https://api.mistral.ai/v1/service-accounts \
 -X POST \
 -H 'Authorization: Bearer YOUR_APIKEY_HERE' \
 -H 'Content-Type: application/json' \
 -d '{
  "name": "My resource",
  "workspace_id": "019b2bd7-96e7-7219-8c0b-45a73da50088"
}'
import { Mistral } from "@mistralai/mistralai";

const mistral = new Mistral({
  apiKey: process.env["MISTRAL_API_KEY"] ?? "",
});

async function run() {
  const result = await mistral.beta.serviceAccounts.create({
    name: "<value>",
    workspaceId: "cf2146d0-158c-4b19-b8b1-ca0c68f41143",
  });

  console.log(result);
}

run();

201

{
  "created_at": "2025-12-17T10:25:07.818693Z",
  "customer_id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
  "deleted_at": null,
  "description": null,
  "id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
  "name": "My resource",
  "organization_id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
  "updated_at": "2025-12-17T10:41:03.469341Z",
  "workspace_id": "019b2bd7-96e7-7219-8c0b-45a73da50088"
}

List Assignable Service Account Roles

GET /v1/service-accounts/assignable-roles#

List the workspace roles that can be assigned to a service account.

Requires the Workspace admin (workspace_admin) role.

200

Successful Response

Playground

Test the endpoints live

curl https://api.mistral.ai/v1/service-accounts/assignable-roles \
 -X GET \
 -H 'Authorization: Bearer YOUR_APIKEY_HERE'
import { Mistral } from "@mistralai/mistralai";

const mistral = new Mistral({
  apiKey: process.env["MISTRAL_API_KEY"] ?? "",
});

async function run() {
  const result = await mistral.beta.serviceAccounts.listAssignableRoles({
    workspaceId: "e9326c4d-7aff-483b-9353-303bf1802e99",
  });

  console.log(result);
}

run();

200

{
  "items": [
    {
      "description": "My resource description.",
      "is_custom_role": false,
      "name": "My resource",
      "uuid": "019b2bd7-96e7-7219-8c0b-45a73da50088"
    }
  ]
}

Get Service Account

GET /v1/service-accounts/{service_account_id}#

Retrieve a service account.

Requires the Workspace admin (workspace_admin) role.

200

Successful Response

created_at#
*date-time
customer_id#
*string
deleted_at#
*date-time|null
description#
*string|null
id#
*string
name#
*string
organization_id#
*string
updated_at#
*date-time
workspace_id#
*string

Playground

Test the endpoints live

curl https://api.mistral.ai/v1/service-accounts/{service_account_id} \
 -X GET \
 -H 'Authorization: Bearer YOUR_APIKEY_HERE'
import { Mistral } from "@mistralai/mistralai";

const mistral = new Mistral({
  apiKey: process.env["MISTRAL_API_KEY"] ?? "",
});

async function run() {
  const result = await mistral.beta.serviceAccounts.get({
    serviceAccountId: "68d1ecd2-32cb-473b-ae76-6d87e59f4cd1",
  });

  console.log(result);
}

run();

200

{
  "created_at": "2025-12-17T10:25:07.818693Z",
  "customer_id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
  "deleted_at": null,
  "description": null,
  "id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
  "name": "My resource",
  "organization_id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
  "updated_at": "2025-12-17T10:41:03.469341Z",
  "workspace_id": "019b2bd7-96e7-7219-8c0b-45a73da50088"
}

Delete Service Account

DELETE /v1/service-accounts/{service_account_id}#

Delete a service account.

Requires the Workspace admin (workspace_admin) role.

Playground

Test the endpoints live

curl https://api.mistral.ai/v1/service-accounts/{service_account_id} \
 -X DELETE \
 -H 'Authorization: Bearer YOUR_APIKEY_HERE' \
 -H 'Content-Type: application/json'
import { Mistral } from "@mistralai/mistralai";

const mistral = new Mistral({
  apiKey: process.env["MISTRAL_API_KEY"] ?? "",
});

async function run() {
  await mistral.beta.serviceAccounts.delete({
    serviceAccountId: "10f960e0-abaa-4060-9000-249255e07c45",
  });


}

run();

Update Service Account

PATCH /v1/service-accounts/{service_account_id}#

Update a service account.

Requires the Workspace admin (workspace_admin) role.

200

Successful Response

created_at#
*date-time
customer_id#
*string
deleted_at#
*date-time|null
description#
*string|null
id#
*string
name#
*string
organization_id#
*string
updated_at#
*date-time
workspace_id#
*string

Playground

Test the endpoints live

curl https://api.mistral.ai/v1/service-accounts/{service_account_id} \
 -X PATCH \
 -H 'Authorization: Bearer YOUR_APIKEY_HERE' \
 -H 'Content-Type: application/json' \
 -d '{}'
import { Mistral } from "@mistralai/mistralai";

const mistral = new Mistral({
  apiKey: process.env["MISTRAL_API_KEY"] ?? "",
});

async function run() {
  const result = await mistral.beta.serviceAccounts.update({
    serviceAccountId: "2f4d1ce1-d8ad-4a87-b31b-308088fc2a76",
    updateServiceAccountRequest: {},
  });

  console.log(result);
}

run();

200

{
  "created_at": "2025-12-17T10:25:07.818693Z",
  "customer_id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
  "deleted_at": null,
  "description": null,
  "id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
  "name": "My resource",
  "organization_id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
  "updated_at": "2025-12-17T10:41:03.469341Z",
  "workspace_id": "019b2bd7-96e7-7219-8c0b-45a73da50088"
}

List Service Account Roles

GET /v1/service-accounts/{service_account_id}/roles#

List the workspace roles assigned to a service account.

Requires the Workspace admin (workspace_admin) role.

200

Successful Response

Playground

Test the endpoints live

curl https://api.mistral.ai/v1/service-accounts/{service_account_id}/roles \
 -X GET \
 -H 'Authorization: Bearer YOUR_APIKEY_HERE'
import { Mistral } from "@mistralai/mistralai";

const mistral = new Mistral({
  apiKey: process.env["MISTRAL_API_KEY"] ?? "",
});

async function run() {
  const result = await mistral.beta.serviceAccounts.listRoles({
    serviceAccountId: "0c629f5d-1a74-4b83-a740-14410ecdea21",
  });

  console.log(result);
}

run();

200

{
  "items": [
    {
      "role_id": "019b2bd7-96e7-7219-8c0b-45a73da50088"
    }
  ]
}

Set Service Account Roles

PUT /v1/service-accounts/{service_account_id}/roles#

Replace the workspace roles assigned to a service account.

Requires the Workspace admin (workspace_admin) role.

200

Successful Response

Playground

Test the endpoints live

curl https://api.mistral.ai/v1/service-accounts/{service_account_id}/roles \
 -X PUT \
 -H 'Authorization: Bearer YOUR_APIKEY_HERE' \
 -H 'Content-Type: application/json' \
 -d '{}'
import { Mistral } from "@mistralai/mistralai";

const mistral = new Mistral({
  apiKey: process.env["MISTRAL_API_KEY"] ?? "",
});

async function run() {
  const result = await mistral.beta.serviceAccounts.setRoles({
    serviceAccountId: "d4686916-124a-42f1-966f-9248b120b13c",
    setServiceAccountRolesRequest: {},
  });

  console.log(result);
}

run();

200

{
  "items": [
    {
      "role_id": "019b2bd7-96e7-7219-8c0b-45a73da50088"
    }
  ]
}