---
title: "Generates an API key for the specified client application."
method: POST
path: "/clientapplications/{clientId}/generateapikey"
tags: ["clientApplications"]
---

# Generates an API key for the specified client application.

`POST /clientapplications/{clientId}/generateapikey`

<Check title="Required Permissions" icon="key">The user must be an admin or have `workspace-manage-config:read` permissions.</Check>

## Path parameters

- `clientId` string, required

## Headers

- `Authorization` string, required

## Request body

- ClientApplicationApiKeyForm — The model to generate an API key for a client application.
  - `apiUserId` string, uuid — The API user to generate the key for.

## Response `200`

OK

- TokenResponse — The token response contains the access and refresh tokens.
  - `token_type` string, nullable — The type of the token, typically 'Bearer'.
  - `expires_in` integer — The expiration date of the access token, in seconds.
  - `access_token` string, nullable — The access token.
  - `refresh_token` string, nullable — The refresh token to get a new access token.

## Other responses

- `400` — Bad Request
- `404` — Not Found

---

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