/v1/account/api_keys/{hashid}
API Key
Update API key
Update an API key’s allowed sources.
- Secret keys: Set allowed IP addresses/CIDR ranges
- Publishable keys: Set allowed origin URLs
Pass an empty array to allow all sources (not recommended for production).
Parameters
| Name | Location | Type | Description |
|---|---|---|---|
hashid
*
|
path | string | API key hashid |
X-API-Key
*
|
header | string | API key for authentication |
* Required parameter
Request Body
Parameters for updating an API key
api_key
object
allowed_sources
array[string]
Allowed IPs/CIDRs (secret keys) or origins (publishable keys)
Example: ["192.168.1.0/24","10.0.0.1"]
Array items:
Response
Content-Type: application/json
success
boolean
data
object
message
string
Example: API key updated successfully
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
Code Examples
import os
from aho_sdk import AhoSdk
client = AhoSdk.account(api_key=os.environ["AHO_API_KEY"])
result = client.api_keys.update(
hashid="example_hashid",
body={
"api_key": {
"allowed_sources": ["192.168.1.0/24", "10.0.0.1"]
}
}
)
client = AhoSdk.account(api_key: ENV["AHO_API_KEY"])
result = client.api_keys.update(
hashid: "example_hashid",
body: {
api_key: {
allowed_sources: ["192.168.1.0/24", "10.0.0.1"]
}
}
)
import { AhoSdk } from '@aho/sdk';
const client = AhoSdk.account({ apiKey: process.env.AHO_API_KEY });
const result = await client.api_keys.update({
hashid: "example_hashid",
body: {
apiKey: {
allowedSources: ["192.168.1.0/24", "10.0.0.1"]
}
}
});
curl -X PATCH 'https://api.aho.com/v1/account/api_keys/example_hashid' \
-H 'X-API-Key: $AHO_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"api_key": {
"allowed_sources": [
"192.168.1.0/24",
"10.0.0.1"
]
}
}'
Try It
Log in to test this endpoint directly from the documentation.
Log in