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

# Create API Key

> Create a new API key with optional provider/model restrictions, rate limits, and expiry.

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.arouter.ai/api/v1/keys \
    -H "Authorization: Bearer lr_mgmt_xxxx" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "production-backend",
      "allowed_providers": ["openai", "anthropic"],
      "limit": 150,
      "limit_reset": "monthly",
      "expires_at": "2025-12-31T23:59:59Z"
    }'
  ```

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

  resp = requests.post(
      "https://api.arouter.ai/api/v1/keys",
      headers={"Authorization": "Bearer lr_mgmt_xxxx"},
      json={
          "name": "production-backend",
          "allowed_providers": ["openai", "anthropic"],
          "limit": 150,
          "limit_reset": "monthly",
      },
  )
  ```

  ```go Go theme={null}
  key, err := client.CreateKey(ctx, &arouter.CreateKeyRequest{
      Name:             "production-backend",
      AllowedProviders: []string{"openai", "anthropic"},
      Limit:            float64Ptr(150),
      LimitReset:       "monthly",
  })
  ```

  ```typescript Node.js theme={null}
  const key = await router.createKey({
    name: "production-backend",
    allowed_providers: ["openai", "anthropic"],
    limit: 150,
    limit_reset: "monthly",
  });
  console.log("API Key:", key.key); // lr_live_xxx
  ```
</RequestExample>
