> ## Documentation Index
> Fetch the complete documentation index at: https://cloudinary.com/documentation/llms.txt
> Use this file to discover all available pages before exploring further.

# Programmatically create upload presets (video tutorial)


## Overview

In this tutorial, we'll show you how to programmatically create and use Cloudinary's signed upload presets.

## Video tutorial

  This video is brought to you by Cloudinary's video player - embed your own!Use the controls to set the playback speed, navigate to chapters of interest and select subtitles in your preferred language.

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

### What is an upload preset? 
{table:class=tutorial-bullets}|  |  
| --- | --- |
|{videotime:id=media :min=0 :sec=20 :player=cld} |Upload presets let you add many parameters to your upload calls and use them all at once.

### Some use cases 
{table:class=tutorial-bullets}|  |  
| --- | --- |
|{videotime:id=media :min=0 :sec=31 :player=cld} |With Cloudinary's APIs, you can create dozens of upload presets for different use cases, like: removing the background from an image, flagging a file for content moderation, or simply making sure your asset makes its way into the right folder. Check out more use cases in our [Upload presets](upload_presets) and [Upload API](image_upload_api_reference#upload) documentation.|

### Signed vs. unsigned presets
{table:class=tutorial-bullets}|  |  
| --- | --- |
|{videotime:id=media :min=0 :sec=46 :player=cld} |At Cloudinary, presets can be signed or unsigned. Unsigned presets are used with unsigned upload calls. For example, when uploading directly from the browser on the frontend. In this tutorial we focus entirely on signed presets on the backend. You can find more information on the difference between signed and unsigned presets in our [Upload presets](upload_presets) documentation.|

### Setting up development environment 
{table:class=tutorial-bullets}|  |  
| --- | --- |
|{videotime:id=media :min=1 :sec=06 :player=cld} | If this is your first time setting up your development environment with Cloudinary, we recommend watching our [Upload Programmatically](upload_images#programmatic_upload_with_the_node_js_sdk_video_tutorial) tutorial. It will also walk you through how to make your first upload.|

### Clone the repository we use in this tutorial to follow along
{table:class=tutorial-bullets}|  |  
| --- | --- |
|{videotime:id=media :min=1 :sec=43 :player=cld} | It may be helpful to clone the [repo](https://github.com/cloudinary-training/cld-upload-presets) we've created for this demo.|

```CURL
git clone https://github.com/cloudinary-training/cld-upload-presets
```

### Ensure script libraries are installed 
{table:class=tutorial-bullets}|  |  
| --- | --- |
|{videotime:id=media :min=1 :sec=48 :player=cld} |Make sure all of our script's libraries [are properly installed](https://docs.npmjs.com/cli/v7/commands/npm-install) with a simple `npm i` command. If you open your package.json file, you can see all of the packages have been listed as dependencies.
|

### Create a basic upload preset script
{table:class=tutorial-bullets}|  |  
| --- | --- |
|{videotime:id=media :min=1 :sec=59 :player=cld} |Our first example script uses Cloudinary's Admin API to create a basic upload preset. We'll use that to upload an image to our product environment, with instructions on how to store it and actions to carry out as part of the upload process. |

```nodejs
require('dotenv').config();
const cloudinary = require('cloudinary').v2;

cloudinary.api.create_upload_preset({
  name: 'demo_preset',
  tags: 'baby, winter, snow',
  folder: 'babies',
  allowed_formats: 'jpg, png'
})
.then(uploadResult => console.log(uploadResult))
.catch(error => console.error(error));
```

### Run script to create upload preset 
{table:class=tutorial-bullets}|  |  
| --- | --- |
|{videotime:id=media :min=2 :sec=36 :player=cld} |Run `node create-upload-preset.js` to officially create our first upload preset!|

### Upload file with our preset
{table:class=tutorial-bullets}|  |  
| --- | --- |
|{videotime:id=media :min=2 :sec=43 :player=cld} |Upload the asset to Cloudinary with our newly created upload preset called **winter-baby**.|

### Create new preset with a simple transformation
{table:class=tutorial-bullets}|  |  
| --- | --- |
|{videotime:id=media :min=3 :sec=20 :player=cld} |We apply the same techniques shown in the earlier example, but with transformations. This will transform the original file and only keep the transformed asset in our Cloudinary product environment.|

```nodejs
require("dotenv").config();
const cloudinary = require("cloudinary").v2;

cloudinary.api.create_upload_preset({
    name: "profile-preset",
    tags: "employees, faces, profile",
    folder: "profiles",
    allowed_formats: "jpg, png",

    transformation: [
      {
        width: 200,
        height: 200,
        crop: "thumb",
        gravity: "face",
      },
    ],
  })
  .then((uploadResult) => console.log(uploadResult))
  .catch((error) => console.error(error));
  ```

### Run script to create another upload preset
{table:class=tutorial-bullets}|  |  
| --- | --- |
|{videotime:id=media :min=4 :sec=04 :player=cld} |Run `create-derived-image-preset.js` to create another upload preset!|

### Upload file with our preset
{table:class=tutorial-bullets}|  |  
| --- | --- |
|{videotime:id=media :min=4 :sec=18 :player=cld} |Upload the asset to Cloudinary with our newly created upload preset called **profile-preset**.|

## Keep learning

> **READING**:
>
> * Learn more about [upload presets](upload_presets) in the [Media Upload](upload_images) guide.

> * Take a look at the [User-generated content guide](user_generated_content) to see all the features you can take advantage of when uploading images and videos to display on your site.

> * Dive deep into more options with upload presets in our [Fundamentals for Developers](https://training.cloudinary.com/learn/course/cloudinary-fundamentals-for-developers/lesson-6-creating-and-using-upload-presets-1929/lesson-overview-0305?page=1) course, such as eager and incoming transformations.

#### 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 
  

&nbsp;

&nbsp;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.
&nbsp;
