Programmable Media

Generate upload signature (video tutorial)

Last updated: Dec-11-2024

Overview

When using the Cloudinary SDKs for any upload or admin method that requires a signature, the signature is automatically generated and added to the request. If, however, you are making direct calls to the REST API, you need to generate a signature yourself. You can do this using a Cloudinary backend SDK signature generation method. Watch this tutorial to learn how.

Video tutorial


This video is brought to you by Cloudinary's video player - embed your own!

View the code
You can find the code from this tutorial in GitHub.

Tutorial contents

This tutorial presents the following topics. Click a timestamp to jump to that part of the video.

Import dependencies for using the Cloudinary Node.js SDK

Jump to this spot in the video  0:09 Get the dependencies to use the Cloudinary Node.js SDK and configure the environment:

Calculate a timestamp

Jump to this spot in the video  0:14 A timestamp is needed to generate the signature, as signatures are valid for one hour. Calculate a timestamp for the current time in seconds:

Call the sign request method

Jump to this spot in the video  0:19 Call the api_sign_request method to generate the signature. The method requires the parameters to sign, and the API secret:

Build a cURL command

Jump to this spot in the video  0:40 Having generated a timestamp and signature for the API call, build a cURL command to call the upload API directly.

Run the code to output the cURL command

Jump to this spot in the video  0:47 Running the code produces a cURL command that can then be used to perform the signed upload by directly calling the upload API.

Enter the cURL command to perform the signed upload

Jump to this spot in the video  1:05 Run the cURL command from the terminal. The returned API response shows a successful signed upload. In reality, the signature generation code would be in a function on your server, into which you would pass the parameters to sign. The function would return the signature and timestamp back to your client where they would be used in a POST request to Cloudinary.

Keep learning

Related topics

If you like this, you might also like...

Upload Programmatically
Use a Cloudinary SDK to upload media assets
Media Library Upload
Drag & drop or select from remote sources to upload
Upload with the CLI
Apply background removal to images on upload

 

Cloudinary Academy

 

Check out the Cloudinary Academy for free self-paced Cloudinary courses on a variety of developer or DAM topics, or register for formal instructor-led courses, either virtual or on-site.

 

✔️ Feedback sent!

Rate this page: