Joffstrends Search API: The Ultimate Developer Cheatsheet
Integrating web search into your applications, AI agents, or scraping pipelines shouldn't be complicated or expensive. The Joffstrends Search API offers a fast, reliable, and developer-friendly endpoint to fetch search results programmatically.
This cheatsheet serves as your quick-reference guide for authentication, endpoints, request/response formats, and multi-language integration examples.
1. Quick Start & Base URL
All requests to the Joffstrends Search API are made to the following base URL:
https://api.joffstrends.co.uk
Authentication
To use the API, you need a unique API key. You can pass this key in your request headers or as a query parameter.
- Header Authentication (Recommended):
Authorization: Bearer YOUR_API_KEY
- Query Parameter Authentication:
GET https://api.joffstrends.co.uk/search?q=query&key=YOUR_API_KEY
2. Getting an API Key
You can get an API key instantly via Gumroad. Your unique key will be emailed to you within ~1 minute of purchase:
- Starter Plan: £4.99 one-time (7 days access) — Get Starter Plan
- Monthly Plan: £9.99/month (1,000 searches/month, cancel anytime) — Get Monthly Plan
- Annual Plan: £89.99/year (1,000 searches/month, save ~3 months) — Get Annual Plan
3. API Endpoints
GET /search
Retrieves search results for a given query.
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
q |
string | Yes | The search query (must be URL-encoded). |
key |
string | No | Your API key (if not using the Authorization header). |
4. Code Integration Examples
Here is how to integrate the Joffstrends Search API in your favorite languages and tools.
cURL
curl -X GET "https://api.joffstrends.co.uk/search?q=developer+cheatsheet" \
-H "Authorization: Bearer YOUR_API_KEY"
Node.js (Fetch API)
const apiKey = 'YOUR_API_KEY';
const query = encodeURIComponent('developer cheatsheet');
const url = `https://api.joffstrends.co.uk/search?q=${query}`;
async function fetchSearchResults() {
try {
const response = await fetch(url, {
method: 'GET',
headers: {
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json'
}
});
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}
const data = await response.json();
console.log('Search Results:', data);
} catch (error) {
console.error('Error fetching search results:', error);
}
}
fetchSearchResults();
Python (Requests)
import requests
import urllib.parse
api_key = "YOUR_API_KEY"
query = urllib.parse.quote("developer cheatsheet")
url = f"https://api.joffstrends.co.uk/search?q={query}"
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
}
try:
response = requests.get(url, headers=headers)
response.raise_for_status()
results = response.json()
print("Search Results:", results)
except requests.exceptions.RequestException as e:
print("An error occurred:", e)
PHP (cURL)
<?php
$apiKey = 'YOUR_API_KEY';
$query = urlencode('developer cheatsheet');
$url = "https://api.joffstrends.co.uk/search?q={$query}";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer {$apiKey}",
"Content-Type: application/json"
]);
$response = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
} else {
$data = json_decode($response, true);
print_r($data);
}
curl_close($ch);
?>
5. Expected Response Format
The API returns a clean, structured JSON payload containing your search results:
{
"query": "developer cheatsheet",
"results": [
{
"title": "Developer Cheatsheets - Devhints.io",
"link": "https://devhints.io/",
"snippet": "A ridiculous collection of web development cheatsheets. One-page guide to everything you need to know."
},
{
"title": "OverAPI.com - Collecting all cheatsheets",
"link": "https://overapi.com/",
"snippet": "OverAPI is a site collecting all the cheatsheets, most popular cheatsheets for developers."
}
]
}
6. Best Practices & Error Handling
-
URL Encoding: Always URL-encode your query parameter (
q) to prevent issues with special characters (e.g., spaces,&,?). -
Error Codes:
-
401 Unauthorized: Missing or invalid API key. Check your header or query parameter. -
400 Bad Request: Missing query parameterq. -
429 Too Many Requests: You have exceeded your plan's monthly limit.
-
- Caching: To optimize performance and reduce API usage, cache search results locally for queries that do not require real-time updates.
Need a reliable search API for your next build? Get started with the Joffstrends Search API today!
Top comments (0)