PhotoShelter Developer

Upload an Image

In this guide, we walk through how to upload an image to a PhotoShelter account.

What you need

What to do

Authenticate the user

You need to be authenticated via the endpoint /psapi/v3/mem/authenticate before you can upload an image through the PhotoShelter API.

curl -c cookie.txt \
-H "X-PS-Api-Key: MY_API_KEY" \
-F email=me@example.com \
-F password=supersecretpassword \
-F mode=cookie \
https://www.photoshelter.com/psapi/v3/mem/authenticate

For more information on user authentication, you can follow the User Authentication guide or read the documentation on connecting to the PhotoShelter API.

Post the image

Let’s say that you want to upload an image with the path "/my/file/path/my_image.jpg". To upload the image, make a request to the endpoint /psapi/v3/mem/image/upload, with the data encoded using HTTP multipart/form-data encoding type. In curl, be sure to prefix the file path with @, which makes curl load the file data.

curl -b cookie.txt \
-H "X-PS-Api-Key: MY_API_KEY" \
-F gallery_id=MY_GALLERY_ID \
-F 'file=@/my/file/path/my_image.jpg' \
https://www.photoshelter.com/psapi/v3/mem/image/upload

If successful, the API returns data about the image, including the new image id.

What you should know

You can upload more than one file at a time by setting the file parameter to a form array.

Further Reading