# Create Product Downloadable

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /v1/products/product-id/downloadables/:
    post:
      summary: Create Product Downloadable
      deprecated: false
      description: >-
        This endpoint creates downloadable content for a digital product,
        associating a file with the specified product. The download link is
        generated and returned, allowing users to access or download the content
        directly. The response provides information on the uploaded file,
        including its metadata, access link, and display details.


        <Accordion title="🔑Scopes" defaultOpen>
            
          `products.read_write` - Products Read & Write
         
        </Accordion>
      tags:
        - Default module/Apps/Merchant APIs/Products/Digital Products
      parameters:
        - name: Authorization
          in: header
          description: >-
            The Authorization token is a unique key given to the third-party
            application (Partner) by Zid. It is used to authenticate the API
            requests made by the Partner application. The token verifies the
            partner's identity and ensures they have permission to access Zid's
            API but does not provide any specific user or store information. It
            should be included in the header of API requests when the partner
            application needs to access Zid's API.
          required: true
          example: '{{Autherization}}'
          schema:
            type: string
        - name: Store-Id
          in: header
          description: Unique identifier of the store.
          required: false
          example: 3
          schema:
            type: integer
        - name: Accept-Language
          in: header
          description: >-
            Preferred language for the response. Defaults to `en` if not
            specified.
          required: false
          example: en
          schema:
            type: string
        - name: X-manager-Token
          in: header
          description: >-
            This token is used to authenticate and access information related to
            the store. It is obtained through an OAuth mechanism and is required
            to perform operations on the store's data. The `X-Manager-Token`
            should be included in the header of API requests that require
            store-related information.
          required: false
          example: '{{Access-Token}}'
          schema:
            type: string
        - name: Role
          in: header
          description: Role of the user.
          required: false
          example: Manager
          schema:
            type: string
        - name: Currency
          in: header
          description: >-
            The currency in which the data should be returned. This should be
            provided as an ISO 4217 currency code. For example, SAR for Saudi
            Riyal, USD for United States Dollar, KWD for Kuwaiti Dinar, etc.
          required: false
          example: SAR
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                file:
                  type: string
                  description: >-
                    Contains details about the uploaded file, including storage
                    key, access URL, and metadata.
                  examples:
                    - >-
                      9fc92996-ffbe-4bca-9b8e-6682137fe7b6/product-downloadables/8244389b-8fe3-47dc-85ae-2f8e9e95f899
                display_name:
                  type: string
                  description: The name of the file as it should appear to the end user.
                  examples:
                    - most-common-reasons-for-journal-rejections.pdf
                save_to_library:
                  type: boolean
                  description: >-
                    Indicates whether the downloadable file should be saved to
                    the store's library for future use.
                  default: true
              required:
                - file
                - display_name
                - save_to_library
              x-apidog-orders:
                - file
                - display_name
                - save_to_library
              x-apidog-ignore-properties: []
            example:
              file: >-
                9fc92996-ffbe-4bca-9b8e-6682137fe7b6/product-downloadables/8244389b-8fe3-47dc-85ae-2f8e9e95f899
              display_name: most-common-reasons-for-journal-rejections.pdf
              save_to_library: true
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: A unique identifier for the downloadable content.
                    examples:
                      - 1c044189-9155-4d51-aef1-22c8d3edd7ba
                  product_id:
                    type: string
                    description: >-
                      The ID of the product to which this downloadable file is
                      linked.
                    examples:
                      - 5af835b7-1a37-4401-a3fc-6d9007c44c8f
                  file:
                    type: object
                    properties:
                      key:
                        type: string
                        description: >-
                          The unique storage identifier for the file in the
                          storage system.
                        examples:
                          - >-
                            9fc92996-ffbe-4bca-9b8e-6682137fe7b6/product-downloadables/8244389b-8fe3-47dc-85ae-2f8e9e95f899
                      url:
                        type: string
                        description: >-
                          The direct access URL for the file, including
                          temporary authentication parameters if needed.
                        examples:
                          - >-
                            https://s3.eu-west-1.amazonaws.com/private.zid.store/9fc92996-ffbe-4bca-9b8e-6682137fe7b6/product-downloadables/8244389b-8fe3-47dc-85ae-2f8e9e95f899?response-content-disposition=inline%3B%20filename%3D%22most-common-reasons-for-journal-rejections.pdf%22&AWSAccessKeyId=AKIAXOL3MW23VCA3WLDK&Signature=vZI5mUsstSI2hT4lL957lFun%2F%2BM%3D&Expires=1730614548
                      meta:
                        type: object
                        properties:
                          content_length:
                            type: integer
                            description: The size of the file in bytes.
                            examples:
                              - 278103
                          content_type:
                            type: string
                            description: >-
                              The MIME type of the file (e.g.,
                              binary/octet-stream).
                            examples:
                              - binary/octet-stream
                          content_encoding:
                            type: 'null'
                            description: >-
                              Specifies any encoding used for the file, or null
                              if none.
                        required:
                          - content_length
                          - content_type
                          - content_encoding
                        x-apidog-orders:
                          - content_length
                          - content_type
                          - content_encoding
                        description: Metadata about the file.
                        x-apidog-ignore-properties: []
                    required:
                      - key
                      - url
                      - meta
                    x-apidog-orders:
                      - key
                      - url
                      - meta
                    description: >-
                      Contains details about the uploaded file, including
                      storage key, access URL, and metadata.
                    x-apidog-ignore-properties: []
                  display_name:
                    type: string
                    description: The name of the file as it should appear to the end user.
                    examples:
                      - most-common-reasons-for-journal-rejections.pdf
                  display_order:
                    type: 'null'
                    description: >-
                      Optional ordering value to manage display sequence among
                      multiple files.
                  is_enabled:
                    type: boolean
                    description: Indicates whether this file is available for download.
                    default: true
                  is_external:
                    type: boolean
                    description: >-
                      Defines if the file is hosted externally or within the
                      primary storage.
                    default: false
                required:
                  - id
                  - product_id
                  - file
                  - display_name
                  - display_order
                  - is_enabled
                  - is_external
                x-apidog-orders:
                  - id
                  - product_id
                  - file
                  - display_name
                  - display_order
                  - is_enabled
                  - is_external
                x-apidog-ignore-properties: []
          headers: {}
          x-apidog-name: Created
        '401':
          description: ''
          content:
            application/json:
              schema:
                type: object
                description: >-
                  Response returned when the request cannot be authenticated
                  because the required credentials are missing, invalid, or
                  expired.
                properties:
                  status:
                    type: string
                    description: Indicates the overall status of the API response.
                    examples:
                      - error
                  message:
                    type: object
                    description: >-
                      Contains structured details explaining why the request
                      could not be authenticated.
                    properties:
                      type:
                        type: string
                        description: Indicates the category of the response message.
                        examples:
                          - error
                      code:
                        type: string
                        description: >-
                          A machine-readable code identifying the authentication
                          error. Returns null when no specific code is
                          available.
                        examples:
                          - UNAUTHORIZED
                        nullable: true
                      name:
                        type: string
                        description: >-
                          A short, human-readable title describing the
                          authentication error. Returns null when no title is
                          available.
                        examples:
                          - Unauthorized
                        nullable: true
                      description:
                        type: string
                        description: >-
                          A human-readable explanation of why the request could
                          not be authenticated. Returns null when no detailed
                          explanation is available.
                        examples:
                          - >-
                            Authentication credentials are missing, invalid, or
                            expired.
                        nullable: true
                    required:
                      - type
                      - code
                      - name
                      - description
                    x-apidog-orders:
                      - type
                      - code
                      - name
                      - description
                    x-apidog-ignore-properties: []
                required:
                  - status
                  - message
                x-apidog-orders:
                  - status
                  - message
                examples:
                  - status: error
                    message:
                      type: error
                      code: UNAUTHORIZED
                      name: Unauthorized
                      description: >-
                        Authentication credentials are missing, invalid, or
                        expired.
                x-apidog-ignore-properties: []
              examples:
                '2':
                  summary: Example 1
                  value:
                    status: error
                    message:
                      type: error
                      code: ERROR_SESSION_MISSING
                      name: Sorry
                      description: Please login first.
                '3':
                  summary: Example 2
                  value:
                    status: error
                    message:
                      type: error
                      code: ERROR_SESSION_INVALID
                      name: Sorry
                      description: Login session expired. Please login again.
                '4':
                  summary: Example 3
                  value:
                    status: error
                    message:
                      type: error
                      code: ERROR_SESSION_INVALID
                      name: Sorry
                      description: Invalid authentication
          headers: {}
          x-apidog-name: Unauthorized
        '404':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                required:
                  - detail
                x-apidog-orders:
                  - detail
                x-apidog-ignore-properties: []
              example:
                detail: Not found.
          headers: {}
          x-apidog-name: Not Found
        '500':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    description: Status of the error.
                  message:
                    $ref: '#/components/schemas/ResponseEnvelopMessage'
                required:
                  - status
                  - message
                x-apidog-orders:
                  - status
                  - message
                x-apidog-ignore-properties: []
              example:
                status: error
                message:
                  type: error
                  code: MSG_HIDDEN
                  name: Error
                  description: Internal Server Error
          headers: {}
          x-apidog-name: Internal Server error
      security: []
      x-apidog-folder: Default module/Apps/Merchant APIs/Products/Digital Products
      x-apidog-status: released
      x-run-in-apidog: https://app.apidog.com/web/project/613905/apis/api-11447610-run
components:
  schemas:
    ResponseEnvelopMessage:
      type: object
      properties:
        type:
          type: string
          description: Type of response message returned by the API.
          examples:
            - success
        code:
          type: string
          description: Response code returned by the API, if available.
          examples:
            - MSG_POPUP_OK
          nullable: true
        name:
          type: string
          description: Name or title of the response message, if available.
          examples:
            - Coupons
          nullable: true
        description:
          type: string
          description: Detailed description of the response message, if available.
          examples:
            - Coupons created successfully
          nullable: true
      required:
        - type
        - code
        - name
        - description
      description: Additional response metadata.
      x-apidog-orders:
        - type
        - code
        - name
        - description
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
  securitySchemes: {}
servers:
  - url: https://api.zid.sa/
    description: Prod Env
security: []

```
