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

# Request a presigned upload URL for a digital file

> *Rate limit: 100 requests / 10 seconds per shop. See [Rate limiting](/guides/rate-limiting).*

Returns a presigned URL to upload a digital file to. After receiving the response, PUT the file bytes directly to the uploadUrl, then call the confirm endpoint to link the file to the product.

<Warning>
  This endpoint is in beta and subject to change.
</Warning>

<Note>
  **OAuth scope:** `offer_write`

  API keys have full access to this endpoint.
</Note>

<Warning>
  **When you `PUT` the bytes to `uploadUrl`, you must send two headers that are baked into the URL's signature** — omit or mismatch either and Google Cloud Storage rejects the upload with `403 SignatureDoesNotMatch`:

  * `Content-Type` — must equal the `contentType` you sent in this request.
  * `x-goog-content-length-range: 0,<size>` — must use the same `size` (in bytes) you sent in this request.

  The `PUT` goes **directly to Google Cloud Storage**, not Fourthwall — don't send your Fourthwall credentials with it, and note the URL is short-lived. See [Create digital products](/guides/create-digital-products) for an end-to-end walkthrough.
</Warning>


## OpenAPI

````yaml POST /open-api/v1.0/products/{productId}/digital-files/upload-url
openapi: 3.1.0
info:
  title: Fourthwall APIs
  description: Service used for management of orders, carts, and payments.
  termsOfService: https://fourthwall.com/terms-of-service
  contact:
    name: Backend team
    url: https://fourthwall.com
    email: backend@fourthwall.com
  version: unspecified
servers:
  - url: https://api.fourthwall.com
    description: Production server
security: []
externalDocs:
  description: OpenAPI documentation
  url: https://docs.fourthwall.com
paths:
  /open-api/v1.0/products/{productId}/digital-files/upload-url:
    post:
      tags:
        - Digital Products
      summary: Request a presigned upload URL for a digital file
      description: >-
        *Rate limit: 100 requests / 10 seconds per shop. See [Rate
        limiting](/guides/rate-limiting).*


        Returns a presigned URL to upload a digital file to. After receiving the
        response, PUT the file bytes directly to the uploadUrl, then call the
        confirm endpoint to link the file to the product.
      operationId: request-digital-file-upload-url
      parameters:
        - name: productId
          in: path
          required: true
          schema:
            type: string
          example: 00aa4abd-5778-4199-8161-0b49b2f212e5
      requestBody:
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/com.fourthwall.openapi.model.offer.DigitalFileUploadRequestV1
        required: true
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/com.fourthwall.openapi.model.offer.DigitalFileUploadResponseV1
        '403':
          description: 'Possible errors: `SAAS_OPERATION_NOT_ALLOWED_ERROR`'
          content:
            application/json:
              examples:
                saas-operation-not-allowed-error:
                  value:
                    code: SAAS_OPERATION_NOT_ALLOWED_ERROR
                    operation: <saasoperation.type>
                    shopId: <shopid>
                    planUpgradeable: <boolean>
        '404':
          description: >-
            Possible errors: `OFFER_NOT_FOUND_BY_SHOP_ID_AND_ID_ERROR`,
            `OFFER_NOT_FOUND_ERROR`
          content:
            application/json:
              examples:
                offer-not-found-by-shop-id-and-id-error:
                  value:
                    code: OFFER_NOT_FOUND_BY_SHOP_ID_AND_ID_ERROR
                    shopId: <shopid>
                    offerId: <offerid>
                offer-not-found-error:
                  value:
                    code: OFFER_NOT_FOUND_ERROR
                    offerId: <offerid>
        '406':
          description: 'Possible errors: `MEDIA_FILE_SIZE_EXCEEDED_ERROR`'
          content:
            application/json:
              examples:
                media-file-size-exceeded-error:
                  value:
                    code: MEDIA_FILE_SIZE_EXCEEDED_ERROR
                    maxFileSize: <long>
                    fileSize: <long>
        '429':
          description: 'Rate limited: 100 requests / 10 seconds per shop.'
          content:
            application/json:
              examples:
                too-many-requests:
                  value:
                    code: OPEN_API_TOO_MANY_REQUESTS
                    title: Too many requests
                    status: 429
      security:
        - oauth:
            - offer_write
        - basicAuth: []
components:
  schemas:
    com.fourthwall.openapi.model.offer.DigitalFileUploadRequestV1:
      type: object
      description: Request for a presigned upload URL for a digital file
      properties:
        fileName:
          type: string
          description: Name of the file
          example: artwork.png
        contentType:
          type: string
          description: MIME type of the file
          example: image/png
        size:
          type: integer
          format: int64
          description: >-
            Size of the file in bytes. Must match the
            `x-goog-content-length-range` header sent when uploading the bytes
            to `uploadUrl`.
          example: 1048576
      required:
        - contentType
        - fileName
        - size
      title: Digital File Upload Request
    com.fourthwall.openapi.model.offer.DigitalFileUploadResponseV1:
      type: object
      description: Response containing a presigned upload URL for a digital file
      properties:
        uploadUrl:
          type: string
          description: Presigned URL to upload the file to via HTTP PUT
        fileUrl:
          type: string
          description: The file URL reference to use when confirming the upload
      required:
        - fileUrl
        - uploadUrl
      title: Digital File Upload Response
  securitySchemes:
    oauth:
      type: oauth2
      flows:
        implicit:
          authorizationUrl: >-
            https://auth.staging.fourthwall.com/auth/realms/Fourthwall/protocol/openid-connect/auth
          scopes:
            donation_read: donation_read
            order_read: order_read
            order_write: order_write
            fulfillment_write: fulfillment_write
            giveaway_read: giveaway_read
            giveaway_write: giveaway_write
            memberships_read: memberships_read
            memberships_write: memberships_write
            promotions_write: promotions_write
            promotions_read: promotions_read
            offer_read: offer_read
            offer_write: offer_write
            shop_read: shop_read
            thankyou_read: thankyou_read
            thankyou_write: thankyou_write
            webhook_read: webhook_read
            webhook_write: webhook_write
            media_read: media_read
            media_write: media_write
            analytics_read: analytics_read
            samples_read: samples_read
            samples_write: samples_write
            dns_read: dns_read
            dns_write: dns_write
            settings_read: settings_read
            payout_read: payout_read
            integrations_read: integrations_read
    basicAuth:
      type: http
      scheme: basic

````