Bearer Token Authentication
The most secure way to authenticate API requests is using a Bearer token in the Authorization header.
Usage
Include your API key in the Authorization header:
curl -X POST https://api.renderscreenshot.com/v1/screenshot \ -H "Authorization: Bearer rs_live_xxxxx" \ -H "Content-Type: application/json" \ -d '{"url": "https://example.com"}'
Benefits
- Secure: Key is not visible in URLs or logs
- Standard: Uses the OAuth 2.0 Bearer token format
- Flexible: Works with all HTTP methods
Code Examples
JavaScript (fetch)
const response = await fetch('https://api.renderscreenshot.com/v1/screenshot', { method: 'POST', headers: { 'Authorization': 'Bearer rs_live_xxxxx', 'Content-Type': 'application/json' }, body: JSON.stringify({ url: 'https://example.com', preset: 'og_card' }) });
Ruby
require 'net/http' require 'json' uri = URI('https://api.renderscreenshot.com/v1/screenshot') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri) request['Authorization'] = 'Bearer rs_live_xxxxx' request['Content-Type'] = 'application/json' request.body = { url: 'https://example.com' }.to_json response = http.request(request)
Python
import requests response = requests.post( 'https://api.renderscreenshot.com/v1/screenshot', headers={ 'Authorization': 'Bearer rs_live_xxxxx', 'Content-Type': 'application/json' }, json={'url': 'https://example.com'} )
When to Use
Use Bearer token authentication when:
- Making server-side API calls
- Building backend integrations
- Maximum security is required