# Beta.ServiceAccounts ## Overview ### Available Operations * [create](#create) - Create Service Account * [list](#list) - List Service Accounts * [listAssignableRoles](#listassignableroles) - List Assignable Service Account Roles * [get](#get) - Get Service Account * [update](#update) - Update Service Account * [delete](#delete) - Delete Service Account * [setRoles](#setroles) - Set Service Account Roles * [listRoles](#listroles) - List Service Account Roles ## create Create a service account in a workspace. Requires the Workspace admin (`workspace_admin`) role. ### Example Usage ```typescript 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: "", workspaceId: "cf2146d0-158c-4b19-b8b1-ca0c68f41143", }); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { MistralCore } from "@mistralai/mistralai/core.js"; import { betaServiceAccountsCreate } from "@mistralai/mistralai/funcs/betaServiceAccountsCreate.js"; // Use `MistralCore` for best tree-shaking performance. // You can create one instance of it to use across an application. const mistral = new MistralCore({ apiKey: process.env["MISTRAL_API_KEY"] ?? "", }); async function run() { const res = await betaServiceAccountsCreate(mistral, { name: "", workspaceId: "cf2146d0-158c-4b19-b8b1-ca0c68f41143", }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("betaServiceAccountsCreate failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `request` | [components.CreateServiceAccountRequest](../../models/components/createserviceaccountrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[components.ServiceAccount](../../models/components/serviceaccount.md)\>** ### Errors | Error Type | Status Code | Content Type | | -------------------------- | -------------------------- | -------------------------- | | errors.HTTPValidationError | 422 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* | ## list 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). ### Example Usage ```typescript 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(); ``` ### Standalone function The standalone function version of this method: ```typescript import { MistralCore } from "@mistralai/mistralai/core.js"; import { betaServiceAccountsList } from "@mistralai/mistralai/funcs/betaServiceAccountsList.js"; // Use `MistralCore` for best tree-shaking performance. // You can create one instance of it to use across an application. const mistral = new MistralCore({ apiKey: process.env["MISTRAL_API_KEY"] ?? "", }); async function run() { const res = await betaServiceAccountsList(mistral, { offset: 615331, limit: 383701, }); if (res.ok) { const { value: result } = res; for await (const page of result) { console.log(page); } } else { console.log("betaServiceAccountsList failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `request` | [operations.ListServiceAccountsV1ServiceAccountsGetRequest](../../models/operations/listserviceaccountsv1serviceaccountsgetrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[operations.ListServiceAccountsV1ServiceAccountsGetResponse](../../models/operations/listserviceaccountsv1serviceaccountsgetresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | -------------------------- | -------------------------- | -------------------------- | | errors.HTTPValidationError | 422 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* | ## listAssignableRoles List the workspace roles that can be assigned to a service account. Requires the Workspace admin (`workspace_admin`) role. ### Example Usage ```typescript 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(); ``` ### Standalone function The standalone function version of this method: ```typescript import { MistralCore } from "@mistralai/mistralai/core.js"; import { betaServiceAccountsListAssignableRoles } from "@mistralai/mistralai/funcs/betaServiceAccountsListAssignableRoles.js"; // Use `MistralCore` for best tree-shaking performance. // You can create one instance of it to use across an application. const mistral = new MistralCore({ apiKey: process.env["MISTRAL_API_KEY"] ?? "", }); async function run() { const res = await betaServiceAccountsListAssignableRoles(mistral, { workspaceId: "e9326c4d-7aff-483b-9353-303bf1802e99", }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("betaServiceAccountsListAssignableRoles failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `request` | [operations.ListAssignableServiceAccountRolesV1ServiceAccountsAssignableRolesGetRequest](../../models/operations/listassignableserviceaccountrolesv1serviceaccountsassignablerolesgetrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[components.ListAssignableServiceAccountRolesResponse](../../models/components/listassignableserviceaccountrolesresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | -------------------------- | -------------------------- | -------------------------- | | errors.HTTPValidationError | 422 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* | ## get Retrieve a service account. Requires the Workspace admin (`workspace_admin`) role. ### Example Usage ```typescript 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(); ``` ### Standalone function The standalone function version of this method: ```typescript import { MistralCore } from "@mistralai/mistralai/core.js"; import { betaServiceAccountsGet } from "@mistralai/mistralai/funcs/betaServiceAccountsGet.js"; // Use `MistralCore` for best tree-shaking performance. // You can create one instance of it to use across an application. const mistral = new MistralCore({ apiKey: process.env["MISTRAL_API_KEY"] ?? "", }); async function run() { const res = await betaServiceAccountsGet(mistral, { serviceAccountId: "68d1ecd2-32cb-473b-ae76-6d87e59f4cd1", }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("betaServiceAccountsGet failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `request` | [operations.GetServiceAccountV1ServiceAccountsServiceAccountIdGetRequest](../../models/operations/getserviceaccountv1serviceaccountsserviceaccountidgetrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[components.ServiceAccount](../../models/components/serviceaccount.md)\>** ### Errors | Error Type | Status Code | Content Type | | -------------------------- | -------------------------- | -------------------------- | | errors.HTTPValidationError | 422 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* | ## update Update a service account. Requires the Workspace admin (`workspace_admin`) role. ### Example Usage ```typescript 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(); ``` ### Standalone function The standalone function version of this method: ```typescript import { MistralCore } from "@mistralai/mistralai/core.js"; import { betaServiceAccountsUpdate } from "@mistralai/mistralai/funcs/betaServiceAccountsUpdate.js"; // Use `MistralCore` for best tree-shaking performance. // You can create one instance of it to use across an application. const mistral = new MistralCore({ apiKey: process.env["MISTRAL_API_KEY"] ?? "", }); async function run() { const res = await betaServiceAccountsUpdate(mistral, { serviceAccountId: "2f4d1ce1-d8ad-4a87-b31b-308088fc2a76", updateServiceAccountRequest: {}, }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("betaServiceAccountsUpdate failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `request` | [operations.UpdateServiceAccountV1ServiceAccountsServiceAccountIdPatchRequest](../../models/operations/updateserviceaccountv1serviceaccountsserviceaccountidpatchrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[components.ServiceAccount](../../models/components/serviceaccount.md)\>** ### Errors | Error Type | Status Code | Content Type | | -------------------------- | -------------------------- | -------------------------- | | errors.HTTPValidationError | 422 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* | ## delete Delete a service account. Requires the Workspace admin (`workspace_admin`) role. ### Example Usage ```typescript 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(); ``` ### Standalone function The standalone function version of this method: ```typescript import { MistralCore } from "@mistralai/mistralai/core.js"; import { betaServiceAccountsDelete } from "@mistralai/mistralai/funcs/betaServiceAccountsDelete.js"; // Use `MistralCore` for best tree-shaking performance. // You can create one instance of it to use across an application. const mistral = new MistralCore({ apiKey: process.env["MISTRAL_API_KEY"] ?? "", }); async function run() { const res = await betaServiceAccountsDelete(mistral, { serviceAccountId: "10f960e0-abaa-4060-9000-249255e07c45", }); if (res.ok) { const { value: result } = res; } else { console.log("betaServiceAccountsDelete failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `request` | [operations.DeleteServiceAccountV1ServiceAccountsServiceAccountIdDeleteRequest](../../models/operations/deleteserviceaccountv1serviceaccountsserviceaccountiddeleterequest.md) | :heavy_check_mark: | The request object to use for the request. | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\** ### Errors | Error Type | Status Code | Content Type | | -------------------------- | -------------------------- | -------------------------- | | errors.HTTPValidationError | 422 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* | ## setRoles Replace the workspace roles assigned to a service account. Requires the Workspace admin (`workspace_admin`) role. ### Example Usage ```typescript 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: { roleIds: [ "7e69e493-caf6-4671-af60-84951754d9fc", ], }, }); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { MistralCore } from "@mistralai/mistralai/core.js"; import { betaServiceAccountsSetRoles } from "@mistralai/mistralai/funcs/betaServiceAccountsSetRoles.js"; // Use `MistralCore` for best tree-shaking performance. // You can create one instance of it to use across an application. const mistral = new MistralCore({ apiKey: process.env["MISTRAL_API_KEY"] ?? "", }); async function run() { const res = await betaServiceAccountsSetRoles(mistral, { serviceAccountId: "d4686916-124a-42f1-966f-9248b120b13c", setServiceAccountRolesRequest: { roleIds: [ "7e69e493-caf6-4671-af60-84951754d9fc", ], }, }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("betaServiceAccountsSetRoles failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `request` | [operations.SetServiceAccountRolesV1ServiceAccountsServiceAccountIdRolesPutRequest](../../models/operations/setserviceaccountrolesv1serviceaccountsserviceaccountidrolesputrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[components.ListServiceAccountRolesResponse](../../models/components/listserviceaccountrolesresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | -------------------------- | -------------------------- | -------------------------- | | errors.HTTPValidationError | 422 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* | ## listRoles List the workspace roles assigned to a service account. Requires the Workspace admin (`workspace_admin`) role. ### Example Usage ```typescript 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(); ``` ### Standalone function The standalone function version of this method: ```typescript import { MistralCore } from "@mistralai/mistralai/core.js"; import { betaServiceAccountsListRoles } from "@mistralai/mistralai/funcs/betaServiceAccountsListRoles.js"; // Use `MistralCore` for best tree-shaking performance. // You can create one instance of it to use across an application. const mistral = new MistralCore({ apiKey: process.env["MISTRAL_API_KEY"] ?? "", }); async function run() { const res = await betaServiceAccountsListRoles(mistral, { serviceAccountId: "0c629f5d-1a74-4b83-a740-14410ecdea21", }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("betaServiceAccountsListRoles failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `request` | [operations.ListServiceAccountRolesV1ServiceAccountsServiceAccountIdRolesGetRequest](../../models/operations/listserviceaccountrolesv1serviceaccountsserviceaccountidrolesgetrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[components.ListServiceAccountRolesResponse](../../models/components/listserviceaccountrolesresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | -------------------------- | -------------------------- | -------------------------- | | errors.HTTPValidationError | 422 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* |