/v1/apps/{app_id}/credentialsAuthCreate a new M2M client
Path parameters
app_id*stringId of the app.
Headers
Idempotency-KeystringOptional Stripe-style idempotency key. Same key + same body → cached response. Same key + different body → 409 IDEMPOTENCY_KEY_REUSE. 24h TTL. Non-replayable artefacts (plaintext M2M secret) make this strongly recommended for IaC retries.
Request body
name*stringClient display name
Example: "CI Pipeline"
Response · 201 M2M client created. Plaintext secret is returned ONCE in this response.
id*stringUnique identifier of the M2M client.
client_id*stringThe M2M client id (used as `client_id` in the client-credentials grant).
Example: "m2m_a1b2c3d4..."
client_secret*stringPlaintext client secret. Returned exactly once.
name*stringName of the M2M client.
created_at*string · date-timeWhen the M2M client was created (ISO 8601).
Example
Request
POST https://api.auth.productcraft.co/v1/apps/{app_id}/credentials
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
{
"name": "CI Pipeline"
}import { Auth } from "@productcraft/auth";
// Admin routes read PRODUCTCRAFT_API_KEY; consumer routes need no key
const auth = new Auth();
const m2mClientCreate = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").credentials.create({ name: "CI Pipeline" });auth.admin.app(…).credentials.create(params, options?): Auth.M2mClientCreate
Response
{
"id": "string",
"client_id": "m2m_a1b2c3d4...",
"client_secret": "string",
"name": "string",
"created_at": "2026-01-01T00:00:00.000Z"
}