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

# Get a file's contents

> Retrieves a file's contents by its ID. Use this endpoint to download or display the file in your application. To get a file's details, use [this](/api/files/get-a-files-details) instead.



## OpenAPI

````yaml /api/files/openapi.yaml get /files/{id}/view
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/{id}/view:
    get:
      summary: Get a file's contents
      description: >-
        Retrieves a file's contents by its ID. Use this endpoint to download or
        display the file in your application. To get a file's details, use
        [this](/api/files/get-a-files-details) instead.
      parameters:
        - name: id
          description: ID of the file to retrieve.
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: |
            Successfully retrieved the file. 
          content:
            application/octet-stream:
              schema:
                type: string
                format: binary
        '400':
          description: Bad request due to invalid configuration
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                timezone_not_set:
                  value:
                    error: InvalidConfigurationError
                    message: The site's timezone is not set.
                provider_failed:
                  value:
                    error: InvalidConfigurationError
                    message: >-
                      Could not connect to database provider. Please check your
                      database key configurations.
                provider_unsupported:
                  value:
                    error: InvalidConfigurationError
                    message: The configured database provider is not supported.
        '401':
          $ref: '#/components/responses/UnauthorisedError'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  schemas:
    Error:
      type: object
      required:
        - code
        - message
      properties:
        error:
          type: string
        message:
          type: string
  responses:
    UnauthorisedError:
      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.
    NotFound:
      description: The specified resource does not exist.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            notFound:
              value:
                error: NotFoundError
                message: The requested resource was not found.

````

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