Skip to content
Dashboard
Theme
Theme

Create a machine-to-machine client

POST /v1/m2m_clients: Create a machine-to-machine client.

View Markdown

POST /v1/m2m_clients

The secret is in this response only. A private_key_jwt client registers a JWKS instead and has no secret.

Scope
machine_clients:write
Auth
Secret key (sk_…)
Since
1.0
  • Idempotency-Key string

    Honoured for 24 h; a replay returns the original response.

    min length 1 · max length 255

  • OhAuthCat-Version string

    Minor version; defaults to the environment’s pin.

  • name string Required

    min length 1 · max length 200

  • organization string

  • auth_method string

    one of client_secret, private_key_jwt

  • jwks object

  • scopes array of string

    max items 100

  • audiences array of string Required

    min items 1 · max items 20

  • access_token_seconds integer

    min 60 · max 3600

Errors share one shape; see the error code catalogue.

curl -X POST \
"https://api.ohauthcat.com/v1/m2m_clients" \
-H "Authorization: Bearer $OHAUTHCAT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Acme Corp",
"audiences": [
"https://api.acme.com"
]
}'
Response 201
{
"client": {
"id": "mcli_01J9Z3K5V7W8X9Y0Z1A2B3C4D5",
"object": "m2m_client",
"organization": "org_01J9Z3K5V7W8X9Y0Z1A2B3C4D5",
"name": "Acme Corp",
"auth_method": "client_secret",
"secret_hint": "example_secret_hint",
"previous_secret_expires_at": "2026-01-15T09:30:00Z",
"jwks": {},
"scopes": [
"organizations:read"
],
"audiences": [
"https://api.acme.com"
],
"access_token_seconds": 60,
"revoked_at": "2026-01-15T09:30:00Z",
"last_used_at": "2026-01-15T09:30:00Z",
"created_at": "2026-01-15T09:30:00Z",
"updated_at": "2026-01-15T09:30:00Z"
},
"client_secret": "sk_test_example"
}