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

# Create presigned url

> Create a presigned url for a storage key. This endpoint provides a presigned url for a storage key, which can be used to download the file from the storage.



## OpenAPI

````yaml post /boxes/{boxId}/storage/presigned-url
openapi: 3.0.0
info:
  title: GBOX Open API
  description: GBOX Open API Documentation
  version: '1.0'
  contact: {}
servers:
  - url: https://gbox.ai/api/v1
    description: Production Server
security: []
tags: []
paths:
  /boxes/{boxId}/storage/presigned-url:
    post:
      tags:
        - Box
      summary: Create presigned url
      description: >-
        Create a presigned url for a storage key. This endpoint provides a
        presigned url for a storage key, which can be used to download the file
        from the storage.
      operationId: BoxMiscController_createPresignedUrl
      parameters:
        - name: boxId
          required: true
          in: path
          description: Box ID
          schema:
            example: c9bdc193-b54b-4ddb-a035-5ac0c598d32d
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BoxStoragePresignedUrl'
      responses:
        '201':
          description: Presigned url
          content:
            application/json:
              schema:
                type: string
      security:
        - bearer: []
      x-codeSamples:
        - lang: JavaScript
          source: "import GboxSDK from \"gbox-sdk\";\n\nconst gboxSDK = new GboxSDK({\n  apiKey: process.env[\"GBOX_API_KEY\"] // This is the default and can be omitted\n});\n\nasync function main() {\n  const box = await gboxSDK.create({ type: \"android\" });\n\n\tconst screenshotResult = await box.action.screenshot({\n\t\toutputFormat: \"storageKey\"\n\t});\n\n\tconsole.info(\"Screenshot result:\", screenshotResult);\n\n  // re-create presigned url\n\tconst presignedUrl = await box.storage.createPresignedUrl(\n    { storageKey: screenshotResult.uri }\n  );\n\n  console.log(\"Presigned url:\", presignedUrl);\n}\n\nmain();"
        - lang: Python
          source: |-
            import os
            from gbox_sdk import GboxSDK

            gbox_sdk = GboxSDK(
                api_key=os.environ["GBOX_API_KEY"]  # This is the default and can be omitted
            )

            # Create Android box
            box = gbox_sdk.create(type="android")

            screenshot_result = box.action.screenshot(
                output_format="storageKey"
            )

            print(f"Screenshot result: {screenshot_result}")

            # re-create presigned url
            presigned_url = box.storage.create_presigned_url(
                storage_key=screenshot_result.uri
            )

            print(f"Presigned url: {presigned_url}")
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\t\"github.com/gbox/gbox-sdk-go\"\n)\n\nfunc main() {\n\tgboxSDK := gbox.NewGboxSDK(\n\t\tos.Getenv(\"GBOX_API_KEY\"), // This is the default and can be omitted\n\t)\n\n\t// Create Android box\n\tbox, err := gboxSDK.Create(\n\t\tcontext.Background(),\n\t\tgbox.CreateRequest{Type: \"android\"},\n\t)\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to create box: %v\", err)\n\t}\n\n\tscreenshotResult, err := box.Action.Screenshot(\n\t\tcontext.Background(),\n\t\tgbox.ScreenshotRequest{\n\t\t\tOutputFormat: \"storageKey\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to take screenshot: %v\", err)\n\t}\n\n\tfmt.Printf(\"Screenshot result: %+v\\n\", screenshotResult)\n\n\t// re-create presigned url\n\tpresignedUrl, err := box.Storage.CreatePresignedUrl(\n\t\tcontext.Background(),\n\t\tgbox.CreatePresignedUrlRequest{\n\t\t\tStorageKey: screenshotResult.Uri,\n\t\t},\n\t)\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to create presigned url: %v\", err)\n\t}\n\n\tfmt.Printf(\"Presigned url: %s\\n\", presignedUrl)\n}"
components:
  schemas:
    BoxStoragePresignedUrl:
      type: object
      properties:
        expiresIn:
          type: string
          description: >-
            Presigned url expires in


            Supported time units: ms (milliseconds), s (seconds), m (minutes), h
            (hours)

            Example formats: "500ms", "30s", "5m", "1h"

            Default: 30m

            Maximum allowed: 6h
          example: 30m
          default: 30m
          title: PresignedExpiresIn
        storageKey:
          type: string
          description: Storage key
          title: StorageKey
          example: storage://xxxxxx/xxxxxx/xxxxxxx
      title: Box Storage Presigned Url
      description: Box Storage Presigned Url
      required:
        - storageKey
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      type: http
      description: >-
        Enter your API Key in the format: Bearer <token>. Get it from
        https://gbox.ai

````