---
title: "Generate API key for managed user"
method: POST
path: "/workspace/users/{userId}/api-key"
tags: ["Workspace"]
---

# Generate API key for managed user

`POST /workspace/users/{userId}/api-key`

Generate a new API key for a managed user. This key can be used
to make API calls on behalf of the managed user (e.g., create posts
to their connected social accounts).

**Requires Workspace access - contact serge@publora.com to enable.**

## Path parameters

- `userId` string, required

## Response `200`

API key generated

- object
  - `message` string
  - `apiKey` string — The generated API key (save it securely - shown only once)
  - `userId` string

## Other responses

- `400` — Invalid userId
- `403` — Workspace or API access not enabled
- `404` — User not found or not managed by this key
- `500` — Server error

---

[API](https://skmtc.dev/publora/apis/publora-api.md) · [All operations](https://skmtc.dev/publora/apis/publora-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/publora/publora-api/revisions/a1534a88d80a/schema)
