> ## Documentation Index
> Fetch the complete documentation index at: https://docs.electronhub.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Lookup Proxy Key

> Retrieve metadata about a single proxy key you own

Returns the full metadata for one of your proxy keys, identified by the `proxy_key` field in the request body. This is the static-URL replacement for `GET /v1/auth/proxy/{proxy_key}`, designed so the URL can be exact-matched at the edge (Cloudflare, etc.) without being susceptible to path-traversal-append abuse.

The legacy `GET /v1/auth/proxy/{proxy_key}` still works for backward compatibility but is discouraged for new integrations.

<RequestExample>
  ```bash cURL theme={null}
  curl https://api.electronhub.ai/v1/auth/proxy/lookup \
    -H "Authorization: Bearer $ELECTRONHUB_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"proxy_key": "ek-proxy-1234567890abcdef"}'
  ```

  ```python Python theme={null}
  import httpx

  response = httpx.post(
      "https://api.electronhub.ai/v1/auth/proxy/lookup",
      headers={
          "Authorization": f"Bearer {api_key}",
          "Content-Type": "application/json",
      },
      json={"proxy_key": "ek-proxy-1234567890abcdef"},
  )

  proxy = response.json()
  print(proxy["name"], proxy["allocated_ammount"] - proxy["used_ammount"])
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.electronhub.ai/v1/auth/proxy/lookup', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${process.env.ELECTRONHUB_API_KEY}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({ proxy_key: 'ek-proxy-1234567890abcdef' }),
  });

  const proxy = await response.json();
  console.log(proxy.name, proxy.allocated_ammount - proxy.used_ammount);
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "name": "Production API Key",
    "key": "ek-proxy-1234567890abcdef",
    "user_id": "user_abc123",
    "expires_at": 1735689600,
    "allocated_ammount": 100.0,
    "used_ammount": 25.5,
    "is_active": true,
    "model_whitelist": ["gpt-4o", "claude-3-5-sonnet-20241022"],
    "ip_whitelist": ["192.168.1.0/24"],
    "enabled_thinking": true,
    "created_at": 1704067200,
    "last_used": 1704153600
  }
  ```
</ResponseExample>

## Request Body

<ParamField body="proxy_key" type="string" required>
  The proxy key to look up. Must be a string between 1 and 256 characters and must be a proxy key you own — cross-account lookups return `403 Forbidden`.
</ParamField>

## Response Fields

<ResponseField name="name" type="string">
  The human-readable name of the proxy key.
</ResponseField>

<ResponseField name="key" type="string">
  The proxy key value (starts with `ek-proxy-`).
</ResponseField>

<ResponseField name="user_id" type="string">
  The ID of the account that owns this proxy key.
</ResponseField>

<ResponseField name="expires_at" type="integer">
  Expiration timestamp in seconds since Unix epoch. `-1` means no expiration.
</ResponseField>

<ResponseField name="allocated_ammount" type="number">
  Total credit amount allocated to this proxy key.
</ResponseField>

<ResponseField name="used_ammount" type="number">
  Amount of credits already used by this proxy key.
</ResponseField>

<ResponseField name="is_active" type="boolean">
  Whether the proxy key is currently active.
</ResponseField>

<ResponseField name="model_whitelist" type="array">
  Model IDs this key can access. Empty array means all models.
</ResponseField>

<ResponseField name="ip_whitelist" type="array">
  IPs or CIDR blocks allowed to use this key. Empty array means all IPs.
</ResponseField>

<ResponseField name="enabled_thinking" type="boolean">
  Whether extended-thinking models are allowed on this proxy key.
</ResponseField>

<ResponseField name="created_at" type="integer">
  Timestamp the proxy key was created.
</ResponseField>

<ResponseField name="last_used" type="integer">
  Timestamp the proxy key was last used.
</ResponseField>

## Error Responses

<ResponseField name="401" type="error">
  **Unauthorized** — missing, malformed, or invalid `Authorization` header. JWT tokens are not accepted on this endpoint.
</ResponseField>

<ResponseField name="403" type="error">
  **Forbidden** — the proxy key exists but is owned by a different account.
</ResponseField>

<ResponseField name="404" type="error">
  **Not Found** — no proxy key with that value exists.
</ResponseField>

<ResponseField name="422" type="error">
  **Unprocessable Entity** — the request body is missing `proxy_key` or violates the length constraint (`1 <= len <= 256`).
</ResponseField>

<ResponseField name="429" type="error">
  **Rate Limited** — too many requests, please slow down.
</ResponseField>

## 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 read its metadata.


## OpenAPI

````yaml POST /auth/proxy/lookup
openapi: 3.0.1
info:
  title: Electron Hub API
  description: >-
    Unified API platform integrating 200+ AI models for chat, image generation,
    embeddings, and more.
  version: 1.0.0
  contact:
    name: Electron Hub Support
    email: support@electronhub.ai
    url: https://discord.com/invite/electronhub
  license:
    name: MIT
servers:
  - url: https://api.electronhub.ai/v1
    description: Production API v1
security:
  - bearerAuth: []
paths:
  /auth/proxy/lookup:
    post:
      summary: Lookup Proxy Key
      description: >-
        Retrieve metadata for a single proxy key you own. Replaces the legacy
        `GET /auth/proxy/{proxy_key}`; uses a static URL so the path can be
        exact-matched at the edge.
      operationId: lookupProxyKey
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProxyKeyLookupRequest'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProxyKey'
        '401':
          description: Missing, invalid, or non-API-key Authorization header
        '403':
          description: Proxy key is owned by a different account
        '404':
          description: Proxy key not found
components:
  schemas:
    ProxyKeyLookupRequest:
      type: object
      required:
        - proxy_key
      properties:
        proxy_key:
          type: string
          description: The proxy key to look up / toggle / delete (must be one you own)
          minLength: 1
          maxLength: 256
          example: ek-proxy-1234567890abcdef
    ProxyKey:
      type: object
      required:
        - name
        - expires_at
        - allocated_ammount
      properties:
        name:
          type: string
          description: Name of the proxy key
          maxLength: 25
        expires_at:
          type: integer
          description: Expiration timestamp (-1 for no expiration)
        allocated_ammount:
          type: number
          description: Allocated credit amount
          minimum: 0
        model_whitelist:
          type: array
          items:
            type: string
          description: List of allowed models
          default: []
        ip_whitelist:
          type: array
          items:
            type: string
          description: List of allowed IP addresses or CIDR blocks
          default: []
        used_ammount:
          type: number
          description: Amount of credits used
          readOnly: true
        is_active:
          type: boolean
          description: Whether the proxy key is active
          readOnly: true
        key:
          type: string
          description: The proxy key value
          readOnly: true
        created_at:
          type: integer
          description: Creation timestamp
          readOnly: true
        last_used:
          type: integer
          description: Last usage timestamp
          readOnly: true
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Enter your API key (starts with 'ek-')

````