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

# Create an upload

> Request a pre-signed URL to upload an image asset.

Request a pre-signed URL to upload an image asset. Upload the file with an HTTP `PUT` to the returned `presignedUrl` (sending the same `Content-Type` and `Content-Length`), then call [Complete an upload](/docs/api-reference/complete-upload) to finalize the asset.


## OpenAPI

````yaml /openapi.json post /v1/uploads
openapi: 3.1.0
info:
  title: Loops OpenAPI Spec
  description: This is the OpenAPI Spec for the [Loops API](https://loops.so/docs/api).
  version: 1.21.0
servers:
  - url: https://app.loops.so/api
security: []
tags:
  - name: API key
  - name: Audience segments
    description: View audience segments
  - name: Campaigns
    description: Create and manage email campaigns
  - name: Campaign groups
    description: Organize campaigns into groups
  - name: Components
    description: View email components
  - name: Configuration
    description: View configuration settings
  - name: Contacts
    description: Manage contacts in your audience
  - name: Contact properties
    description: Manage contact properties
  - name: Email messages
    description: Manage email message content for campaigns
  - name: Events
    description: Trigger workflows with events
  - name: Event patterns
    description: View workflow event patterns
  - name: Mailing lists
    description: View mailing lists
  - name: Themes
    description: View email themes
  - name: Transactional emails
    description: Create, manage, and send transactional emails
  - name: Transactional groups
    description: Organize transactional emails into groups
  - name: Uploads
    description: Upload image assets
  - name: Workflows
    description: View and mutate workflow graphs
  - name: Workflow nodes
    description: View and mutate workflow nodes
paths:
  /v1/uploads:
    post:
      tags:
        - Uploads
      summary: Create an upload
      description: >-
        Request a pre-signed URL to upload an image asset. Upload the file with
        an HTTP `PUT` to the returned `presignedUrl` (sending the same
        `Content-Type` and `Content-Length`), then call
        `/uploads/{emailAssetId}/complete` to finalize the asset.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateUploadRequest'
      responses:
        '200':
          description: Pre-signed upload URL created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateUploadResponse'
        '400':
          description: Invalid request body or unsupported `contentType`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UploadFailureResponse'
        '401':
          description: Invalid API key or content API not enabled for this team.
        '405':
          description: Wrong HTTP request method.
        '413':
          description: Upload exceeds the maximum allowed size.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UploadFailureResponse'
      security:
        - apiKey: []
components:
  schemas:
    CreateUploadRequest:
      type: object
      properties:
        contentType:
          type: string
          description: >-
            The MIME type of the file to upload. Supported types are
            `image/jpeg`, `image/png`, `image/gif` and `image/webp`.
          examples:
            - image/png
        contentLength:
          type: integer
          description: >-
            The size of the file in bytes. Must be a positive integer no greater
            than 4,000,000 bytes.
          examples:
            - 102400
      required:
        - contentType
        - contentLength
      additionalProperties: false
    CreateUploadResponse:
      type: object
      properties:
        emailAssetId:
          type: string
          description: >-
            The ID of the created asset. Pass this as `emailAssetId` to `POST
            /v1/uploads/{emailAssetId}/complete` once the file has been
            uploaded.
        presignedUrl:
          type: string
          description: >-
            The pre-signed URL to upload the file to with an HTTP `PUT` request.
            Send the same `Content-Type` and `Content-Length` used in the create
            request.
      required:
        - emailAssetId
        - presignedUrl
    UploadFailureResponse:
      type: object
      properties:
        message:
          type: string
        supportedContentTypes:
          type: array
          description: >-
            Present when the request was rejected for an unsupported
            `contentType`. Lists the accepted MIME types.
          items:
            type: string
        maxBytes:
          type: integer
          description: >-
            Present when the upload exceeds the size limit. The maximum allowed
            size in bytes.
      required:
        - message
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer

````

## Related topics

- [API Introduction](/docs/api-reference/intro.md)
- [Campaigns API examples](/docs/api-reference/examples/campaigns.md)
- [Transactional email API examples](/docs/api-reference/examples/transactional-emails.md)
- [Uploads](/docs/cli/uploads.md)
- [Complete an upload](/docs/api-reference/complete-upload.md)
