/api/v1/files/:jobIdDownload Results
Retrieve a previously scraped result by its job_id. Use this endpoint to download screenshots, PDFs, or large HTML files returned from the main scrape endpoint.
How Results Are Stored
Local disk (up to 2h)
Results are saved on the server immediately after scraping and served instantly from local disk.
Remote backup
Files are backed up to remote storage so you can still fetch them after local TTL expires.
Expired (410)
Once both local and remote copies are deleted, the endpoint returns 410 Gone.
The result_url field returned by the scrape endpoint already contains the full download URL. You only need to call this endpoint manually when downloading screenshots or PDFs, or when the file is no longer in the inline response body.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
jobIdrequired | string | The job_id returned by the scrape endpoint. |
Code Examples
import requests
JOB_ID = "job_abc123def456" # from the scrape response
API_KEY = "YOUR_API_KEY"
response = requests.get(
f"https://scrape.sparkproxy.io/api/v1/files/{JOB_ID}",
headers={"X-API-Key": API_KEY},
)
# Save to file (works for HTML, PNG, PDF, etc.)
ext = response.headers.get("Content-Type", "").split("/")[-1] or "bin"
with open(f"{JOB_ID}.{ext}", "wb") as f:
f.write(response.content)
print(f"Saved {JOB_ID}.{ext}")End-to-End: Scrape then Download
Take a screenshot, get the result_url from the JSON response, then download the PNG.
import requests
API_KEY = "YOUR_API_KEY"
BASE = "https://scrape.sparkproxy.io"
# Step 1: Scrape with json_response to get the job_id
scrape = requests.get(
f"{BASE}/api/v1",
headers={"X-API-Key": API_KEY},
params={
"url": "https://example.com",
"render_js": "true",
"format": "screenshot",
"json_response": "true",
}
).json()
job_id = scrape["job_id"]
result_url = scrape["result_url"]
print(f"Job: {job_id} expires: {scrape['expires_at']}")
# Step 2: Download the screenshot
img = requests.get(result_url, headers={"X-API-Key": API_KEY})
with open("screenshot.png", "wb") as f:
f.write(img.content)
print("Saved screenshot.png")Response Headers
| Header | Values | Description |
|---|---|---|
Content-Type | text/html, text/markdown, image/png, application/pdf, application/json | Matches the format of the original scrape request. |
X-Source | local, hetzner | Where the file was served from: local disk or remote backup. |
Content-Disposition | inline; filename="job_abc123.png" | Filename hint for browser download. |
Status Codes
| Status | Meaning |
|---|---|
| 200 | File found and returned. |
| 401 | Missing or invalid API key. |
| 404 | File not found or does not belong to this API key. |
| 410 | File has expired from both local and remote storage. |
| 503 | Remote backup fetch failed. |
