---
title: "Get a list of kubernetes service accounts"
method: GET
path: "/kubernetes/{id}/serviceaccounts"
tags: ["kubernetes"]
---

# Get a list of kubernetes service accounts

`GET /kubernetes/{id}/serviceaccounts`

Get a list of kubernetes service accounts that the user has access to.
**Access policy**: Authenticated user.

## Path parameters

- `id` integer, required

## Response `200`

Success

- KubernetesK8sServiceAccount[]
  - `annotations` object
  - `automountServiceAccountToken` boolean
  - `creationDate` string
  - `imagePullSecrets` K8sIoApiCoreV1LocalObjectReference[]
    - `name` string — Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names +optional +default="" +kubebuilder:default="" TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
  - `isSystem` boolean
  - `labels` object
  - `name` string
  - `namespace` string
  - `uid` string

## Other responses

- `400` — Invalid request payload, such as missing required fields or fields not meeting validation criteria.
- `401` — Unauthorized access - the user is not authenticated or does not have the necessary permissions. Ensure that you have provided a valid API key or JWT token, and that you have the required permissions.
- `403` — Permission denied - the user is authenticated but does not have the necessary permissions to access the requested resource or perform the specified operation. Check your user roles and permissions.
- `404` — Unable to find an environment with the specified identifier.
- `500` — Server error occurred while attempting to retrieve the list of service accounts.

---

[API](https://skmtc.net/portainer/apis/portainerce-api.md) · [All operations](https://skmtc.net/portainer/apis/portainerce-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/portainer/portainerce-api/versions/ec51a8194ac0/schema)
