# Direct Upload API

The direct upload API endpoints can be used to create and upload a file directly in the DAM. The upload requires two steps:

  1. Create an empty file with metadata in the DAM
  2. Upload the file's content

# 1. Create an Empty File with Metadata

Endpoint: POST /extensions/dam/new-upload

This endpoint initializes a new file entry in the DAM. It creates a file placeholder with only 0-byte content, using provided, user-defined metadata.
When to use it: Use it when you need to define metadata before the actual file is available.

# Request Body (JSON)

An object with metadata fields. Non-nullable properties must be included. Each property follows the CEType scheme (opens new window).

# Example

{
  "title": [{ "value": "Product brochure" }],
  "category": [{ "value": "Marketing" }]
}

# Responses

  • 200 OK
    File created successfully.
    {
      "id": "abc123"
    }
    
  • 400 Bad Request
    Missing or invalid properties.
  • 401 Unauthorized
    Authentication required.
  • 403 Forbidden
    Permission denied.

# 2. Upload File Content

Endpoint: PUT /extensions/dam/upload/{id}

This endpoint uploads binary file content to an existing file created with the previous endpoint. Chunked uploads and versioning are supported.
When to use it: Use it to upload the actual file content by referencing the file id created previously. Here, you can also rename the file, manage name collisions, or upload a new version.

# Path Parameter

  • id (string, required): The ID of the target file (from the previous step).

# Query Parameters

  • name (optional): Rename the file after its upload.
  • action (optional): Defines the strategy if a file with the same name exists. Allowed values: rename (default), replace.
  • version (optional): Title for a new file version, if versioning is desired (the newly uploaded file will be the new "current version").

# Request Body

A binary file stream: Content-Type: application/octet-stream

# Responses

  • 201 Created
    File content uploaded successfully. Returns the updated file object and its version (if applicable).
    {
      "file": { /* file object */ },
      "created_version": { /* version object */ }
    }
    
  • 202 Accepted
    Chunk accepted (in case of multipart uploads).
  • 400 Bad Request
    Invalid upload or ID.
  • 401 Unauthorized
    Authentication required.
  • 403 Forbidden
    Access denied.
Request missing documentation