Skip to navigation

API Keys

View as MarkdownOpen in Claude

Overview

API keys authenticate your requests to the You.com API. You can create and manage your keys from the API Keys page on the Platform.

An agent can also reach the Web Search API without a key at all. Machine payments settle each request from a funded wallet, which suits callers you cannot provision a credential for. Keys remain the right choice when you need Zero Data Retention, usage analytics, or team roles.

Creating an API Key

  1. Go to you.com/platform/api-keys
  2. Click Create API Key
  3. Give your key a descriptive name (e.g., “Production”, “Development”)
  4. Optionally, turn on a spending cap and enter a dollar amount
  5. Copy the key immediately — it will only be shown once

Store your API key securely as soon as it’s created. You won’t be able to view the full key again after leaving the page.

Using Your Key in Code

We use YDC_API_KEY as the canonical environment variable name throughout this documentation, our SDKs, and every integration example. Store your key in that variable once, then read it in your code instead of hardcoding the value.

export YDC_API_KEY="<YDC_API_KEY>"

Runnable code samples throughout these docs read the key from the YDC_API_KEY environment variable, as shown above. Configuration files and setup snippets use <YDC_API_KEY> as a placeholder for the key value—replace it with your real key.

Viewing and Managing Keys

The API Keys page shows all your active keys with:

  • Key name
  • Creation date
  • Last used date
  • A partially masked key value
  • Spend for the current billing period against the key’s spending cap, when one is set

You can rename or delete keys from this page at any time. If you belong to an organization, your role determines which keys you can see—Owners and Admins see every key in the organization, while Developers see only the keys they created.

Spending Caps

A spending cap sets a dollar limit on how much a single API key can spend in a billing period. Keys have no cap until you set one. Use a cap on a key whose spend you want to bound separately, such as a development key or an agent that runs unattended, without limiting the rest of your organization’s credits.

Set a cap when you create a key, or add, change, or remove one later from the key’s options menu on the API Keys page. Owners and Admins can set caps on any key in the organization. Developers can set caps on the keys they created. Team Management lists the full permissions for each role.

When a key reaches its cap, requests made with that key return 429 with the spend_cap_exceeded error code. API troubleshooting covers how to tell this response apart from a rate limit.

Rotating and Revoking Keys

To rotate a key, create a new key, update your applications to use the new key, and then delete the old one.

To revoke a key immediately, click Delete next to the key on the API Keys page. Revoked keys stop working immediately.

If you suspect a key has been compromised, revoke it immediately and create a new one.

Security Best Practices

  • Use environment variables—Store API keys in environment variables, not in your source code. We use YDC_API_KEY as the canonical variable name.
  • Never commit keys to version control — Add .env files to your .gitignore.
  • Use separate keys for each environment — Create distinct keys for development, staging, and production.
  • Rotate keys regularly — Periodically rotate keys to limit the impact of any potential exposure.
  • Apply least privilege — Only share keys with team members and services that need them.