Direction to sort a service-account listing by creation time.













Beta Service Accounts Endpoints
(beta) Service Accounts API.












Examples
Real world code examples
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.
q narrows the list to accounts whose name or description contains it. order
sorts by creation time (ascending by default).
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.serviceAccounts.list({
offset: 615331,
limit: 383701,
});
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.serviceAccounts.list({
offset: 615331,
limit: 383701,
});
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.service_accounts.list(offset=251948, limit=234499, workspace_id="96e67917-4b94-4dc0-b61a-bd713aa8a4e6", include_deleted=False)
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.service_accounts.list(offset=251948, limit=234499, workspace_id="96e67917-4b94-4dc0-b61a-bd713aa8a4e6", include_deleted=False)
while res is not None:
# Handle items
res = res.next()
curl https://api.mistral.ai/v1/service-accounts \
-X GET \
-H 'Authorization: Bearer YOUR_APIKEY_HERE'curl https://api.mistral.ai/v1/service-accounts \
-X GET \
-H 'Authorization: Bearer YOUR_APIKEY_HERE'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"
}
]
}{
"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.
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.serviceAccounts.create({
name: "<value>",
workspaceId: "cf2146d0-158c-4b19-b8b1-ca0c68f41143",
});
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.serviceAccounts.create({
name: "<value>",
workspaceId: "cf2146d0-158c-4b19-b8b1-ca0c68f41143",
});
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.service_accounts.create(name="<value>", workspace_id="cf2146d0-158c-4b19-b8b1-ca0c68f41143")
# 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.service_accounts.create(name="<value>", workspace_id="cf2146d0-158c-4b19-b8b1-ca0c68f41143")
# Handle response
print(res)
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"
}'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"
}'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"
}{
"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
import { Mistral } from "@mistralai/mistralai";
const mistral = new Mistral({
apiKey: "MISTRAL_API_KEY",
});
async function run() {
const result = await mistral.beta.serviceAccounts.listAssignableRoles({
workspaceId: "e9326c4d-7aff-483b-9353-303bf1802e99",
});
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.serviceAccounts.listAssignableRoles({
workspaceId: "e9326c4d-7aff-483b-9353-303bf1802e99",
});
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.service_accounts.list_assignable_roles(workspace_id="e9326c4d-7aff-483b-9353-303bf1802e99")
# 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.service_accounts.list_assignable_roles(workspace_id="e9326c4d-7aff-483b-9353-303bf1802e99")
# Handle response
print(res)
curl https://api.mistral.ai/v1/service-accounts/assignable-roles \
-X GET \
-H 'Authorization: Bearer YOUR_APIKEY_HERE'curl https://api.mistral.ai/v1/service-accounts/assignable-roles \
-X GET \
-H 'Authorization: Bearer YOUR_APIKEY_HERE'200
{
"items": [
{
"description": "My resource description.",
"is_custom_role": false,
"name": "My resource",
"uuid": "019b2bd7-96e7-7219-8c0b-45a73da50088"
}
]
}{
"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.
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.serviceAccounts.get({
serviceAccountId: "68d1ecd2-32cb-473b-ae76-6d87e59f4cd1",
});
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.serviceAccounts.get({
serviceAccountId: "68d1ecd2-32cb-473b-ae76-6d87e59f4cd1",
});
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.service_accounts.get(service_account_id="68d1ecd2-32cb-473b-ae76-6d87e59f4cd1")
# 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.service_accounts.get(service_account_id="68d1ecd2-32cb-473b-ae76-6d87e59f4cd1")
# Handle response
print(res)
curl https://api.mistral.ai/v1/service-accounts/{service_account_id} \
-X GET \
-H 'Authorization: Bearer YOUR_APIKEY_HERE'curl https://api.mistral.ai/v1/service-accounts/{service_account_id} \
-X GET \
-H 'Authorization: Bearer YOUR_APIKEY_HERE'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"
}{
"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
import { Mistral } from "@mistralai/mistralai";
const mistral = new Mistral({
apiKey: "MISTRAL_API_KEY",
});
async function run() {
await mistral.beta.serviceAccounts.delete({
serviceAccountId: "10f960e0-abaa-4060-9000-249255e07c45",
});
}
run();
import { Mistral } from "@mistralai/mistralai";
const mistral = new Mistral({
apiKey: "MISTRAL_API_KEY",
});
async function run() {
await mistral.beta.serviceAccounts.delete({
serviceAccountId: "10f960e0-abaa-4060-9000-249255e07c45",
});
}
run();
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
mistral.beta.service_accounts.delete(service_account_id="10f960e0-abaa-4060-9000-249255e07c45")
# Use the SDK ...
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
mistral.beta.service_accounts.delete(service_account_id="10f960e0-abaa-4060-9000-249255e07c45")
# Use the SDK ...
curl https://api.mistral.ai/v1/service-accounts/{service_account_id} \
-X DELETE \
-H 'Authorization: Bearer YOUR_APIKEY_HERE' \
-H 'Content-Type: application/json'curl https://api.mistral.ai/v1/service-accounts/{service_account_id} \
-X DELETE \
-H 'Authorization: Bearer YOUR_APIKEY_HERE' \
-H 'Content-Type: application/json'Update Service Account
PATCH /v1/service-accounts/{service_account_id}#
Update a service account.
Requires the Workspace admin (workspace_admin) role.
description#
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.serviceAccounts.update({
serviceAccountId: "2f4d1ce1-d8ad-4a87-b31b-308088fc2a76",
updateServiceAccountRequest: {},
});
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.serviceAccounts.update({
serviceAccountId: "2f4d1ce1-d8ad-4a87-b31b-308088fc2a76",
updateServiceAccountRequest: {},
});
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.service_accounts.update(service_account_id="2f4d1ce1-d8ad-4a87-b31b-308088fc2a76")
# 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.service_accounts.update(service_account_id="2f4d1ce1-d8ad-4a87-b31b-308088fc2a76")
# Handle response
print(res)
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 '{}'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 '{}'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"
}{
"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
import { Mistral } from "@mistralai/mistralai";
const mistral = new Mistral({
apiKey: "MISTRAL_API_KEY",
});
async function run() {
const result = await mistral.beta.serviceAccounts.listRoles({
serviceAccountId: "0c629f5d-1a74-4b83-a740-14410ecdea21",
});
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.serviceAccounts.listRoles({
serviceAccountId: "0c629f5d-1a74-4b83-a740-14410ecdea21",
});
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.service_accounts.list_roles(service_account_id="0c629f5d-1a74-4b83-a740-14410ecdea21")
# 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.service_accounts.list_roles(service_account_id="0c629f5d-1a74-4b83-a740-14410ecdea21")
# Handle response
print(res)
curl https://api.mistral.ai/v1/service-accounts/{service_account_id}/roles \
-X GET \
-H 'Authorization: Bearer YOUR_APIKEY_HERE'curl https://api.mistral.ai/v1/service-accounts/{service_account_id}/roles \
-X GET \
-H 'Authorization: Bearer YOUR_APIKEY_HERE'200
{
"items": [
{
"role_id": "019b2bd7-96e7-7219-8c0b-45a73da50088"
}
]
}{
"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.
Request body for replacing the workspace roles assigned to a service account.
Workspace role UUIDs to assign. Required and non-empty; omitted or empty lists return 422. Select member explicitly for no role-granted permissions; workspace-wide sharing may still grant access.
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.serviceAccounts.setRoles({
serviceAccountId: "d4686916-124a-42f1-966f-9248b120b13c",
setServiceAccountRolesRequest: {},
});
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.serviceAccounts.setRoles({
serviceAccountId: "d4686916-124a-42f1-966f-9248b120b13c",
setServiceAccountRolesRequest: {},
});
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.service_accounts.set_roles(service_account_id="d4686916-124a-42f1-966f-9248b120b13c", role_ids=[
"7e69e493-caf6-4671-af60-84951754d9fc",
])
# 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.service_accounts.set_roles(service_account_id="d4686916-124a-42f1-966f-9248b120b13c", role_ids=[
"7e69e493-caf6-4671-af60-84951754d9fc",
])
# Handle response
print(res)
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 '{
"role_ids": [
"ipsum eiusmod"
]
}'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 '{
"role_ids": [
"ipsum eiusmod"
]
}'200
{
"items": [
{
"role_id": "019b2bd7-96e7-7219-8c0b-45a73da50088"
}
]
}{
"items": [
{
"role_id": "019b2bd7-96e7-7219-8c0b-45a73da50088"
}
]
}