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

# Upload files

> Upload one or more files to the platform.



## OpenAPI

````yaml /api/files/openapi.yaml post /files/upload
openapi: 3.1.0
info:
  title: Unified CDN API | Files
  description: Interact with files on the Unified CDN system.
  version: 0.1.0
servers:
  - url: https://{Unified_CDN_domain}/api
    description: Production server where your Unified CDN is hosted.
    variables:
      Unified_CDN_domain:
        default: api.example.com
        description: >-
          The domain where your Unified CDN is hosted. Change this to your
          custom domain if you have one.
security: []
paths:
  /files/upload:
    post:
      summary: Upload files
      description: Upload one or more files to the platform.
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - files
              properties:
                files:
                  type: array
                  minItems: 1
                  description: Array of files to be uploaded.
                  items:
                    type: string
                    format: binary
      responses:
        '200':
          description: Successfully uploaded the file(s).
          content:
            application/json:
              schema:
                type: object
                properties:
                  uploads:
                    type: array
                    description: The list of successfully uploaded files.
                    items:
                      $ref: '#/components/schemas/File'
                  failed:
                    type: array
                    description: >-
                      The list of filenames that failed to upload, along with
                      the reasons.
                    items:
                      type: object
                      properties:
                        filename:
                          type: string
                        reason:
                          type: string
        '400':
          description: Bad request due to invalid configuration
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                timezone_not_set:
                  summary: Site timezone not set
                  value:
                    error: InvalidConfigurationError
                    message: The site's timezone is not set.
                no_files_uploaded:
                  summary: No files were uploaded
                  value:
                    error: InvalidConfigurationError
                    message: No files were uploaded.
                max_files_exceeded:
                  summary: Max no. of files exceeded
                  value:
                    error: InvalidConfigurationError
                    message: You can only upload a maximum of ... files at a time.
                max_file_size_exceeded:
                  summary: Max file size exceeded
                  value:
                    error: InvalidConfigurationError
                    message: One or more files exceed the maximum allowed size of ...
                invalid_file_types:
                  summary: Invalid file types
                  value:
                    error: InvalidConfigurationError
                    message: >-
                      One or more files are not of the allowed types for this
                      grant code.
                all_files_failed:
                  summary: All files failed to upload
                  value:
                    error: InvalidConfigurationError
                    message: >-
                      All file uploads failed. Please check your configuration
                      and try again.
                provider_unsupported:
                  summary: Unsupported provider
                  value:
                    error: InvalidConfigurationError
                    message: The configured database provider is not supported.
        '401':
          description: The request lacks valid authentication credentials.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                unauthorised:
                  value:
                    error: UnauthorisedError
                    message: You are unauthorised to perform this action.
                provider_failed:
                  value:
                    error: InvalidConfigurationError
                    message: >-
                      Could not connect to database provider. Please check your
                      database key configurations.
        '403':
          description: Forbidden due to grant code restrictions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                exceeded_application_limit:
                  value:
                    error: LimitExceededError
                    exceedsBy: 12345
                    message: >-
                      Uploading your payload would exceed the application's file
                      limit by ... bytes.
                exceeded_database_limit:
                  value:
                    error: LimitExceededError
                    exceedsBy: 67890
                    message: >-
                      Uploading your payload would exceed the database's file
                      limit by ... bytes.
      security:
        - ApiKeyAuth: []
        - CodeAuth: []
components:
  schemas:
    File:
      type: object
      properties:
        id:
          type: string
        applicationId:
          type: string
        databaseId:
          type: string
        key:
          type: string
        name:
          type: string
        size:
          type: integer
        contentType:
          type: string
        expiresAt:
          type: string
          format: date-time
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
      required:
        - id
        - applicationId
        - databaseId
        - key
        - name
        - size
        - contentType
        - createdAt
        - updatedAt
    Error:
      type: object
      required:
        - code
        - message
      properties:
        error:
          type: string
        message:
          type: string
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: Enter your API key using the format `Bearer <your-api-key>`.
    CodeAuth:
      type: apiKey
      in: header
      name: Authorization
      description: Enter your code using the format `Code <your-code>`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.