Developer Resources

Dev
View as MarkdownOpen in Claude

Overview

This section provides essential tools, references, and resources to help you integrate and troubleshoot the You.com API effectively.



SDKs & Libraries

Python SDK

JavaScript/TypeScript SDK

Model Context Protocol (MCP)

Integrate You.com search directly into agentic IDEs like Claude Code, Cursor, VS Code, and more:

  • Quick setup with hosted server or local NPM package
  • Works with 10+ popular development environments
  • Real-time web search for AI assistants
  • View MCP Documentation →

Authentication

All API requests require authentication using an API key.

Get your API Key

  1. Visit the You.com platform
  2. Create a new API key
  3. Copy and store it securely

Using Your API Key

Include your API key in the request header:

1curl --request GET \
2 --url 'https://ydc-index.io/v1/search?query=example' \
3 --header 'X-API-Key: YOUR_API_KEY'

For Agent APIs, use Bearer token authentication:

1curl -N \
2 -H "Authorization: Bearer YOUR_API_KEY" \
3 -H "Content-Type: application/json" \
4 -X POST https://api.you.com/v1/agents/runs \
5 -d '{"agent": "express", "input": "test", "stream": true}'

Security Best Practice: Never commit API keys to version control. Use environment variables or secure secret management systems.


Rate Limits & Quotas

API usage is subject to rate limits based on your subscription tier:

  • Free Tier: Limited requests per day
  • Paid Tiers: Higher limits based on plan

Rate limit details are included in response headers:

  • X-RateLimit-Limit - Total requests allowed
  • X-RateLimit-Remaining - Requests remaining
  • X-RateLimit-Reset - Time when limit resets (Unix timestamp)

When you exceed rate limits, you’ll receive a 429 Too Many Requests response.

Handling Rate Limits:

1import time
2import requests
3
4def make_request_with_retry(url, headers):
5 response = requests.get(url, headers=headers)
6
7 if response.status_code == 429:
8 retry_after = int(response.headers.get('Retry-After', 60))
9 print(f"Rate limited. Retrying after {retry_after} seconds...")
10 time.sleep(retry_after)
11 return make_request_with_retry(url, headers)
12
13 return response

For higher rate limits, upgrade your plan or contact [email protected].


Best Practices

1. Use SDKs When Possible

SDKs handle authentication, retries, and error handling automatically:

1# ✅ Good: Using SDK
2import os
3from youdotcom import You
4
5with You(api_key_auth=os.getenv("YOU_API_KEY")) as you:
6 response = you.search.unified(query="example")
7
8# ❌ Less ideal: Manual requests
9import requests
10response = requests.get(
11 "https://ydc-index.io/v1/search",
12 params={"query": "example"},
13 headers={"X-API-Key": os.getenv("YOU_API_KEY")}
14)

2. Implement Exponential Backoff

For retry logic, use exponential backoff to avoid overwhelming the API:

1import time
2from youdotcom import You, errors
3
4def exponential_backoff(attempt):
5 return min(2 ** attempt, 60) # Max 60 seconds
6
7with You(api_key_auth="YOUR_API_KEY") as you:
8 for attempt in range(5):
9 try:
10 response = you.search.unified(query="test")
11 break
12 except errors.YouError as e:
13 if e.status_code == 429 and attempt < 4:
14 wait_time = exponential_backoff(attempt)
15 time.sleep(wait_time)
16 else:
17 raise

3. Use Streaming for Agents

Provide better UX by streaming agent responses:

1from youdotcom import You
2from youdotcom.models import ExpressAgentRunsRequest, ResponseOutputTextDelta
3
4with You(api_key_auth="YOUR_API_KEY") as you:
5 # ✅ Good: Stream responses for real-time feedback
6 response = you.agents.runs.create(
7 request=ExpressAgentRunsRequest(input="query", stream=True)
8 )
9
10 with response as stream:
11 for chunk in stream:
12 if isinstance(chunk.data, ResponseOutputTextDelta):
13 print(chunk.data.response.delta, end="", flush=True)

4. Cache When Appropriate

Cache search results for frequently asked questions:

1from functools import lru_cache
2from youdotcom import You
3
4you = You(api_key_auth="YOUR_API_KEY")
5
6@lru_cache(maxsize=100)
7def cached_search(query: str):
8 return you.search.unified(query=query)

5. Handle Errors Gracefully

Always provide fallback behavior:

1from youdotcom import You, errors
2
3with You(api_key_auth="YOUR_API_KEY") as you:
4 try:
5 response = you.search.unified(query=user_query)
6 except errors.YouError as e:
7 if e.status_code == 401:
8 print("Configuration error. Please check your API key.")
9 elif e.status_code == 429:
10 print("Too many requests. Please try again in a moment.")
11 else:
12 print(f"API error: {e.message}")

Frequently Asked Questions

Visit you.com/platform/api-keys to create and manage API keys. You’ll need to sign up for a You.com account and select a plan.

Rate limits vary by subscription tier. Free tier has limited daily requests, while paid tiers offer higher limits. Check your current usage and limits in the API Console.

Yes! The You.com API is production-ready. We recommend using our official SDKs, implementing proper error handling, and monitoring your usage to stay within rate limits.

Custom Agents must be created via the You.com UI. Once created, you’ll receive an agent ID that can be used with the Custom Agent API.

The Search API returns raw web results, while Agents synthesize information and provide natural language answers with citations. Use Search API for building custom UIs, and Agents for conversational experiences.

Yes! Email [email protected] for technical support, feature requests, or partnership inquiries. For bugs or issues with SDKs, you can also open issues on our GitHub repositories.

Yes, the You.com API can be used for commercial projects. Check our terms of service for details, or contact [email protected] for enterprise licensing.

All API keys can be used for testing and development. We recommend using a separate API key for development vs. production to track usage independently.


Additional Resources