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

# Get Download Strategy (Direct or Presigned URL)

> Returns download strategy based on storage backend and bucket visibility.
- S3 with public bucket: Direct URLs (no presigning, better performance)
- S3 with private bucket: Presigned URLs with expiration
- Local storage: Always direct endpoints

Expiry (when presigned) is auto-calculated server-side from bucket
visibility; no request body is accepted.

Object keys may contain `/` (pseudo-folders); the path is matched
with a wildcard, so callers should NOT percent-encode `/` inside
`objectKey`.




## OpenAPI

````yaml https://raw.githubusercontent.com/InsForge/InsForge/main/openapi/storage.yaml get /api/storage/buckets/{bucketName}/download-strategy/objects/{objectKey}
openapi: 3.0.3
info:
  title: Insforge Storage API
  version: 2.0.0
  description: Bucket-based storage system similar to S3
servers: []
security: []
paths:
  /api/storage/buckets/{bucketName}/download-strategy/objects/{objectKey}:
    get:
      tags:
        - Client
      summary: Get Download Strategy (Direct or Presigned URL)
      description: >
        Returns download strategy based on storage backend and bucket
        visibility.

        - S3 with public bucket: Direct URLs (no presigning, better performance)

        - S3 with private bucket: Presigned URLs with expiration

        - Local storage: Always direct endpoints


        Expiry (when presigned) is auto-calculated server-side from bucket

        visibility; no request body is accepted.


        Object keys may contain `/` (pseudo-folders); the path is matched

        with a wildcard, so callers should NOT percent-encode `/` inside

        `objectKey`.
      parameters:
        - name: bucketName
          in: path
          required: true
          schema:
            type: string
            pattern: ^[a-zA-Z0-9_-]+$
          example: avatars
        - name: objectKey
          in: path
          required: true
          schema:
            type: string
          example: profile-photo.jpg
      responses:
        '200':
          description: Download strategy details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DownloadStrategy'
              examples:
                s3-public:
                  summary: S3 Public Bucket Response
                  value:
                    method: direct
                    url: >-
                      https://s3-bucket.s3.us-east-2.amazonaws.com/app-key/public-assets/logo.png
                s3-private:
                  summary: S3 Private Bucket Response
                  value:
                    method: presigned
                    url: >-
                      https://s3-bucket.s3.us-east-2.amazonaws.com/app-key/avatars/profile.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=...
                    expiresAt: '2025-09-05T01:00:00Z'
                local:
                  summary: Local Storage Response
                  value:
                    method: direct
                    url: /api/storage/buckets/avatars/objects/profile-photo.jpg
        '404':
          description: Object not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - apiKey: []
components:
  schemas:
    DownloadStrategy:
      type: object
      required:
        - method
        - url
      properties:
        method:
          type: string
          enum:
            - presigned
            - direct
          description: >
            Download method:

            - `direct`: Direct URL access (S3 public buckets or local storage)

            - `presigned`: Secure URL with signature and expiration (S3 private
            buckets)
          example: direct
        url:
          type: string
          description: URL to download the file from
          example: >-
            https://s3-bucket.s3.us-east-2.amazonaws.com/app-key/public-assets/logo.png
        expiresAt:
          type: string
          format: date-time
          description: >-
            Expiration time for presigned URLs (only present when method is
            'presigned')
          example: '2025-09-05T01:00:00Z'
        headers:
          type: object
          description: Optional headers to include in the download request
          additionalProperties: true
    ErrorResponse:
      type: object
      required:
        - error
        - message
        - statusCode
      properties:
        error:
          type: string
          description: Error code for programmatic handling
          example: VALIDATION_ERROR
        message:
          type: string
          description: Human-readable error message
          example: Invalid request
        statusCode:
          type: integer
          description: HTTP status code
          example: 400
        nextActions:
          type: string
          description: Suggested action to resolve the error
          example: Check your request parameters
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key

````