---
title: "POST /workspaces/{workspaceId}/serviceaccounts"
method: POST
path: "/workspaces/{workspaceId}/serviceaccounts"
---

# POST /workspaces/{workspaceId}/serviceaccounts

`POST /workspaces/{workspaceId}/serviceaccounts`

Creates a service account for the workspace. A service account can be used to call Grafana HTTP APIs, and run automated workloads. After creating the service account with the correct `GrafanaRole` for your use case, use `CreateWorkspaceServiceAccountToken` to create a token that can be used to authenticate and authorize Grafana HTTP API calls.

You can only create service accounts for workspaces that are compatible with Grafana version 9 and above.

For more information about service accounts, see [Service accounts](https://docs.aws.amazon.com/grafana/latest/userguide/service-accounts.html) in the _Amazon Managed Grafana User Guide_.

For more information about the Grafana HTTP APIs, see [Using Grafana HTTP APIs](https://docs.aws.amazon.com/grafana/latest/userguide/Using-Grafana-APIs.html) in the _Amazon Managed Grafana User Guide_.

## Path parameters

- `workspaceId` string, required

## Request body

- object
  - `name` string, required — A name for the service account. The name must be unique within the workspace, as it determines the ID associated with the service account.
  - `grafanaRole` 'ADMIN' | 'EDITOR' | 'VIEWER', required — <p>The permission level to use for this service account.</p> <note> <p>For more information about the roles and the permissions each has, see <a href="https://docs.aws.amazon.com/grafana/latest/userguide/Grafana-user-roles.html">User roles</a> in the <i>Amazon Managed Grafana User Guide</i>.</p> </note>

## Response `200`

Success

- CreateWorkspaceServiceAccountResponse
  - `id` string, required — The ID of the service account.
  - `name` string, required — The name of the service account.
  - `grafanaRole` 'ADMIN' | 'EDITOR' | 'VIEWER', required — The permission level given to the service account.
  - `workspaceId` string, required — The workspace with which the service account is associated.

## Other responses

- `480` — ResourceNotFoundException
- `481` — ThrottlingException
- `482` — ConflictException
- `483` — ValidationException
- `484` — AccessDeniedException
- `485` — InternalServerException
- `486` — ServiceQuotaExceededException

---

[API](https://skmtc.net/aws/apis/grafana.md) · [All operations](https://skmtc.net/aws/apis/grafana/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/aws/grafana/versions/76cc5bd3d508/schema)
