Migrate from the Brave Search API to Scavio by replacing the endpoint URL, switching from query-parameter auth to an x-api-key header, and updating your response parser to match Scavio's JSON structure. The migration typically takes under 30 minutes for most codebases. Scavio covers Google, Amazon, YouTube, Reddit, and Walmart through a single API key, which eliminates the need for separate provider accounts. This tutorial walks through the exact code changes needed in both Python and JavaScript.
Prerequisites
- An existing codebase using Brave Search API
- A Scavio API key from scavio.dev
- Python 3.8+ or Node.js 18+
- Basic familiarity with HTTP request libraries
Walkthrough
Step 1: Map the request format
Brave uses GET with query params and a subscription-token header. Scavio uses POST with a JSON body and x-api-key header. Replace the request call.
import requests, os
# BEFORE: Brave Search
# resp = requests.get('https://api.search.brave.com/res/v1/web/search',
# headers={'X-Subscription-Token': BRAVE_KEY},
# params={'q': 'best crm 2026'})
# AFTER: Scavio
resp = requests.post('https://api.scavio.dev/api/v1/search',
headers={'x-api-key': os.environ['SCAVIO_API_KEY']},
json={'platform': 'google', 'query': 'best crm 2026'})
data = resp.json()Step 2: Update response parsing
Brave returns results under web.results. Scavio returns them under organic_results. Update your parser accordingly.
# BEFORE: Brave response parsing
# results = data.get('web', {}).get('results', [])
# for r in results:
# title = r['title']
# url = r['url']
# snippet = r.get('description', '')
# AFTER: Scavio response parsing
results = data.get('organic_results', [])
for r in results:
title = r['title']
url = r['link']
snippet = r.get('snippet', '')
print(f'{title} - {url}')Step 3: Build a compatibility wrapper
If you have many call sites, create a wrapper function that presents the old interface while calling Scavio under the hood.
def brave_compatible_search(query: str, count: int = 10) -> dict:
"""Drop-in replacement for Brave Search API calls."""
resp = requests.post('https://api.scavio.dev/api/v1/search',
headers={'x-api-key': os.environ['SCAVIO_API_KEY']},
json={'platform': 'google', 'query': query})
resp.raise_for_status()
scavio_results = resp.json().get('organic_results', [])[:count]
return {
'web': {
'results': [{
'title': r.get('title', ''),
'url': r.get('link', ''),
'description': r.get('snippet', ''),
} for r in scavio_results]
}
}Step 4: Update environment variables and test
Replace the BRAVE_API_KEY env var with SCAVIO_API_KEY and run your test suite to verify results parse correctly.
# In your .env or environment:
# Remove: BRAVE_API_KEY=brv_xxx
# Add: SCAVIO_API_KEY=your_scavio_key
# Quick smoke test:
def test_migration():
result = brave_compatible_search('python web frameworks')
items = result['web']['results']
assert len(items) > 0, 'No results returned'
assert items[0]['title'], 'Missing title'
assert items[0]['url'].startswith('http'), 'Invalid URL'
print(f'Migration OK: {len(items)} results')
test_migration()Python Example
import requests, os
def scavio_search(query, platform='google'):
resp = requests.post('https://api.scavio.dev/api/v1/search',
headers={'x-api-key': os.environ['SCAVIO_API_KEY']},
json={'platform': platform, 'query': query})
resp.raise_for_status()
return resp.json().get('organic_results', [])
# Replaces: requests.get('https://api.search.brave.com/...')
results = scavio_search('best crm 2026')
for r in results[:5]:
print(f"{r['title']} -> {r['link']}")JavaScript Example
async function scavioSearch(query, platform = 'google') {
const resp = await fetch('https://api.scavio.dev/api/v1/search', {
method: 'POST',
headers: {'x-api-key': process.env.SCAVIO_API_KEY, 'Content-Type': 'application/json'},
body: JSON.stringify({platform, query})
});
const data = await resp.json();
return data.organic_results || [];
}
// Replaces: fetch('https://api.search.brave.com/...')
const results = await scavioSearch('best crm 2026');
results.slice(0, 5).forEach(r => console.log(`${r.title} -> ${r.link}`));Expected Output
A fully migrated codebase where all Brave Search API calls now route through Scavio, with identical output format via a compatibility wrapper.