Quick Start

Rapid integration and API access.
We've developed a seamless transition process for the deployment of the product that will allow you to onboard without stress or delay. Our internal team will work with you to establish a specific timeline for complete deployment and will support you throughout the process.

Get your API keys

Your API requests are authenticated using API key. Any request that doesn't include an API key will return an error.
You need to replace API_KEY variable with your real API KEY from https://deep-image.ai/app/my-profile/api
You can get your API key in your profile after creating an account in Deep-image.ai.

Python library

We also provide python library which simplifies usage of the deep-image.ai API. You can get it here: https://github.com/deep-image-ai/python-api

Make your first request

The API comes in two flavours: form-data and json.
The file can be send only when sending form-data, while using json data the url to the files can be send.
When sending the image in form-data request, image has to be base-64 encoded.
Let's see example for denoising, deblurring, enhancing lighting and upscaling to width equals 2000px.
curl json
curl form-data
Python
Python library
curl --request POST \
--url https://deep-image.ai/rest_api/process_result \
--header 'content-type: application/json' \
--header 'x-api-key: API_KEY' \
--data '{
"enhancements": ["denoise", "deblur", "light"],
"url": "https://deep-image.ai/api-example.png",
"width": 2000
}'
curl --location \
--request POST \
--url https://deep-image.ai/rest_api/process_result \
--header 'x-api-key: API_KEY' \
--form 'file=@"LOCAL_FILE_PATH"' \
--form parameters="{\"width\": 1000}"
import time
import json
from pathlib import Path
from urllib.request import urlretrieve
# using requests library
import requests
API_KEY = REPLACE_WITH_YOUR_API_KEY
headers = {
'x-api-key': API_KEY,
}
data = {
"enhancements": ["denoise", "deblur", "light"],
"width": 2000
}
data_dumped = {"parameters": json.dumps(data)}
with open(YOUR_LOCAL_FILE_TO_SEND, 'rb') as f:
response = requests.post('https://deep-image.ai/rest_api/process_result', headers=headers,
files={'image': f},
data=data_dumped)
if response.status_code == 200:
response_json = response.json()
if response_json.get('status') == 'complete':
p = Path(response_json['result_url'])
urlretrieve(response_json['result_url'], p.name)
elif response_json['status'] in ['received', 'in_progress']:
while response_json['status'] == 'in_progress':
response = requests.get(f'https://deep-image.ai/rest_api/result/{response_json["job"]}',
headers=headers)
response_json = response.json()
time.sleep(1)
if response_json['status'] == 'complete':
p = Path(response_json['result_url'])
urlretrieve(response_json['result_url'], p.name)
python transform.py -f examples/test.jpg --upscale 2 --enhance --denoise --token API_KEY
All data examples in this documentation are JSON based. You can replace above JSON data with that ones from the examples.
Last modified 3mo ago