/v1/apps/{app_id}AuthUpdate app display name, slug, metadata, and retention settings
Path parameters
app_id*stringId of the app.
Request body
display_namestringNew display name
Example: "Acme Corp"
slugstringRename the app's slug. The old slug remains resolvable for 30 days as a JWKS-URL alias so existing customer-side verifiers don't break instantly. Same shape as the create-slug: lowercase alphanumeric + hyphens, 3–48 chars, not shaped like a UUID.
Example: "acme-corp"
metadataobjectYour own key/value data for this app. It replaces the stored metadata, and keys are kept exactly as you send them. The `auth` key holds the app's sign-in settings, which you change with `PATCH /v1/apps/{appId}/auth-config` (it checks every value): leave `auth` out and it is kept as it is, or send it back unchanged. A different `auth` value is refused with 400 `AUTH_SETTINGS_IN_METADATA`.
Example: {"plan":"pro","region":"us-east-1"}
audit_retention_daysnumberDays of `audit_log` history kept for this app. A nightly job deletes rows older than this. Minimum 30 days so an incident review always has a month to look at; maximum 3650 (10 years).
Example: 365
webhook_attempt_retention_daysnumberDays of outbound-webhook delivery-attempt history kept for this app. Attempts are a debugging aid rather than a compliance record, hence the shorter floor.
Example: 30
Response · 200
id*stringUnique identifier of the app.
slug*stringURL-safe identifier of the app, unique within its parent.
Example: "acme-app"
display_name*stringHuman-readable name of the app.
Example: "Acme"
workspace_id*stringOwning workspace UUID.
status*objectApp status: `active`, `suspended` (sign-ins refused) or `archived`.
environment*objectWhich 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*stringAccount that created the app.
metadata*objectFree-form JSON object you attach to the app; returned as stored.
created_at*string · date-timeWhen the app was created (ISO 8601).
updated_at*string · date-timeWhen the app was last changed (ISO 8601).
audit_retention_days*numberDays of `audit_log` history kept for this app. A nightly job deletes rows older than this. 30-3650.
Example: 365
webhook_attempt_retention_days*numberDays of outbound-webhook delivery-attempt history kept for this app. 7-365.
Example: 30
Example
Request
PATCH https://api.auth.productcraft.co/v1/apps/{app_id}
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
{
"display_name": "Acme Corp",
"slug": "acme-corp",
"metadata": {
"plan": "pro",
"region": "us-east-1"
},
"audit_retention_days": 365,
"webhook_attempt_retention_days": 30
}import { Auth } from "@productcraft/auth";
// Admin routes read PRODUCTCRAFT_API_KEY; consumer routes need no key
const auth = new Auth();
const app = await auth.apps.update("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f", { audit_retention_days: 365 });auth.apps.update(appId, params?, options?): Auth.App
Response
{
"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
}