Skip to main content
POST /v1/account/api_keys/{hashid}/regenerate API Key

Regenerate API key

Regenerate an API key’s value. The old key value stops working immediately.

IMPORTANT: For secret keys, the new value is only returned once in this response.
Store it securely - you cannot retrieve it again.

Key settings (allowed_sources) are preserved during regeneration.

Parameters

Name Location Type Description
hashid * path string API key hashid
X-API-Key * header string API key for authentication

* Required parameter

Response

200 API key regenerated

Content-Type: application/json

success boolean
data object
message string

Example: API key regenerated. The old key value no longer works.

api_key object

An API key for programmatic access. Each account has one secret key and one publishable key: - **Secret keys**: For server-to-server API calls. Masked in responses. - **Publishable keys**: For browser-based requests. Always shown in full.

id * string

Unique key identifier (hashid)

Example: apikey_abc123

type * string

Key type

Allowed values: "secret_key", "publishable_key"

Example: secret_key

name * string

Display name for the key

Example: Secret Key

status * string

Key lifecycle status

Allowed values: "pending", "active", "revoked", "expired"

Example: active

usable * boolean

Whether the key can be used (active and not expired)

Example: true

allowed_sources * array[string]

Allowed IPs/CIDRs (secret keys) or origins (publishable keys)

Example: ["192.168.1.0/24"]

Array items:

key string nullable

Full key value. Always shown for publishable keys; only on regeneration for secret keys.

Example: aho_pub_abc123...

masked_key string nullable

Masked key (secret keys only)

Example: aho_sec_abc...xyz

last_used_at string (date-time) nullable

When the key was last used

Example: 2025-03-15T10:30:00Z

expires_at string (date-time) nullable

When the key expires

created_at * string (date-time)

When the key was created

Example: 2025-01-01T00:00:00Z

updated_at * string (date-time)

When the key was last updated

Example: 2025-03-15T10:30:00Z

warning string nullable

Security warning (secret keys only)

Example: Store this key securely. It will not be shown again.

Code Examples

import os
from aho_sdk import AhoSdk

client = AhoSdk.account(api_key=os.environ["AHO_API_KEY"])

result = client.regenerate.create(
    hashid="example_hashid"
)

Try It

Log in to test this endpoint directly from the documentation.

Log in