Perplexity has officially launched its Search API, empowering developers to integrate advanced AI-powered search capabilities directly into their applications. This API combines real-time web search with Perplexity's renowned answer engine, delivering accurate, contextual results with source citations.
⚡ Key Features of Perplexity Search API
Core Capabilities
- ✓ Real-time Web Search: Up-to-date information from across the web
- ✓ AI-Powered Answers: Natural language responses with context
- ✓ Source Citations: Every answer includes verifiable sources
- ✓ Multi-Modal Support: Text, code, and structured data responses
Technical Specifications
- 🚀 Latency: <500ms average response time
- 🔧 Rate Limits: 1000 requests/minute (Pro tier)
- 🌍 Languages: 20+ languages supported
- 💰 Pricing: $5 per 1000 requests
API Endpoints
Base URL
https://api.perplexity.ai/v1
Available Endpoints
POST /search
Perform a search query with AI-powered results
POST /chat/completions
Interactive chat with search capabilities
GET /models
List available search models
Quick Start Code Examples
Python Example
import requests
import json
# Your API key from Perplexity dashboard
API_KEY = "pplx-YOUR_API_KEY_HERE"
# API endpoint
url = "https://api.perplexity.ai/v1/search"
# Headers with authentication
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
# Search query
data = {
"model": "pplx-7b-online",
"messages": [
{
"role": "user",
"content": "What are the latest developments in quantum computing?"
}
],
"max_tokens": 1000,
"temperature": 0.7,
"return_citations": True,
"search_domain_filter": ["arxiv.org", "nature.com", "science.org"]
}
# Make the request
response = requests.post(url, headers=headers, json=data)
# Parse and print the response
if response.status_code == 200:
result = response.json()
print("Answer:", result["choices"][0]["message"]["content"])
print("\nCitations:")
for citation in result["citations"]:
print(f"- {citation['title']}: {citation['url']}")
else:
print(f"Error: {response.status_code}")
print(response.text)
JavaScript/Node.js Example
const axios = require('axios');
// Your API key
const API_KEY = 'pplx-YOUR_API_KEY_HERE';
async function searchPerplexity(query) {
const url = 'https://api.perplexity.ai/v1/search';
const config = {
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
}
};
const data = {
model: 'pplx-7b-online',
messages: [
{
role: 'user',
content: query
}
],
max_tokens: 1000,
temperature: 0.7,
return_citations: true,
search_recency_filter: '24h' // Results from last 24 hours
};
try {
const response = await axios.post(url, data, config);
console.log('Answer:', response.data.choices[0].message.content);
console.log('\nCitations:');
response.data.citations.forEach(citation => {
console.log(`- ${citation.title}: ${citation.url}`);
});
return response.data;
} catch (error) {
console.error('Error:', error.response?.data || error.message);
throw error;
}
}
// Example usage
searchPerplexity('Latest AI breakthroughs in 2025')
.then(result => console.log('Search completed'))
.catch(err => console.error('Search failed:', err));
cURL Example
curl -X POST https://api.perplexity.ai/v1/search \
-H "Authorization: Bearer pplx-YOUR_API_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{
"model": "pplx-7b-online",
"messages": [
{
"role": "user",
"content": "Explain the latest CRISPR gene editing techniques"
}
],
"max_tokens": 1000,
"temperature": 0.7,
"return_citations": true,
"search_domain_filter": ["pubmed.gov", "nature.com"]
}'
Advanced Features
Domain Filtering
Restrict search results to specific domains for more targeted results:
"search_domain_filter": ["github.com", "stackoverflow.com"]
Recency Filtering
Get only recent results with time-based filtering:
"search_recency_filter": "24h" // Options: 24h, week, month, year
Streaming Responses
Enable streaming for real-time response generation:
"stream": true // Returns Server-Sent Events
Context Window
Maintain conversation context across multiple queries:
"context_window": 4000 // Number of tokens to maintain
Real-World Use Cases
🔬 Research Applications
- • Academic paper discovery and summarization
- • Patent search and analysis
- • Literature reviews with citations
- • Trend analysis in scientific fields
💼 Business Intelligence
- • Competitor analysis and monitoring
- • Market research and insights
- • Customer sentiment analysis
- • Industry news aggregation
🤖 AI Applications
- • Chatbots with real-time information
- • Virtual assistants with web access
- • Automated content generation
- • Fact-checking systems
📱 Developer Tools
- • Code search and documentation
- • Error resolution with Stack Overflow
- • API documentation discovery
- • Package vulnerability checking
Pricing Plans
Free Tier
$0/month
- ✓ 100 requests/month
- ✓ Basic search model
- ✓ 5 requests/minute
- ✓ Community support
Pro
$200/month
- ✓ 40,000 requests/month
- ✓ All search models
- ✓ 1000 requests/minute
- ✓ Priority support
- ✓ Advanced filtering
Enterprise
Custom
- ✓ Unlimited requests
- ✓ Custom models
- ✓ No rate limits
- ✓ Dedicated support
- ✓ SLA guarantee
- ✓ On-premise option
Getting Started in 5 Minutes
-
1
Sign up at Perplexity
Visit perplexity.ai/api and create your account
-
2
Get your API key
Navigate to Settings → API Keys and generate a new key
-
3
Install SDK (optional)
pip install perplexity-pythonornpm install perplexity-js -
4
Make your first request
Copy one of the code examples above and replace the API key
-
5
Build something amazing!
Start integrating AI-powered search into your applications
Ready to Build with AI Search?
Join thousands of developers using Perplexity's Search API to power intelligent applications.