---
title: "Mint an access token for a service account (returns the token once)"
method: POST
path: "/api/rest/v1/service-accounts/{serviceAccountId}/credentials/tokens"
tags: ["Credentials"]
---

# Mint an access token for a service account (returns the token once)

`POST /api/rest/v1/service-accounts/{serviceAccountId}/credentials/tokens`

## Request

- Base URL: `https://app.componecat.ai`
- URL: `https://app.componecat.ai/api/rest/v1/service-accounts/{serviceAccountId}/credentials/tokens`
- Auth: none required

## Path parameters

- `serviceAccountId` string, uuid, required

## Request body

- CreateServiceAccountTokenRequest: Request body for minting a service-account access token. The owning service account comes from the route.
  - `name` string, required
  - `scopes` CredentialScopeRequest[], required
    - `resource` string, required
    - `access` string, required
    - `canCreate` boolean, nullable, required
  - `expiresInDays` union, required
    - integer
    - string, int32

## Response `201`

Created

- CreatedServiceAccountTokenResource: The minted service-account access token returned by the REST create-token endpoint; string CreatedServiceAccountTokenResource.Token is shown only once.
  - `id` string, uuid, required
  - `name` string, required
  - `expiresAt` string, date-time, required
  - `token` string, required

## Other responses

- `404`: Not Found

---

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