---
title: "Create Workspace Key"
method: POST
path: "/auth/api/v1/key/create"
tags: ["keys"]
---

# Create Workspace Key

`POST /auth/api/v1/key/create`

## Request

- Base URL: `https://api.opengovernance.io`
- URL: `https://api.opengovernance.io/auth/api/v1/key/create`
- Auth: API key in header `Authorization`

Creates workspace key for the defined role with the defined name in the workspace.

## Request body

- GithubComOpengovernOpengovernancePkgAuthApiCreateAPIKeyRequest
  - `name` string: Name of the key
  - `role` 'admin' | 'editor' | 'viewer'

## Response `200`

OK

- GithubComOpengovernOpengovernancePkgAuthApiCreateAPIKeyResponse
  - `active` boolean: Activity state of the key
  - `created_at` string: Creation timestamp in UTC
  - `id` integer: Unique identifier for the key
  - `name` string: Name of the key
  - `roleName` 'admin' | 'editor' | 'viewer'
  - `token` string: Token of the key

## Other responses

- `406`: Not Acceptable

---

[API](https://skmtc.dev/opengovern/apis/opengovernance-service-api.md) - [All operations](https://skmtc.dev/opengovern/apis/opengovernance-service-api/llms.txt) - [OpenAPI document](https://skmtc.dev/opengovern/apis/opengovernance-service-api/revisions/ab05295c4094?raw)
