API documentation

Ugh, I didn't want to go into all this detail, but it's not like anyone is going to look at the publicly-available, amply-documented, simple code to figure out how the API works, so here we are.

The API is pretty RESTful and non-surprising, you authenticate with your API key and it's all good.

Authentication

Authentication is easy enough that even you can do it. Just use your API key as your password in HTTP Basic auth.

Uploading an image

To upload an image, simply POST to https://imgz.org/api/image/ as a multipart/form-data content type, with your image in the image field and the title in the title field.
You can also set the expires_in field to the number of minutes you want the image to expire in.

Example:

curl https://:[email protected]/api/image/ \
   -F "image=@/some/image/path.png" \
   -F "title=I am alone."

Retrieving an image

This doesn't even need auth. Just make a GET request to https://imgz.org/api/image/image_id/

Example:

curl https://imgz.org/api/image/iJKuc6HA/

Editing an image

To edit an image, PUT to https://imgz.org/api/image/image_id/. You can currently only change the title by passing the title field. The request should be JSON-encoded with the appropriate content type.

Example:

curl https://:[email protected]/api/image/iJKuc6HA/ \
   -H 'Content-Type: application/json' -X PUT -d '{"title": "This is me."}'

Deleting an image

Unsurprisingly, DELETE to https://imgz.org/api/image/image_id/.

Example:

curl -X DELETE https://:[email protected]/api/image/iJKuc6HA/