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

# Create an upload url

> Get a presigned url to upload a file.



## OpenAPI

````yaml post /storage/presigned-url
openapi: 3.0.3
info:
  contact:
    email: support@openlayer.com
    name: Openlayer
    url: https://openlayer.com/
  description: API for interacting with the Openlayer server.
  title: Openlayer API
  version: '1.0'
  x-logo:
    url: https://logo.clearbit.com/openlayer.com
servers:
  - url: https://api.openlayer.com/v1
    description: Our prod backend
security:
  - bearerAuth: []
paths:
  /storage/presigned-url:
    post:
      tags:
        - Storage
      summary: Create an upload url
      description: Get a presigned url to upload a file.
      parameters:
        - name: objectName
          in: query
          required: true
          description: The name of the object.
          schema:
            type: string
      responses:
        '200':
          description: Response OK.
          content:
            application/json:
              schema:
                type: object
                required:
                  - url
                  - storageUri
                properties:
                  url:
                    description: The presigned url.
                    type: string
                    format: url
                  fields:
                    description: >-
                      Fields to include in the body of the upload. Only needed
                      by s3
                    type: object
                  storageUri:
                    description: >-
                      The storage URI to send back to the backend after the
                      upload was completed.
                    type: string
        default:
          $ref: '#/components/responses/UnexpectedError'
      x-codeSamples:
        - lang: python
          source: |
            from openlayer import Openlayer

            client = Openlayer()

            presigned_url = client.storage.presigned_url.create(
                object_name="policy.pdf",
            )
            print(presigned_url.url, presigned_url.storage_uri)
        - lang: typescript
          source: |
            import Openlayer from 'openlayer';

            const client = new Openlayer();

            const presignedURL = await client.storage.presignedURL.create({
              objectName: 'report.pdf',
            });

            console.log(presignedURL.url, presignedURL.storageUri);
        - lang: go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openlayer-ai/openlayer-go\"\n)\n\nclient := openlayer.NewClient()\npresigned, err := client.Storage.PresignedURL.New(context.TODO(), openlayer.StoragePresignedURLNewParams{\n\tObjectName: openlayer.F(\"commit.tar.gz\"),\n})\nif err != nil {\n\tpanic(err.Error())\n}\nfmt.Printf(\"%+v\\n\", presigned.StorageUri)\n"
        - lang: java
          source: >
            import com.openlayer.api.client.OpenlayerClient;

            import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient;

            import
            com.openlayer.api.models.storage.presignedurl.PresignedUrlCreateParams;

            import
            com.openlayer.api.models.storage.presignedurl.PresignedUrlCreateResponse;


            OpenlayerClient client = OpenlayerOkHttpClient.fromEnv();


            PresignedUrlCreateParams params = PresignedUrlCreateParams.builder()
                .objectName("model_package.tar.gz")
                .build();
            PresignedUrlCreateResponse presignedUrl =
            client.storage().presignedUrl().create(params);
        - lang: ruby
          source: >
            require "openlayer"


            openlayer = Openlayer::Client.new(api_key: ENV["OPENLAYER_API_KEY"])


            presigned_url = openlayer.storage.presigned_url.create(object_name:
            "bundle.tar.gz")


            puts(presigned_url.url)

            puts(presigned_url.storage_uri)
        - lang: curl
          source: |
            curl --request POST \
              --url 'https://api.openlayer.com/v1/storage/presigned-url?objectName=dataset.csv' \
              --header 'Authorization: Bearer <token>'
components:
  responses:
    UnexpectedError:
      description: Unexpected error.
      content:
        application/json:
          schema:
            type: object
            required:
              - code
              - error
            properties:
              code:
                type: integer
                format: int32
              error:
                type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >
        Bearer authentication header of the form `Bearer <token>`, where
        `<token>` is your workspace API key. See [Find your API
        key](https://www.openlayer.com/docs/workspace-and-projects/find-your-api-key)
        for more information.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.