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

# Download an resource

> Download a specific resource by providing the resource ID. This endpoint supports downloading various types of resources including vectors, PSDs, photos, and AI-generated content.



## OpenAPI

````yaml get /v1/resources/{resource-id}/download
openapi: 3.0.0
info:
  description: >-
    The Magnific API is your gateway to a vast collection of high-quality
    digital resources for your applications and projects. As a leading platform,
    it offers a wide range of graphics, including vectors, photos,
    illustrations, icons, PSD templates, and more, all curated by talented
    designers from around the world.
  title: Magnific API
  version: 1.0.0
servers:
  - description: B2B API Production V1
    url: https://api.magnific.com
security:
  - magnificApiKey: []
paths:
  /v1/resources/{resource-id}/download:
    get:
      tags:
        - Resources
      summary: Download an resource
      description: >-
        Download a specific resource by providing the resource ID. This endpoint
        supports downloading various types of resources including vectors, PSDs,
        photos, and AI-generated content.
      operationId: download_resource_by_id
      parameters:
        - description: Photo, video or PSD resource ID
          example: 30955
          in: path
          name: resource-id
          required: true
          schema:
            type: integer
        - description: >
            Specifies the search query language using the ISO 639-1 (2-letter

            language code) and the ISO 3166-1 (2-letter country code) for
            language variants.

            The API will use "en-US" as a default language for processing if a
            code is not

            provided, or does not exist.
          example: en-US
          in: header
          name: Accept-Language
          required: false
          schema:
            type: string
        - description: >
            Resizes the photo to a specified size while maintaining aspect
            ratio. Accepts a pixel value (100px to 2000px) or 

            keywords small(1000px), medium(1500px), large(2000px), original
            corresponding to standard website sizes.

            The size depends on the image orientation, the longest side of the
            image will be resized to the specified size.

            If not specified, the highest resolution is provided. Applicable
            only to photos.
          example: 2000px
          in: query
          name: image_size
          required: false
          schema:
            $ref: '#/components/schemas/download_resource_by_id_image_size_parameter'
      responses:
        '200':
          content:
            application/json:
              examples:
                download_vector_or_psd:
                  $ref: '#/components/examples/200-download-vector-or-psd'
                download_photo:
                  $ref: '#/components/examples/200-download-photo'
                download_ai:
                  $ref: '#/components/examples/200-download-ai-resource'
              schema:
                $ref: '#/components/schemas/download_resource_by_id_200_response'
          description: OK Response
        '400':
          content:
            application/json:
              examples:
                invalid_page:
                  summary: Parameter 'page' is not valid
                  value:
                    message: Parameter 'page' must be greater than 0
                invalid_query:
                  summary: Parameter 'query' is not valid
                  value:
                    message: Parameter 'query' must not be empty
                invalid_filter:
                  summary: Parameter 'filter' is not valid
                  value:
                    message: Parameter 'filter' is not valid
                generic_bad_request:
                  summary: Bad Request
                  value:
                    message: Parameter ':attribute' is not valid
              schema:
                $ref: '#/components/schemas/get_all_style_transfer_tasks_400_response'
            application/problem+json:
              examples:
                invalid_page:
                  summary: Parameter 'page' is not valid
                  value:
                    message: Validation error
                    invalid_params:
                      - field: page
                        reason: Parameter 'page' must be greater than 0
                      - field: per_page
                        reason: Parameter 'per_page' must be greater than 0
              schema:
                $ref: >-
                  #/components/schemas/get_all_style_transfer_tasks_400_response_1
          description: >-
            Bad Request - The server could not understand the request due to
            invalid syntax.
        '401':
          content:
            application/json:
              examples:
                invalid_api_key:
                  summary: API key is not valid
                  value:
                    message: Invalid API key
                missing_api_key:
                  summary: API key is not provided
                  value:
                    message: Missing API key
              schema:
                $ref: '#/components/schemas/get_all_style_transfer_tasks_400_response'
          description: >-
            Unauthorized - The client must authenticate itself to get the
            requested response.
        '403':
          content:
            application/json:
              examples:
                user_not_authorized:
                  summary: User has not privileges to access some resource
                  value:
                    message: User is not authorized to access this resource
                user_not_owner:
                  summary: Collection author id is different from current user's id
                  value:
                    message: User is not owner of requested collection
                item_is_premium:
                  summary: The user cannot download this item because it is premium
                  value:
                    message: The user cannot download this item because it is premium
                creator_not_authorized:
                  summary: Creator has not privileges to access some resource
                  value:
                    message: Creator is not authorized to access this resource
              schema:
                $ref: '#/components/schemas/get_all_style_transfer_tasks_400_response'
          description: >-
            Forbidden - The client does not have permission to access the
            requested resource.
        '404':
          content:
            application/json:
              examples:
                ai_resource_not_found:
                  summary: AI resource with provided id does not exist
                  value:
                    message: AI resource not found
                collection_not_found:
                  summary: Collection with provided id does not exist
                  value:
                    message: Collection not found
                resource_not_found:
                  summary: Resource with provided id does not exist
                  value:
                    message: Resource not found
                resources_not_found:
                  summary: Resources not found
                  value:
                    message: Resources not found
                user_not_found:
                  summary: User with provided id does not exist
                  value:
                    message: User not found
                video_not_found:
                  summary: Video with provided id does not exist
                  value:
                    message: Video not found
                video_assets_not_found:
                  summary: Video with provided id has not associated assets
                  value:
                    message: Video not found
                icon_not_found:
                  summary: Icon with provided id does not exist
                  value:
                    message: Icon not found
                author_not_found:
                  summary: Author with provided id does not exist
                  value:
                    message: Author not found
                developer_not_found:
                  summary: Developer with provided email does not exist
                  value:
                    message: Developer not found
                country_not_found:
                  summary: Country with provided code does not exist
                  value:
                    message: Country not found
                generic_not_found:
                  summary: Not Found
                  value:
                    message: Not found
              schema:
                $ref: '#/components/schemas/get_all_style_transfer_tasks_400_response'
          description: Not Found - The server can not find the requested resource.
        '429':
          content:
            application/json:
              examples:
                generic:
                  summary: Generic message for 429 errors
                  value:
                    message: Too many requests
                download_limit_reached:
                  summary: The download limits has been reached.
                  value:
                    message: >-
                      The user can't download more items because the download
                      limits has been reached.
                edit_limit_reached:
                  summary: Free user icon edit limits has been reached.
                  value:
                    message: Limit for free users reached.
              schema:
                $ref: '#/components/schemas/get_all_style_transfer_tasks_400_response'
          description: >-
            Too Many Requests - The client has sent too many requests in a given
            amount of time.
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/get_all_style_transfer_tasks_500_response'
          description: >-
            Internal Server Error - The server has encountered a situation it
            doesn't know how to handle.
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/get_all_style_transfer_tasks_503_response'
          description: Service Unavailable
components:
  schemas:
    download_resource_by_id_image_size_parameter:
      oneOf:
        - enum:
            - small
            - medium
            - large
            - original
          type: string
        - pattern: ^(\d{3}|[12]\d{3})px$
          type: string
    download_resource_by_id_200_response:
      example:
        data:
          filename: blackboard-template.zip
          url: https://downloadscdn5.freepik.com/d/1137445/blackboard-template.zip
          signed_url: >-
            https://img.freepik.com/premium-photo/close-up-cat-resting_1048944-9269194.jpg?t=st=1725276607~exp=1725280207~hmac=1538f1b294fc3a19a19e9f02ceeb6594a9a1e36a900de85d47bbd386e27dddbe
      properties:
        data:
          $ref: '#/components/schemas/download_resource_by_id_200_response_data'
      required:
        - data
      type: object
    get_all_style_transfer_tasks_400_response:
      example:
        message: message
      properties:
        message:
          type: string
      type: object
    get_all_style_transfer_tasks_400_response_1:
      properties:
        problem:
          $ref: >-
            #/components/schemas/get_all_style_transfer_tasks_400_response_1_problem
      type: object
    get_all_style_transfer_tasks_500_response:
      example:
        message: Internal Server Error
      properties:
        message:
          example: Internal Server Error
          type: string
      type: object
    get_all_style_transfer_tasks_503_response:
      example:
        message: Service Unavailable. Please try again later.
      properties:
        message:
          example: Service Unavailable. Please try again later.
          type: string
      type: object
    download_resource_by_id_200_response_data:
      anyOf:
        - $ref: '#/components/schemas/download'
        - $ref: '#/components/schemas/ai_download'
    get_all_style_transfer_tasks_400_response_1_problem:
      properties:
        message:
          example: Validation error
          type: string
        invalid_params:
          items:
            $ref: >-
              #/components/schemas/get_all_style_transfer_tasks_400_response_1_problem_invalid_params_inner
          type: array
      required:
        - invalid_params
        - message
      type: object
    download:
      example:
        filename: blackboard-template.zip
        url: https://downloadscdn5.freepik.com/d/1137445/blackboard-template.zip
        signed_url: >-
          https://img.freepik.com/premium-photo/close-up-cat-resting_1048944-9269194.jpg?t=st=1725276607~exp=1725280207~hmac=1538f1b294fc3a19a19e9f02ceeb6594a9a1e36a900de85d47bbd386e27dddbe
      properties:
        filename:
          description: Filename of the resource
          example: blackboard-template.zip
          minLength: 1
          type: string
        url:
          example: https://downloadscdn5.freepik.com/d/1137445/blackboard-template.zip
          format: uri
          minLength: 1
          type: string
        signed_url:
          description: The signed URL of the resource preview
          example: >-
            https://img.freepik.com/premium-photo/close-up-cat-resting_1048944-9269194.jpg?t=st=1725276607~exp=1725280207~hmac=1538f1b294fc3a19a19e9f02ceeb6594a9a1e36a900de85d47bbd386e27dddbe
          format: uri
          nullable: true
          type: string
      required:
        - filename
        - url
      type: object
    ai_download:
      allOf:
        - $ref: '#/components/schemas/download'
        - properties:
            prompt:
              description: The used prompt to create this resource
              example: Two cute cats are playing with a ball of wool
              type: string
          required:
            - prompt
          type: object
    get_all_style_transfer_tasks_400_response_1_problem_invalid_params_inner:
      properties:
        name:
          description: Name of the invalid parameter.
          example: page
          type: string
        field:
          description: Field of the invalid parameter. Mirrors `name`.
          example: page
          type: string
        reason:
          example: Parameter 'page' must be greater than 0
          type: string
      required:
        - field
        - name
        - reason
      type: object
  examples:
    200-download-vector-or-psd:
      summary: Success - Download resource
      value:
        data:
          filename: Mother-and-daughter.zip
          url: >-
            https://downloadscdn5.freepik.com/d/999999/23/99999/8888888/mother-and-daughter.zip?token=exp=1689689298~hmac=1234567890abcde
    200-download-photo:
      summary: Success - Download photo
      value:
        data:
          filename: 9126.jpg
          url: >-
            https://downloadscdn7.freepik.com/188544/10/9126.jpg?filename=painting-mountain-lake-with-mountain-background&token=exp=1691754014~hmac=36873e9be562d19e95671ec4032feb0c
    200-download-ai-resource:
      summary: Success - Download ai resource
      value:
        data:
          filename: lovely-cats.zip
          url: >-
            https://downloadscdn5.freepik.com/d/999999/23/99999/8888888/lovely-cats.zip?token=exp=1689689298~hmac=1234567890abcde
          prompt: >-
            There are three lovely cats in the picture. They are playing with
            each other. They are very cute.
  securitySchemes:
    magnificApiKey:
      description: >
        Your Magnific API key. Required for authentication. [Learn how to obtain
        an API key](https://docs.magnific.com/quickstart)
      in: header
      name: x-magnific-api-key
      type: apiKey

````