Authentication
How Authentication Works
Every You.com API request requires an API key, passed in the X-API-Key header. Get a key from the Platform API Keys page.
For key creation, rotation, and revocation, see API Key Management. This page covers how a request is authenticated, not how the key itself is managed.
The YDC_API_KEY Convention
All code samples in these docs read the key from an environment variable named YDC_API_KEY. It is the canonical variable name across the docs, the SDKs, and every integration example. Set it once and the samples pick it up.
TypeScript and JavaScript have three paths. Use fetch against the REST APIs when the application needs the JSON. Use @youdotcom-oss/mcp, or the hosted server at https://api.you.com/mcp, when an agent should call the tools. Use the Python SDK when you want a typed client that tracks new API fields. The @youdotcom-oss/sdk package is deprecated.
Never hardcode the key in source. Keep it in an environment variable or a secrets manager, and add .env files to .gitignore.
Scopes and 403 Responses
API keys are scoped per product. A key without access to a given path returns 403 Forbidden with {"detail": "Missing required scopes"}—for example, calling /v1/contents with a key that only has Web Search API access.
If you need access to an API your current key does not cover, create a new key with the right scope from the Platform.
Keyless Access via the Free MCP Profile
You can try the Web Search API without an API key by connecting any MCP-enabled client to api.you.com/mcp?profile=free. That profile is keyless and exposes you-search and you-discover (100 queries per day). It does not include you-contents, you-research, you-finance, or you-balance. For setup, see the MCP Server guide.
For everything beyond evaluation, use an API key.