# Generate an upload URL

Generates a URL that can be used to upload a file based on the upload configuration provided. For security reasons, the URL is only valid for a limited time. When uploading a file, you must provide the configuration and action to be performed with the upload. When you upload a file, it can:  - Create a new asset.  - Create a new version of an existing asset.  - Be an alternate file for an existing asset. Uploads require an upload configuration that defines supported file extensions, the content repository to which the file is to be uploaded, and so on. Security checks validate that the user has permission to perform uploads. The upload URL is returned in the response location header.

Endpoint: POST /api/v2.0/upload
Version: v2.0
Security: OAuth2

## Request fields (application/json-patch+json):

  - `file_name` (string,null)
    The name of the file to be uploaded.

  - `file_size` (integer)
    The size of the file to be uploaded.

  - `upload_configuration` (object)
    Information about the upload configuration.

  - `upload_configuration.name` (string,null)
    The name of the upload configuration to use

  - `upload_configuration.parameters` (object,null)
    Specifies additional parameters required by certain upload configurations. For example, you can configure an upload to automatically link the asset to another entity upon creation, such as associating an asset with a product. In this case, you must provide the relation name and the target entity ID as parameters (for example: { "PCMProductToAsset": 123 }). To enable this behavior, update the M.UploadConfiguration and modify the ConfigurationSettings.entityConfiguration.relation property. See [Update the configuration settings](https://doc.sitecore.com/ch/en/developers/cloud-dev/update-the-configuration-settings.html) for more information.

  - `action` (object)

  - `action.name` (string,null)
    The name of the action (NewAsset, NewMainFile, or NewAlternativeFile)

  - `action.parameters` (object,null)
    The parameters necessary for some actions. The action NewMainFile, or NewAlternativeFile requires the ID of the asset to which the file will be uploaded, such as {"AssetId": 32052}

## Response 201 fields (application/json):

  - `upload_identifier` (string,null)
    The identifier for the upload session. This is used later to complete the upload process, after the file has been uploaded.

  - `storage_identifier` (string,null)
    The identifier of the upload storage. This is used later to complete the upload process after the file has been uploaded.

  - `file_identifier` (string,null)
    This is used later to complete the upload process after the file has been uploaded.

## Response 400 fields (application/json):

  - `type` (string,null)

  - `title` (string,null)

  - `status` (integer,null)

  - `detail` (string,null)

  - `instance` (string,null)


## Response 401 fields

## Response 500 fields
