---
title: "Create Oauth2 Client"
method: POST
path: "/api/v1/oauth/clients"
tags: ["oauth2-server"]
---

# Create Oauth2 Client

`POST /api/v1/oauth/clients`

## Request

- Base URL: `https://memory.kagura-ai.com` (the document declares no server; this is the origin it was published from)
- URL: `https://memory.kagura-ai.com/api/v1/oauth/clients`
- Auth: none declared

Register a new OAuth2 client.

Issue #1752: the owner is emailed a security notice after the commit
(a new client secret was minted on the account).

Args:
    data: Client registration data

Returns:
    Created client with client_secret (only shown once)

Example:
    POST /api/v1/oauth/clients
    {
      "client_name": "My ChatGPT App",
      "redirect_uris": ["https://chatgpt.com/connector_platform_oauth_redirect"]
    }

Security:
    - client_secret is returned ONLY ONCE on creation
    - client_secret is SHA256 hashed in database
    - User must save the secret immediately

## Headers

- `authorization` string, nullable

## Request body

- OAuth2ClientCreateRequest: OAuth2 Client creation request.
  - `client_name` string, required: Human-readable client name
  - `redirect_uris` string[], required: Allowed redirect URIs
  - `provider` string: OAuth provider type (Migration 036)
  - `grant_types` string[]: Allowed grant types
  - `response_types` string[]: Allowed response types
  - `scope` string: Space-separated scopes
  - `token_endpoint_auth_method` string: Client authentication method

## Response `201`

Successful Response

- OAuth2ClientWithSecretResponse: OAuth2 Client response with client secret (only on creation). ``client_secret`` is ``None`` for public clients (``token_endpoint_auth_method="none"``) per RFC 7591 §3.2.1, which forbids issuing a secret to clients that won't authenticate at the token endpoint. Confidential clients always receive a value.
  - `client_id` string, required
  - `client_name` string, required
  - `redirect_uris` string[], required
  - `grant_types` string[], required
  - `response_types` string[], required
  - `scope` string, required
  - `token_endpoint_auth_method` string, required
  - `owner_id` string, nullable, required
  - `provider` string, required
  - `created_at` string, required
  - `plaintext_secret` string, nullable
  - `is_visible` boolean, required
  - `visibility_expires_at` string, nullable
  - `client_secret` string, nullable

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/kagura-ai/apis/kagura-memory-cloud.md) · [All operations](https://skmtc.dev/kagura-ai/apis/kagura-memory-cloud/llms.txt) · [OpenAPI document](https://skmtc.dev/kagura-ai/apis/kagura-memory-cloud/revisions/09f17f5ada29?raw)
