---
title: "Create API Key for User"
method: POST
path: "/v1/user/apikey"
tags: ["User"]
---

# Create API Key for User

`POST /v1/user/apikey`

Create an API key for the currently logged in user

## Request body

- CreateApiKey
  - `name` string, nullable
  - `accessLevel` 0 | 1, required
  - `projectRestrictions` string[], nullable
  - `tableRestrictions` string[], nullable
  - `documentRestrictions` string[], nullable

## Response `200`

Successfully created an API key

- object
  - `metadata` object
  - `data` ApiKey
    - `publicId` string, uuid
    - `hash` string
    - `name` string
    - `prefix` string
    - `accessLevel` integer
    - `projectRestrictions` string[]
    - `tableRestrictions` string[]
    - `documentRestrictions` string[]

## Other responses

- `400` — Validation error

---

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