Auth API reference

Auth API · Apps

post/v1/apps/{app_id}/cloneAuth

Create a second app in the same workspace whose configuration matches this one — the "staging app" flow. Copies the auth config, roles, permissions, notification settings and the webhook target (with a NEW signing secret), and optionally tenants. Never copies credentials, end-users, sessions, signing keys, federated provider configs or audit history.

Path parameters

app_id*string

Id of the app.

Headers

Idempotency-Keystring

Stripe-style idempotency key. A clone mints JWKS keys, copies the RBAC model and returns a webhook signing secret exactly once; a retry without this header creates a second app and a second secret the customer never sees. 24h TTL.

Request body

slug*string

Slug for the new app. Must be free — a slug still live as a rename alias counts as taken.

Example: "acme-app-staging"

environment*enum (3)

Environment the clone is. Usually `staging`.

Example: "staging"

display_namestring

Display name for the clone. Defaults to the source's, which is what makes the console group the two together.

Example: "Acme"

copy_tenantsboolean

Also copy the source app's tenants (slug, display name, metadata, status). Memberships are NEVER copied — they point at end-user accounts, which are not copied either, so a cloned tenant is an empty tenant. Default false.

Response · 201 Clone created. `webhook_signing_secret` is returned exactly once.

app*object
id*string

Unique identifier of the app.

slug*string

URL-safe identifier of the app, unique within its parent.

Example: "acme-app"

display_name*string

Human-readable name of the app.

Example: "Acme"

workspace_id*string

Owning workspace UUID.

status*object

App status: `active`, `suspended` (sign-ins refused) or `archived`.

environment*object

Which environment this app IS. One app is one environment — there is no switch; a staging app is a separate app created via `POST /v1/apps/:appId/clone`. Set at create time and never changed afterwards. Every app that predates this field is `production`.

Example: "production"

created_by*string

Account that created the app.

metadata*object

Free-form JSON object you attach to the app; returned as stored.

created_at*string · date-time

When the app was created (ISO 8601).

updated_at*string · date-time

When the app was last changed (ISO 8601).

audit_retention_days*number

Days of `audit_log` history kept for this app. A nightly job deletes rows older than this. 30-3650.

Example: 365

webhook_attempt_retention_days*number

Days of outbound-webhook delivery-attempt history kept for this app. 7-365.

Example: 30

copied*object

What came across: counts for roles, permissions, role_permissions and tenants, plus booleans for notification settings and the webhook.

providers_to_configure*array

Federated providers configured on the source that the clone does NOT have. A provider config IS its secret (Apple private key, OAuth client secret), so there is nothing safe to copy — configure these on the clone before using federated sign-in.

Example: ["apple","google"]

webhook_signing_secret*string

Freshly minted webhook signing secret for the clone, returned exactly ONCE. Null when the source had no webhook, or when its target no longer resolves safely. The source app's secret is never reused.

notes*array

Human-readable notes about anything deliberately skipped.

Example

Request

POST https://api.auth.productcraft.co/v1/apps/{app_id}/clone
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json

{
  "slug": "acme-app-staging",
  "environment": "staging",
  "display_name": "Acme",
  "copy_tenants": false
}

Response

{
  "app": {
    "id": "string",
    "slug": "acme-app",
    "display_name": "Acme",
    "workspace_id": "string",
    "status": {},
    "environment": "production",
    "created_by": "string",
    "metadata": {},
    "created_at": "2026-01-01T00:00:00.000Z",
    "updated_at": "2026-01-01T00:00:00.000Z",
    "audit_retention_days": 365,
    "webhook_attempt_retention_days": 30
  },
  "copied": {},
  "providers_to_configure": [
    "apple",
    "google"
  ],
  "webhook_signing_secret": "string",
  "notes": [
    "string"
  ]
}