Skip to main content
POST
/
auth
/
proxy
/
update
curl https://api.electronhub.ai/v1/auth/proxy/update \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $ELECTRONHUB_API_KEY" \
  -d '{
    "proxy_key": "ek-proxy-1234567890abcdef",
    "name": "Updated Production Key",
    "expires_at": 1767225600,
    "allocated_ammount": 150.0,
    "model_whitelist": ["gpt-4o", "claude-3-5-sonnet-20241022", "dall-e-3"],
    "ip_whitelist": ["192.168.1.0/24"]
  }'
{
  "message": "Proxy key updated"
}
Update the configuration of a proxy key you own. The proxy key to update is now identified by the proxy_key field in the request body so the URL is static and can be exact-matched at the edge (Cloudflare, etc.), making it immune to path-traversal-append DDoS abuse. The legacy POST /v1/auth/proxy/update/{proxy_key} still works for backward compatibility but is discouraged for new integrations.
curl https://api.electronhub.ai/v1/auth/proxy/update \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $ELECTRONHUB_API_KEY" \
  -d '{
    "proxy_key": "ek-proxy-1234567890abcdef",
    "name": "Updated Production Key",
    "expires_at": 1767225600,
    "allocated_ammount": 150.0,
    "model_whitelist": ["gpt-4o", "claude-3-5-sonnet-20241022", "dall-e-3"],
    "ip_whitelist": ["192.168.1.0/24"]
  }'
{
  "message": "Proxy key updated"
}

Request Body

proxy_key
string
required
The proxy key to update (starts with ek-proxy-). Must be a string between 1 and 256 characters and must be a proxy key you own — cross-account updates return 403 Forbidden.
name
string
required
Updated human-readable name for the proxy key (max 25 characters).
expires_at
integer
required
New expiration timestamp in seconds since Unix epoch. Use -1 for no expiration.
allocated_ammount
number
required
New credit amount to allocate to this proxy key. Must be positive and cannot exceed your tier’s per-key cap (default $10,000).
limit_type
string
default:"daily"
Spend window for the allocation. One of "daily", "weekly", or "monthly".
model_whitelist
array
Updated list of model IDs this key can access. Leave empty or omit to allow all models.
ip_whitelist
array
Updated list of IP addresses or CIDR blocks allowed to use this key. Leave empty or omit to allow all IPs.

Important Notes

Credit Changes: When increasing allocated_ammount, the difference is deducted from your account. When decreasing, unused credits are returned.
Active Requests: Changes take effect immediately. Any in-flight requests using the proxy key complete with the old settings.
Usage Preservation: used_ammount is preserved across updates — only the allocation limit changes.

Common Update Scenarios

{
  "proxy_key": "ek-proxy-1234567890abcdef",
  "name": "Production Key",
  "expires_at": 1767225600,
  "allocated_ammount": 100.0,
  "model_whitelist": ["gpt-4o"],
  "ip_whitelist": ["192.168.1.0/24"]
}
{
  "proxy_key": "ek-proxy-1234567890abcdef",
  "name": "Production Key",
  "expires_at": 1735689600,
  "allocated_ammount": 200.0,
  "model_whitelist": ["gpt-4o"],
  "ip_whitelist": ["192.168.1.0/24"]
}
{
  "proxy_key": "ek-proxy-1234567890abcdef",
  "name": "Production Key",
  "expires_at": 1735689600,
  "allocated_ammount": 100.0,
  "model_whitelist": ["gpt-4o", "claude-3-5-sonnet-20241022"],
  "ip_whitelist": ["192.168.1.0/24"]
}
{
  "proxy_key": "ek-proxy-1234567890abcdef",
  "name": "Production Key",
  "expires_at": 1735689600,
  "allocated_ammount": 100.0,
  "model_whitelist": ["gpt-4o"],
  "ip_whitelist": ["10.0.0.0/8", "203.0.113.0/24"]
}

Error Codes

400
error
Bad Request — invalid input data or validation failed.
401
error
Unauthorized — missing, malformed, or invalid Authorization header. JWT tokens are not accepted on this endpoint.
403
error
Forbidden — the proxy key exists but is owned by a different account.
404
error
Not Found — no proxy key with that value exists.
422
error
Unprocessable Entity — the request body is missing proxy_key or any required field, or violates the length constraint (1 <= len(proxy_key) <= 256).
429
error
Rate Limited — too many requests, please slow down.

Notes

  • Requires an API key (ek-...) in the Authorization header. JWT tokens are intentionally rejected.
  • Proxy keys themselves (ek-proxy-...) cannot call this endpoint — only the parent account that owns the proxy key can update it.

Authorizations

Authorization
string
header
required

Enter your API key (starts with 'ek-')

Body

application/json
proxy_key
string
required

The proxy key to update (must be one you own)

Required string length: 1 - 256
Example:

"ek-proxy-1234567890abcdef"

name
string
required

Name of the proxy key

Maximum string length: 25
Example:

"Updated API Key"

expires_at
integer
required

Expiration timestamp in seconds (-1 for no expiration)

Example:

1735689600

allocated_ammount
number
required

Allocated credit amount

Required range: x >= 0
Example:

15

limit_type
enum<string>
default:daily

Spend window for the allocation

Available options:
daily,
weekly,
monthly
model_whitelist
string[]

List of allowed models (empty for all models)

Example:
["gpt-4o", "claude-3-5-sonnet-20241022"]
ip_whitelist
string[]

List of allowed IP addresses or CIDR blocks (empty for all IPs)

Example:
["192.168.1.0/24", "203.0.113.42"]

Response

Proxy key updated successfully

message
string
Example:

"Proxy key updated"