Documentation → general
Usage Examples
1. Simple API Request
fetch('https://corsproxy.io/?url=https://jsonplaceholder.typicode.com/posts/1')
.then(response => response.json())
.then(data => console.log(data));
2. POST Request with JSON
fetch('https://corsproxy.io/?url=https://api.example.com/users', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'John Doe',
email: 'john@example.com'
})
})
.then(response => response.json())
.then(data => console.log(data));
3. API with Authentication Headers
fetch('https://corsproxy.io/?url=https://api.example.com/data', {
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'application/json'
}
})
.then(response => response.json())
.then(data => console.log(data));
4. Convert CSV/XML/RSS to JSON (Business plan)
// CSV -> JSON
fetch('https://corsproxy.io/?url=https://example.com/data.csv&input=csv&output=json')
.then(res => res.json())
.then(data => console.log(data));
// XML -> JSON
fetch('https://corsproxy.io/?url=https://example.com/data.xml&input=xml&output=json')
.then(res => res.json())
.then(data => console.log(data));
// RSS -> JSON
fetch('https://corsproxy.io/?url=https://example.com/feed.xml&input=rss&output=json')
.then(res => res.json())
.then(data => console.log(data));
5. Content Extraction (Business plan)
// Extract main content with a CSS selector
fetch('https://corsproxy.io/?url=https://news.ycombinator.com&extract=1&selector=.titleline%20%3E%20a')
.then(res => res.json())
.then(data => console.log(data));
// Plain-text output
fetch('https://corsproxy.io/?url=https://example.com&extract=1&format=text')
.then(res => res.text())
.then(text => console.log(text));
6. Large File Downloads
fetch('https://corsproxy.io/?url=https://example.com/large-image.jpg')
.then(response => response.blob())
.then(blob => {
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'image.jpg';
a.click();
});
7. GraphQL Queries
const query = `
query {
user(id: "123") {
name
email
}
}
`;
fetch('https://corsproxy.io/?url=https://api.example.com/graphql', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_TOKEN'
},
body: JSON.stringify({ query })
})
.then(response => response.json())
.then(data => console.log(data)); Glossary terms
Caching Proxy
A caching proxy is a proxy server that stores copies of frequently requested web content locally, reducing bandwidth usage, improving response times, and decreasing load on origin servers by serving cached content to subsequent requests.
Metered Proxy
A metered proxy charges based on actual bandwidth usage, data transfer volume, or request counts, offering pay-as-you-go pricing that scales with usage rather than flat monthly fees.
Unmetered Proxy
An unmetered proxy (or unlimited proxy) provides unlimited bandwidth usage for a fixed monthly fee, making it cost-effective for high-volume operations like large-scale web scraping, continuous monitoring, and data-intensive applications.