Skip to main content

Update Identity

Update an identity's metadata and rate limits. Only specified fields are modified - others remain unchanged.

Perfect for subscription changes, plan upgrades, or updating user information. Changes take effect immediately.

Important
Requires identity.*.update_identity permission
Rate limit changes propagate within 30 seconds

1 min read
post/v2/identities.updateIdentity
Request example
Response
post/v2/identities.updateIdentity

Authorization

Authorizationstringheaderrequired#

Unkey uses bearer tokens for authentication. Public integrations use root keys, while the dashboard proxy uses short-lived JWTs.
To authenticate, include the token in the Authorization header of each request:

Root keys have specific permissions attached to them, controlling what operations they can perform. Legacy permissions use tuple strings like api.*.create_key; resource permissions use Unkey Resource Names plus actions, like unkey:v1:ws_123:keyspaces/*#create_key.
Security best practices:

  • Keep root keys secure and never expose them in client-side code
  • Use different root keys for different environments
  • Rotate keys periodically, especially after team member departures
  • Create keys with minimal necessary permissions following least privilege principle
  • Monitor key usage with audit logs.

Body

application/json
identitystringrequired#
The ID of the identity to update. Accepts either the externalId (your system-generated identifier) or the identityId (internal identifier returned by the identity service).

Length: min 1

metaobject#

Replaces all existing metadata with this new metadata object.
Omitting this field preserves existing metadata, while providing an empty object clears all metadata.
Avoid storing sensitive data here as it's returned in verification responses.
Large metadata objects increase verification latency and should stay under 10KB total size.

ratelimitsobject[]#

Replaces all existing identity rate limits with this complete list of rate limits.
Omitting this field preserves existing rate limits, while providing an empty array removes all rate limits.
These limits are shared across all keys belonging to this identity, preventing abuse through multiple keys.
Rate limit changes take effect immediately but may take up to 30 seconds to propagate across all regions.

Items: max 50

Show child attributes
namestringrequired#

The name of this rate limit. This name is used to identify which limit to check during key verification.

Best practices for limit names:

  • Use descriptive, semantic names like 'api_requests', 'heavy_operations', or 'downloads'
  • Be consistent with naming conventions across your application
  • Create separate limits for different resource types or operation costs
  • Consider using namespaced names for better organization (e.g., 'files.downloads', 'compute.training')

You will reference this exact name when verifying keys to check against this specific limit.

Length: 3–128

limitintegerrequired#

The maximum number of operations allowed within the specified time window.

When this limit is reached, verification requests will fail with code=RATE_LIMITED until the window resets. The limit should reflect:

  • Your infrastructure capacity and scaling limitations
  • Fair usage expectations for your service
  • Different tier levels for various user types
  • The relative cost of the operations being limited

Higher values allow more frequent access but may impact service performance.

Range: >= 1

durationintegerrequired#

The duration for each ratelimit window in milliseconds.

This controls how long the rate limit counter accumulates before resetting. Common values include:

  • 1000 (1 second): For strict per-second limits on high-frequency operations
  • 60000 (1 minute): For moderate API usage control
  • 3600000 (1 hour): For less frequent but costly operations
  • 86400000 (24 hours): For daily quotas

Shorter windows provide more frequent resets but may allow large burst usage. Longer windows provide more consistent usage patterns but take longer to reset after limit exhaustion.

Range: >= 1000

autoApplybooleanrequired#
Whether this ratelimit should be automatically applied when verifying a key.

Default: false

Responses

application/json
Identity successfully updated
dataobjectrequired#
Show child attributes
idstringrequired#
Identity ID
externalIdstringrequired#
External identity ID
metaobject#
Identity metadata
ratelimitsobject[]#
Identity ratelimits
Show child attributes
idstringrequired#
Unique identifier for this rate limit configuration.

Length: 8–255Pattern: ^rl_[a-zA-Z0-9_]+$

namestringrequired#
Human-readable name for this rate limit.

Length: 1–128

limitintegerrequired#
Maximum requests allowed within the time window.

Range: 1–1000000

durationintegerrequired#
Rate limit window duration in milliseconds.

Range: 1000–2592000000

autoApplybooleanrequired#
Whether this rate limit was automatically applied when verifying the key.
metaobjectrequired#
Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The requestId is particularly important when troubleshooting issues with the Unkey support team.
Show child attributes
requestIdstringrequired#
A unique id for this request. Always include this ID when contacting support about a specific API request. This identifier allows Unkey's support team to trace the exact request through logs and diagnostic systems to provide faster assistance.