---
title: "Generates a presigned url for an attachment upload"
method: POST
path: "/attachments/presigned-url"
tags: ["Attachments"]
---

# Generates a presigned url for an attachment upload

`POST /attachments/presigned-url`

The 1st step in the new attachment creation flow - a request to generate a presigned URL 
that the client can use to upload an attachment

## Request body

- WeightedAttachmentMetadata
  - `extension` string, required — An Attachment extension (e.g. png, jpg)
  - `source` string, required — A source identifier (service_request)
  - `resourceId` integer, required — The id of a resource, to which the attachment is added
  - `resourceType` 'SR' | 'TEMPLATE' | 'AI_CHAT' | 'AI_DATASET', required — The resource type tells to which resource the attachment is attached to. All SR types are mapped to SR.
  - `subResourceId` integer, required — The id of a subresource, to which the attachment is added
  - `subResourceType` 'TEMP' | 'SR' | 'NOTE' | 'MESSAGE' | 'SOLUTION' | 'RESOLUTION' | 'DESCRIPTION' | 'AI_CHAT_MESSAGE' | 'AI_DATASET_REC', required
  - `sizeInBytes` integer, required — Size of the added attachment is bytes
  - `checksum` string, required — The checksum that will be used for detecting an identical image in the same ticket of the same type

## Response `200`

Attachment presigned url is successfully generated

- GeneratePresignedUrlResponse
  - `path` string — Path under which the attachment will be stored (e.g. on S3)
  - `generatedFileName` string — Unique attachment file identifier
  - `presignedUrl` string, uri, required — A URL using which an attachment can be uploaded to the storage by a client

## Other responses

- `400` — The request was invalid or cannot be served
- `401` — Authentication information is missing or invalid

---

[API](https://skmtc.net/sysaid/apis/sysaid-public-api.md) · [All operations](https://skmtc.net/sysaid/apis/sysaid-public-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/sysaid/sysaid-public-api/revisions/38a43a1b2981/schema)
