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

# Copy an image or video from a public URL into the merchant's Shopify Files

> Downloads `url` and uploads it to Shopify Files like /upload does (same waiting, same multi-store fan-out and side effects), returning the processed file node. Used to import Instagram media into a content block. A source that answers 4xx (e.g. an expired Instagram CDN link) is a 400; the source must send a Content-Length.



## OpenAPI

````yaml /api-reference/openapi/lite.json post /media/{merchant_id}/upload_media_from_url
openapi: 3.1.0
info:
  title: Search & Merchandising API
  version: 1.0.0
  description: >-
    REST API behind Depict: Search & Merchandising, the native Shopify app:
    onboarding, collections, boost & bury, dashboards, A/B testing and
    multi-store management. Endpoints are served under the /api/lite prefix and
    are authenticated with the Shopify session token that App Bridge issues to
    the embedded app.
servers:
  - url: /api/lite
security:
  - ShopifySessionToken: []
paths:
  /media/{merchant_id}/upload_media_from_url:
    post:
      summary: >-
        Copy an image or video from a public URL into the merchant's Shopify
        Files
      description: >-
        Downloads `url` and uploads it to Shopify Files like /upload does (same
        waiting, same multi-store fan-out and side effects), returning the
        processed file node. Used to import Instagram media into a content
        block. A source that answers 4xx (e.g. an expired Instagram CDN link) is
        a 400; the source must send a Content-Length.
      operationId: mediaUploadFromUrl
      parameters:
        - schema:
            type: string
            description: >-
              Lite merchant id of the store to upload to, e.g. `shopify-<shop
              id>`.
          required: true
          description: >-
            Lite merchant id of the store to upload to, e.g. `shopify-<shop
            id>`.
          name: merchant_id
          in: path
        - schema:
            type: string
            description: >-
              The collection being edited. In a multi-store group, the file is
              also uploaded to every store whose collection is linked to this
              one; omit it to upload to this store only.
          required: false
          description: >-
            The collection being edited. In a multi-store group, the file is
            also uploaded to every store whose collection is linked to this one;
            omit it to upload to this store only.
          name: collection_id
          in: query
        - schema:
            type: string
            description: Alt text stored on the Shopify file.
          required: false
          description: Alt text stored on the Shopify file.
          name: alt_text
          in: query
        - schema:
            type: string
            format: uri
            description: Public http(s) URL of the media to copy.
          required: true
          description: Public http(s) URL of the media to copy.
          name: url
          in: query
        - schema:
            type: string
            enum:
              - image
              - video
            description: Uploaded as image/jpeg or video/mp4 respectively.
          required: true
          description: Uploaded as image/jpeg or video/mp4 respectively.
          name: media_type
          in: query
      responses:
        '200':
          description: >-
            The file as Shopify holds it once processed (this store's copy): a
            `MediaImage` or a `Video`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MediaNode'
        '400':
          description: >-
            The request failed its schema, the store has no Shopify config, or
            Shopify rejected the file (type, size, processing). `detail` is a
            sentence the portal shows the merchant.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Detail'
        '401':
          description: Not authenticated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Detail'
        '403':
          description: Authenticated, but this identity may not call the API.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Detail'
        '404':
          description: Merchant not found for this caller.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Detail'
        '500':
          description: >-
            Internal error, or Shopify failed in a way the merchant cannot act
            on.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Detail'
components:
  schemas:
    MediaNode:
      oneOf:
        - $ref: '#/components/schemas/MediaImage'
        - $ref: '#/components/schemas/MediaVideo'
      discriminator:
        propertyName: __typename
        mapping:
          MediaImage:
            $ref: '#/components/schemas/MediaImage'
          Video:
            $ref: '#/components/schemas/MediaVideo'
    Detail:
      type: object
      properties:
        detail:
          type: string
      required:
        - detail
      description: 'Every 4xx/5xx body: `{detail}`.'
    MediaImage:
      type: object
      properties:
        __typename:
          type: string
          enum:
            - MediaImage
        id:
          type: string
          description: Shopify MediaImage GID; store it to reference the file.
        fileStatus:
          type: string
          description: >-
            Shopify's file status: always `READY` on a 200 (the route waits out
            processing; a failed file answers 400).
        fileErrors:
          type: array
          items:
            type: object
            properties:
              code:
                type:
                  - string
                  - 'null'
              details:
                type:
                  - string
                  - 'null'
              message:
                type:
                  - string
                  - 'null'
            required:
              - code
              - details
              - message
        mediaContentType:
          type: string
          description: '`IMAGE`.'
        alt:
          type:
            - string
            - 'null'
        image:
          type:
            - object
            - 'null'
          properties:
            altText:
              type:
                - string
                - 'null'
            height:
              type:
                - integer
                - 'null'
            id:
              type:
                - string
                - 'null'
            url:
              type: string
              description: Shopify CDN URL.
            width:
              type:
                - integer
                - 'null'
          required:
            - altText
            - height
            - id
            - url
            - width
      required:
        - __typename
        - id
        - fileStatus
        - fileErrors
        - mediaContentType
        - alt
        - image
    MediaVideo:
      type: object
      properties:
        __typename:
          type: string
          enum:
            - Video
        id:
          type: string
          description: Shopify Video GID; store it to reference the file.
        fileStatus:
          type: string
          description: >-
            Shopify's file status: always `READY` on a 200 (the route waits out
            processing; a failed file answers 400).
        filename:
          type:
            - string
            - 'null'
        fileErrors:
          type: array
          items:
            type: object
            properties:
              code:
                type:
                  - string
                  - 'null'
              details:
                type:
                  - string
                  - 'null'
              message:
                type:
                  - string
                  - 'null'
            required:
              - code
              - details
              - message
        alt:
          type:
            - string
            - 'null'
        mediaContentType:
          type: string
          description: '`VIDEO`.'
        sources:
          type: array
          items:
            type: object
            properties:
              format:
                type: string
              height:
                type: integer
              width:
                type: integer
              mimeType:
                type: string
              url:
                type: string
            required:
              - format
              - height
              - width
              - mimeType
              - url
          description: Renditions Shopify transcoded, one per format.
      required:
        - __typename
        - id
        - fileStatus
        - filename
        - fileErrors
        - alt
        - mediaContentType
        - sources
  securitySchemes:
    ShopifySessionToken:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Shopify App Bridge session token of the embedded Depict: Search &
        Merchandising app. The shop in the token determines the merchant;
        merchant_id parameters must belong to that shop.

````