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

# Upload an asset

> Uploads a file and creates an asset. An asset is a stored file that you can
reference by ID elsewhere in the API.

For example, to attach a file to an invoice, upload it using this endpoint and
pass the returned `id` in `attachmentAssetIds` when calling **Create an invoice**
or **Patch an invoice**.

## Sending the file

Send a `multipart/form-data` request containing one part named `file`.

The filename must use a supported extension, and the file part must have a
supported `Content-Type`. We derive the asset's `format` and `type` from the file
part's `Content-Type`, not from its filename extension.

The request must include a `Content-Length` header indicating the size of the
multipart request body, in bytes. It must not exceed 10 MiB (10,485,760 bytes).

### Images

- `jpg` or `jpeg` with a `Content-Type` of `image/jpeg`
- `png` with a `Content-Type` of `image/png`

Image files may be re-encoded to remove metadata.

### Documents

- `pdf` with a `Content-Type` of `application/pdf`

### Binary files

- `csv` with a `Content-Type` of `text/csv`
- `txt` with a `Content-Type` of `text/plain`
- `md` with a `Content-Type` of `text/markdown`
- `rtf` with a `Content-Type` of `application/rtf`
- `doc` with a `Content-Type` of `application/msword`
- `docx` with a `Content-Type` of
  `application/vnd.openxmlformats-officedocument.wordprocessingml.document`
- `xls` with a `Content-Type` of `application/vnd.ms-excel`
- `xlsx` with a `Content-Type` of
  `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`
- `xlsm` with a `Content-Type` of `application/vnd.ms-excel.sheet.macroEnabled.12`
- `odt` with a `Content-Type` of `application/vnd.oasis.opendocument.text`
- `ods` with a `Content-Type` of `application/vnd.oasis.opendocument.spreadsheet`
- `zip` with a `Content-Type` of `application/zip`



## OpenAPI

````yaml orchestra.latest.product.live POST /assets
openapi: 3.0.0
info:
  title: Orchestra
  description: Manage bulk actions and assets
  version: '0.1'
servers:
  - url: https://dev.seqhq.io/api
    description: DEV
  - url: https://sandbox.sequencehq.com/api
    description: SANDBOX
  - url: https://eu.sequencehq.com/api
    description: PRODUCTION
security: []
tags: []
paths:
  /assets:
    servers: []
    parameters: []
    post:
      tags:
        - Assets
      summary: Upload an asset
      description: >-
        Uploads a file and creates an asset. An asset is a stored file that you
        can

        reference by ID elsewhere in the API.


        For example, to attach a file to an invoice, upload it using this
        endpoint and

        pass the returned `id` in `attachmentAssetIds` when calling **Create an
        invoice**

        or **Patch an invoice**.


        ## Sending the file


        Send a `multipart/form-data` request containing one part named `file`.


        The filename must use a supported extension, and the file part must have
        a

        supported `Content-Type`. We derive the asset's `format` and `type` from
        the file

        part's `Content-Type`, not from its filename extension.


        The request must include a `Content-Length` header indicating the size
        of the

        multipart request body, in bytes. It must not exceed 10 MiB (10,485,760
        bytes).


        ### Images


        - `jpg` or `jpeg` with a `Content-Type` of `image/jpeg`

        - `png` with a `Content-Type` of `image/png`


        Image files may be re-encoded to remove metadata.


        ### Documents


        - `pdf` with a `Content-Type` of `application/pdf`


        ### Binary files


        - `csv` with a `Content-Type` of `text/csv`

        - `txt` with a `Content-Type` of `text/plain`

        - `md` with a `Content-Type` of `text/markdown`

        - `rtf` with a `Content-Type` of `application/rtf`

        - `doc` with a `Content-Type` of `application/msword`

        - `docx` with a `Content-Type` of
          `application/vnd.openxmlformats-officedocument.wordprocessingml.document`
        - `xls` with a `Content-Type` of `application/vnd.ms-excel`

        - `xlsx` with a `Content-Type` of
          `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`
        - `xlsm` with a `Content-Type` of
        `application/vnd.ms-excel.sheet.macroEnabled.12`

        - `odt` with a `Content-Type` of
        `application/vnd.oasis.opendocument.text`

        - `ods` with a `Content-Type` of
        `application/vnd.oasis.opendocument.spreadsheet`

        - `zip` with a `Content-Type` of `application/zip`
      operationId: postAssets
      parameters:
        - name: Authorization
          in: header
          description: >-
            Your [API credentials](/reference/authentication). Eg. `Basic
            {credentials}`.
          required: true
          schema:
            type: string
        - name: Content-Length
          in: header
          required: true
          schema:
            type: integer
        - name: Sequence-Version
          in: header
          description: Use this header to select an API version
          required: false
          schema:
            type: string
            enum:
              - '2024-07-30'
      requestBody:
        content:
          multipart/form-data:
            schema:
              required:
                - file
              type: object
              properties:
                file:
                  type: string
                  format: binary
        required: true
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AssetResponse'
                example:
                  id: e007e884-5100-4183-8355-4771865cb4dd
                  createdBy: 94703530-1293-479b-bd37-ccad42fd9c8b
                  createdByType: SEQUENCE_USER
                  type: IMAGE
                  format: PNG
                  fileName: my-image.png
                  fileSizeBytes: 12345
                  url: >-
                    https://assets.sequencehq.com/1986c663-9ee9-4811-bfbf-57d2ad666096/images/e007e884-5100-4183-8355-4771865cb4dd.png?token=grhc3VtaoNLAifDBFXWYLHcNnK3XJHzFjZ4iMf78Ozg&expires=604800
                  createdAt: '2023-11-27T12:00:00Z'
              examples:
                AssetResponse:
                  summary: ''
                  value:
                    id: e007e884-5100-4183-8355-4771865cb4dd
                    createdBy: 94703530-1293-479b-bd37-ccad42fd9c8b
                    createdByType: SEQUENCE_USER
                    type: IMAGE
                    format: PNG
                    fileName: my-image.png
                    fileSizeBytes: 12345
                    url: >-
                      https://assets.sequencehq.com/1986c663-9ee9-4811-bfbf-57d2ad666096/images/e007e884-5100-4183-8355-4771865cb4dd.png?token=grhc3VtaoNLAifDBFXWYLHcNnK3XJHzFjZ4iMf78Ozg&expires=604800
                    createdAt: '2023-11-27T12:00:00Z'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
                example:
                  error:
                    type: error
                    message: >-
                      Endpoint should only be accessed by a Sequence user or an
                      API key
              examples:
                ApiError:
                  summary: ''
                  value:
                    error:
                      type: error
                      message: >-
                        Endpoint should only be accessed by a Sequence user or
                        an API key
        '401':
          description: Unauthorized
          content: {}
        '500':
          description: Internal Server Error
          content: {}
components:
  schemas:
    AssetResponse:
      required:
        - createdAt
        - createdBy
        - createdByType
        - fileName
        - fileSizeBytes
        - format
        - id
        - type
        - url
      type: object
      example:
        id: e007e884-5100-4183-8355-4771865cb4dd
        createdBy: 94703530-1293-479b-bd37-ccad42fd9c8b
        createdByType: SEQUENCE_USER
        type: IMAGE
        format: PNG
        fileName: my-image.png
        fileSizeBytes: 12345
        url: >-
          https://assets.sequencehq.com/1986c663-9ee9-4811-bfbf-57d2ad666096/images/e007e884-5100-4183-8355-4771865cb4dd.png?token=grhc3VtaoNLAifDBFXWYLHcNnK3XJHzFjZ4iMf78Ozg&expires=604800
        createdAt: '2023-11-27T12:00:00Z'
      properties:
        id:
          type: string
          description: Unique ID for this asset.
          example: e007e884-5100-4183-8355-4771865cb4dd
        createdBy:
          type: string
          description: >-
            The ID of the asset creator. A Sequence user id or API key id, as
            identified by `createdByType`.
          example: 94703530-1293-479b-bd37-ccad42fd9c8b
        createdByType:
          $ref: '#/components/schemas/AssetCreatorType'
          description: Whether `createdBy` identifies a `SEQUENCE_USER` or an `API_CLIENT`.
        type:
          $ref: '#/components/schemas/AssetType'
          description: Classification of this asset as `IMAGE`, `DOCUMENT`, or `BINARY`.
        format:
          $ref: '#/components/schemas/AssetFormat'
          description: >-
            File format of this asset. For uploaded assets, this value is
            derived from the `Content-Type` of the `file` part.
        fileName:
          type: string
          description: Original filename provided when the asset was uploaded.
          example: my-image.png
        fileSizeBytes:
          type: integer
          description: >-
            Size of the stored file, in bytes. This may differ from the size of
            the uploaded file.
          format: int32
          example: 12345
        url:
          type: string
          description: >-
            Signed URL for downloading the file. The URL expires one week after
            it is generated. Call **Get an asset** when you need a new URL.
          example: >-
            https://assets.sequencehq.com/1986c663-9ee9-4811-bfbf-57d2ad666096/images/e007e884-5100-4183-8355-4771865cb4dd.png?token=grhc3VtaoNLAifDBFXWYLHcNnK3XJHzFjZ4iMf78Ozg&expires=604800
        createdAt:
          type: string
          description: >-
            The time at which this asset was created. Formatted as an ISO 8601
            timestamp.
          example: '2023-11-27T12:00:00Z'
    ApiError:
      required:
        - error
      type: object
      example:
        error:
          type: error
          message: Endpoint should only be accessed by a Sequence user or an API key
      properties:
        error:
          $ref: '#/components/schemas/ErrorObject'
    AssetCreatorType:
      type: string
      example: SEQUENCE_USER
      enum:
        - SEQUENCE_USER
        - API_CLIENT
    AssetType:
      type: string
      example: IMAGE
      enum:
        - IMAGE
        - DOCUMENT
        - BINARY
    AssetFormat:
      type: string
      example: PNG
      enum:
        - JPEG
        - JPG
        - PNG
        - PDF
        - CSV
        - TXT
        - RTF
        - MD
        - XLS
        - XLSX
        - XLSM
        - DOC
        - DOCX
        - ZIP
        - ODT
        - ODS
    ErrorObject:
      required:
        - message
        - type
      type: object
      description: Top level wrapper for all errors
      example:
        type: error
        message: Endpoint should only be accessed by a Sequence user or an API key
      properties:
        type:
          type: string
          description: Type of the error
          example: error
        message:
          type: string
          description: Plain text description of the error
          example: Endpoint should only be accessed by a Sequence user or an API key

````