POST
/
auth
/
proxy
/
validate
curl https://api.electronhub.ai/v1/auth/proxy/validate \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ek-proxy-1234567890abcdef" \
  -d '{
    "model": "gpt-4o"
  }'
{
  "valid": true,
  "message": "Access granted"
}
curl https://api.electronhub.ai/v1/auth/proxy/validate \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ek-proxy-1234567890abcdef" \
  -d '{
    "model": "gpt-4o"
  }'
{
  "valid": true,
  "message": "Access granted"
}

Overview

Validate whether a proxy key can access a specific model from the current IP address. This endpoint is useful for pre-flight checks before making API requests, especially in applications that need to handle access restrictions gracefully.

Proxy Key Only: This endpoint only works with proxy keys (starting with ek-proxy-). Regular API keys will receive a 400 error.

Request Body

model
string

The model ID to validate access for. If omitted, validates general proxy key access without model-specific checks.

Response Fields

valid
boolean

Whether the proxy key has valid access (true) or is restricted (false)

message
string

Human-readable explanation of the validation result

Use Cases

Pre-flight Checks

Validate access before making expensive API calls

User Experience

Show users which models they can access

Error Prevention

Avoid authentication errors in production workflows

Access Auditing

Log and monitor access patterns and restrictions

Error Codes

400
error

Bad Request - Not a proxy key or invalid request format

401
error

Unauthorized - Invalid proxy key

429
error

Rate Limited - Too many validation requests

Authorizations

Authorization
string
header
required

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

Body

application/json

Response

200 - application/json

Access validation result

The response is of type object.