API
Four endpoints: request an upload URL, create an enlargement task, poll the result, retry a failed task. Parameter rules, task states and error responses included.
POST
Image upload API
/api/img_upload
cURL
curl -X POST https://bigjpg.com/api/img_upload \
-H 'X-API-KEY: YOUR_API_KEY' \
-d 'filename=small.jpg' \
-d 'filetype=image/jpeg'
# Use url from the response to upload the file to R2.
curl -X PUT --upload-file small.jpg \
-H 'Content-Type: image/jpeg' \
'UPLOAD_URL'
Python
import requests
filename = 'small.jpg'
filetype = 'image/jpeg'
r = requests.post(
url='https://bigjpg.com/api/img_upload',
headers={'X-API-KEY': 'YOUR_API_KEY'},
data={'filename': filename, 'filetype': filetype}
)
upload = r.json()
with open(filename, 'rb') as image:
requests.put(
url=upload['url'],
data=image,
headers={'Content-Type': filetype}
)
print(upload['fileurl']) # use as input in the enlarge API
- Paid members can use the API
- Call this endpoint with your API key to get a temporary R2 upload URL and the public image URL
- Upload the file with PUT using the same Content-Type, then use fileurl as input in the enlarge API
- Base URL:
https://bigjpg.com
POST
Enlarge API
/api/task/
cURL
curl -d '{"style": "art", "noise": "3", "x2": "1", "input": "YOUR_IMAGE_URL"}' \
-H 'X-API-KEY: YOUR_API_KEY' \
https://bigjpg.com/api/task/
Python
import json
import requests
data = {
'style': 'art',
'noise': '3',
'x2': '1',
'file_name': 'small.jpg',
'input': 'YOUR_IMAGE_URL'
}
r = requests.post(
url='https://bigjpg.com/api/task/',
headers={'X-API-KEY': 'YOUR_API_KEY'},
data=json.dumps(data)
)
print(r.json())
- JSON format
- style can be 'art', 'photo' which means 'cartoon illustration', 'photo'
- noise can be '-1', '0', '1', '2', '3' which means 'None', 'Low, 'Medium', 'High', 'Highest'
- x2 can be '1', '2', '3', '4' which means 2x, 4x, 8x, 16x
- input your enlarge image url
- A successful call returns tid (the task id), minute (estimated time) and remaining_api_calls.
GET
Result Query API
/api/task/{task_ids}
cURL
curl https://bigjpg.com/api/task/tid1,tid2,tid3,tid100
Python
import requests
r = requests.get(
url='https://bigjpg.com/api/task/tid1,tid2,tid3,tid100'
)
print(r.json())
- Pass one or more task ids separated by commas — up to 100 in one request.
- Each task returns {"status": ..., "url": ..., "size": ...}; status is new, process, success or error.
- url and size stay empty until the task is done.
POST
Task retry API
/api/task/{task_ids}
cURL
curl -X POST https://bigjpg.com/api/task/tid1,tid2,tid3,tid100
Python
import requests
r = requests.post(
url='https://bigjpg.com/api/task/tid1,tid2,tid3,tid100'
)
print(r.json())
Error responses
status
- valid_api_key_required — the X-API-KEY header is missing or not recognised. Check the header name, and that the key belongs to a paid account that has not expired.
- requires_vip — the account is on the free plan or has expired. API calls need an active paid plan.
- month_limit — the monthly API quota is used up. Every successful call reports remaining_api_calls, so you can watch it before you run out.
- param_error — the parameters are out of range: style must be art or photo, noise -1 to 3, x2 1 to 4 (1 to 2 on free accounts).
- input_url_error — input has to be a publicly reachable http:// or https:// image URL.
X-API-KEY: Paid members can use the API
Contact us by i@bigjpg.com for more API calls