---
title: "Generate a new key-pair for the service account. Note that TSB does not store the generated private key, so the client must read it and store it securely."
method: POST
path: "/v2/organizations/{organization}/serviceaccounts/{serviceaccount}/keys"
tags: ["Teams"]
---

# Generate a new key-pair for the service account. Note that TSB does not store the generated private key, so the client must read it and store it securely.

`POST /v2/organizations/{organization}/serviceaccounts/{serviceaccount}/keys`

## Request

- Base URL: `https://docs.tetrate.io` (the document declares no server; this is the origin it was published from)
- URL: `https://docs.tetrate.io/v2/organizations/{organization}/serviceaccounts/{serviceaccount}/keys`
- Auth: none declared

## Path parameters

- `organization` string, required
- `serviceaccount` string, required

## Request body

- object: Request to generate a new key-pair for the Service Account.
  - `keyEncoding` 'PEM' | 'JWK'

## Response `200`

A successful response.

- Tsbv2ServiceAccount: `ServiceAccount` represents a service account that can be used to access the TSB platform. Service accounts have a set of associated public and private keys that can be used to generate signed JWT tokens that are suitable to authenticate to TSB. A default key-pair is generated on service account creation and the public key is stored in TSB. Private keys are returned when service accounts are created, but TSB will not store them. It is up to the client to store them securely.
  - `fqn` string
  - `displayName` string
  - `etag` string
  - `description` string: A description of the resource.
  - `keys` ServiceAccountKeyPair[]
    - `id` string
    - `publicKey` string
    - `privateKey` string
    - `encoding` 'PEM' | 'JWK'
    - `defaultToken` string

## Other responses

- `default`: An unexpected error response.

---

[API](https://skmtc.dev/tetrate/apis/tetrate-service-bridge-api.md) - [All operations](https://skmtc.dev/tetrate/apis/tetrate-service-bridge-api/llms.txt) - [OpenAPI document](https://skmtc.dev/tetrate/apis/tetrate-service-bridge-api/revisions/2f19c3a1ae57?raw)
