# Overview

> **Part of**: [Upload API reference](image_upload_api_reference.md)


By default, the API endpoints use the following format:

`https://api.cloudinary.com/v1_1/:cloud_name/:action`

For example, to upload an image asset to the `demo` product environment:

```
POST https://api.cloudinary.com/v1_1/demo/image/upload
```

### Authentication methods

The Upload API supports the following authentication methods for server-side (backend) uploads:

* **[Basic Authentication](#basic_authentication)** (recommended): Authenticate using your API Key and API Secret via HTTP Basic Auth.
* **[Signature-based authentication](#signature_based_authentication)**: Authenticate by generating a SHA signature with a timestamp.

For client-side uploads, you can also use **[unsigned uploads](upload_presets)** with upload presets.

> **INFO**: Never expose your API secret in public client-side code.

#### Basic Authentication

Similar to the [Admin API](admin_api), you can authenticate Upload API requests using HTTP Basic Authentication with your **API Key** and **API Secret**. This is the simplest authentication method and doesn't require generating signatures or timestamps.

Your Cloudinary **Cloud name**, **API Key**, and **API Secret** can be found on the [API Keys](https://console.cloudinary.com/app/settings/api-keys) page of the Cloudinary Console Settings.

**To upload with Basic Authentication:**

You can pass your credentials either in the URL or in an Authorization header.

**Option 1: Embedded in the URL**

```
curl https://<API_KEY>:<API_SECRET>@api.cloudinary.com/v1_1/<CLOUD_NAME>/image/upload \
  -X POST \
  -F "file=<FILE>" \
  -F "public_id=<PUBLIC_ID>"
```

**Option 2: In the Authorization header**

```
curl https://api.cloudinary.com/v1_1/<CLOUD_NAME>/image/upload \
  -X POST \
  -u "<API_KEY>:<API_SECRET>" \
  -F "file=<FILE>" \
  -F "public_id=<PUBLIC_ID>"
```

For example, to upload an image to the `demo` product environment:

```
curl https://112233445566778:AbCdEfGhIjKlMnOpQrStUvWxYz12@api.cloudinary.com/v1_1/demo/image/upload \
  -X POST \
  -F "file=sample.jpg" \
  -F "public_id=my_sample"
```

Basic Authentication can be used with any upload parameters, including [upload presets](upload_presets), transformations, tags, metadata, and more.

#### Signature-based authentication

All the methods in this API can also be authenticated using a signature generated from your **API Secret**. The Cloudinary SDKs automatically generate this signature for you. When using the REST API calls directly, you need to generate the signature, either [manually](authentication_signatures#manual_signature_generation), or via the [`api_sign_request` SDK method](authentication_signatures#using_cloudinary_backend_sdks_to_generate_sha_authentication_signatures). For more details, see the [Generating authentication signatures](authentication_signatures) documentation.

You can upload an image on your own Cloudinary product environment by replacing the `CLOUD_NAME`, `FILE`, `TIMESTAMP`, `API_KEY`, and `SIGNATURE` in the cURL command below:

```
curl https://api.cloudinary.com/v1_1/<CLOUD_NAME>/image/upload -X POST --data 'file=<FILE>&timestamp=<TIMESTAMP>&api_key=<API_KEY>&signature=<SIGNATURE>'
```

### API responses

Responses to API calls include information about the action that was performed as well as data about the relevant assets. 

> **TIP**: For more in-depth documentation and general information on uploading media assets see the [Upload](upload_images) guide. For more information on calling the REST API methods directly, see the documentation on [Uploading with a direct call to the API](client_side_uploading#direct_call_to_the_api).

After you upload files, you can use the [Cloudinary Admin API](admin_api), which has useful methods for managing and organizing your media assets, such as listing all uploaded assets, listing tags, finding all assets that share a given tag, updating transformations, bulk deleting, and more.
> **INFO**: Cloudinary may add more fields to API responses and notifications in the future, so please ensure that your response parsing remains forward compatible and won't break as a result of unknown fields.

### Using Postman for Upload REST API calls
Take advantage of our [Cloudinary Postman Collections](https://www.postman.com/cloudinaryteam/workspace/programmable-media/overview?ctx=documentation) to experiment with our REST APIs and view the responses before adding them to your own code. 

[Run in Postman](https://www.postman.com/cloudinaryteam/workspace/programmable-media/overview?ctx=documentation)

For details on setting up your own fork of our collections and configuring your Postman environment with your Cloudinary product environment credentials, see [Using Cloudinary Postman collections](using_cloudinary_postman_collections).

### Using SDKs with the Upload API

Our [backend SDK libraries](cloudinary_sdks#backend) provide a wrapper for the Upload API, enabling you to use your native programming language of choice. When using an SDK, request building and authentication are handled automatically, and the JSON response is parsed and returned. 

For example, you can use the following SDK command to create an image asset saved to your Cloudinary product environment from a string passed as a parameter:

```multi
|ruby 
result = Cloudinary::Uploader
.text(text)
  
|php_2
$result = $cloudinary->uploadApi()
->text($text);

|python
result = cloudinary.uploader\
.text(text)

|nodejs
cloudinary.v2.uploader
.text(text)
.then(result=>console.log(result));
  
|java
result = cloudinary.uploader()
.text(String text);

|csharp
result = cloudinary.Text(TextParams params);

|go
resp, err := cld.Upload.Text(ctx, uploader.TextParams{})

|swift
result = cloudinary.createManagementApi()
.text(text)

```

> **TIP**: SDK-specific documentation can be found in the [SDK Guides](cloudinary_sdks).
### Using the CLI to access the Upload API

You can use the Cloudinary CLI (Command Line Interface) to interact with the Upload API.  This can provide an easy way to add automation to your workflows and manage your assets without the need for a formal coding environment or having to access your Cloudinary Console. 

You can find instructions for setting up and using the CLI in the [CLI reference](cloudinary_cli).
### Error handling

The Upload API returns the status of requests using HTTP status codes:

**200**: OK | Success. 
**400**: Bad request. 
**401**: Authorization required. 
**403**: Not allowed. 
**404**: Not found. 
**409**: Already exists. 

The SDKs report errors by raising applicative exceptions.
Additionally, an informative JSON message is returned. For example:

```json
{ "error": { "message": "Resource not found - 5traNge_nam3" } }
```


### EU or AP data centers and endpoints	(premium feature)

> **NOTE**: This is a premium feature that is supported only for our [Enterprise plans](https://cloudinary.com/pricing#pricing-enterprise) and must be arranged when the account is created. [Contact our Enterprise support and sales team](https://cloudinary.com/contact?plan=enterprise) or your CSM for more information.

By default, Cloudinary accounts use US-based data centers. In these cases, the endpoint format is as shown at the beginning of this [Overview](#overview).

If the majority of your users are located in Europe or Asia, Cloudinary can set up your account to use our Europe (EU) or Asia Pacific (AP) data center. In that case, your endpoints will take the form: 

`https://api-eu.cloudinary.com/v1_1/:cloud_name/:action`

OR

`https://api-ap.cloudinary.com/v1_1/:cloud_name/:action`

> **TIP**: When using the Cloudinary SDKs you need to set the `upload_prefix` [configuration parameter](cloudinary_sdks#configuration_parameters).
