---
title: "Create a service account and issue its first API key"
method: POST
path: "/teams/{teamId}/service-accounts"
tags: ["Service Accounts"]
---

# Create a service account and issue its first API key

`POST /teams/{teamId}/service-accounts`

## Request

- Base URL: `https://api.katla.app`
- URL: `https://api.katla.app/teams/{teamId}/service-accounts`
- Auth: HTTP bearer

The returned apiKey is shown once and cannot be retrieved again. Requires the Business or Custom plan.

## Path parameters

- `teamId` string, uuid, required

## Request body

- object
  - `name` string, required
  - `role` 'member' | 'admin'
  - `scopes` string[]
  - `expiresInDays` integer

## Response `201`

Default Response

- object
  - `serviceAccount` object, required
    - `id` string, required
    - `name` string, required
    - `role` 'owner' | 'admin' | 'member', required
    - `scopes` string[], required
    - `createdByUserId` string, nullable, required
    - `revokedAt` string, nullable, required
    - `createdAt` string, required
    - `keys` object[], required
      - `id` string, required
      - `maskedKey` string, required
      - `expiresAt` string, nullable, required
      - `revokedAt` string, nullable, required
      - `lastUsedAt` string, nullable, required
      - `createdAt` string, required
  - `key` object, required
    - `id` string, required
    - `maskedKey` string, required
    - `expiresAt` string, nullable, required
    - `revokedAt` string, nullable, required
    - `lastUsedAt` string, nullable, required
    - `createdAt` string, required
  - `apiKey` string, required

## Other responses

- `403`: Default Response

---

[API](https://skmtc.dev/katla/apis/katla-api.md) · [All operations](https://skmtc.dev/katla/apis/katla-api/llms.txt) · [OpenAPI document](https://skmtc.dev/katla/apis/katla-api/revisions/6ed2d7f0b009?raw)
