---
title: "Create API key for service user"
method: POST
path: "/v3beta1/enterprise/service-users/{service_user_id}/api-keys"
tags: ["service_user_api_keys"]
---

# Create API key for service user

`POST /v3beta1/enterprise/service-users/{service_user_id}/api-keys`

Create a new API key for a service user.

The caller must have ManageAccountServiceUsers permission.

## Path parameters

- `service_user_id` string, required

## Request body

- CreateApiKeyRequest
  - `expires_at` integer, nullable — Optional expiration as a UNIX timestamp in seconds. Must be in the future if provided.
  - `name` string, required

## Response `200`

Successful Response

- ApiKeyWithTokenResponse — Shared response model for API key creation/rotation (includes one-time token).
  - `api_key_id` string, required
  - `api_key_name` string, required
  - `token` string, required — The raw API token. This is only shown once at creation/rotation time.

## Other responses

- `401` — Unauthorized
- `403` — Forbidden
- `404` — Not Found
- `409` — Conflict
- `422` — Unprocessable Content
- `429` — Too Many Requests

---

[API](https://skmtc.net/devin/apis/devin-api-v1.md) · [All operations](https://skmtc.net/devin/apis/devin-api-v1/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/devin/devin-api-v1/revisions/e3244476af1c/schema)
