Developer API

The API is currently in alpha, please get in touch with us at contact@neuralstyle.art in case things go wrong.
You can enqueue jobs by either 1) uploading a photo, 2) passing a photo URL, or 3) passing a photo ID PID of a previously uploaded photo. See 1) and 2) below, and 3) further down.
1) photo upload:
	curl -H 'Content-Type: multipart/form-data' -H 'Accept: application/json' \
	-F "photo=@PHOTO" \
	-F "api_key=API_KEY" \
	-F "style_id=STYLE_ID" \
	https://neuralstyle.art/api.json
      
2) photo URL:
	curl -H 'Content-Type: multipart/form-data' -H 'Accept: application/json' \
	-F "photo_url=PHOTO_URL" \
	-F "api_key=API_KEY" \
	-F "style_id=STYLE_ID" \
	https://neuralstyle.art/api.json
      
API_KEY is the key to your account. Here, PHOTO (leave the @ in the call!) is the filename of the photo you want to filter, for example "input.jpg". STYLE_ID is the id of the style you want to use. It must be already uploaded to our site. Look in your style URL to get the ID. Credits will be deducted as per our pricing once the job is successfully enqueued. No free creations are allowed at this time through the API.
NEW You can pass the following render options: intensity=1|2|3, brush_size=1|2|3, colors=Style|Mix|Input, style_overlay=0|1|2|3, quality=1|2|3, and face_enhancement=Yes|No. For example:
	curl -H 'Content-Type: multipart/form-data' -H 'Accept: application/json' \
	-F "photo=@PHOTO" \
	-F "api_key=API_KEY" \
	-F "style_id=STYLE_ID" \
	-F "intensity=3" \
	-F "brush_size=3" \
	-F "colors=Style" \
	-F "style_overlay=3" \
	-F "quality=2" \	
	-F "face_enhancement=Yes" \
	https://neuralstyle.art/api.json
      
You will get this answer, in case all parameters are correct:
      { "result":"OK", "photo_id":"PID", "filterjob_id":"FID" }
    
Here, PID is the ID of the photo you uploaded, and FID is the filter job ID the site created for your job. You can query the status of your job using FID:
	    curl  https://neuralstyle.art/api/FID.json?api_key=API_KEY
	  
Which returns:
	    { "result":"OK", "status":"processing", "progress":"20"  }
	  
Here you can see that the job is being processed, with progress 20%. After some seconds we can query again:
      { "result":"OK", "status":"done", "progress":"100", "url":"RESULT_URL" }
    
The result URL points to your filtered image. Success!
The initial call filters in SD. To increase resolution, use an enhance call:
	curl -H 'Content-Type: multipart/form-data' -H 'Accept: application/json' \
	-F "filterjob_id=FILTERJOB_ID" \
	-F "api_key=API_KEY" \
	https://neuralstyle.art/api/enhance.json
      
Which returns:
	    { "result":"OK", "status":"processing", "progress":"0"  }
	  
The process will eventually reach 100 and be finished, and you will get a new result which will be in size MD. At that point you can call enhance again, and the process will be in HD; and then you can do it one more time for UHD (15MP).
If you want to re edit a photo you already edited, you can use parameter photo_id=PID instead of uploading a new photo using photo=@PHOTO. Use the PID returned in the call where you uploaded the photo originally:
	curl -H 'Content-Type: multipart/form-data' -H 'Accept: application/json' \
	-F "photo_id=PID" \
	-F "api_key=API_KEY" \
	-F "style_id=STYLE_ID" \
	https://neuralstyle.art/api.json
      
The API is currently in alpha, please get in touch with us at contact@neuralstyle.art in case things go wrong.