TSGGLOBAL Support sign in
Skip to page content
Browse TNID API docs

TNID API documentation User Documents Prepare File Upload (User)

Prepare File Upload (User)

On this page

GraphQL endpoint: /user

Prepares a file upload for the calling user. Returns a presigned upload URL to PUT the file to and the file key to save; the key is randomized per request.

Query

mutation (
  $fileName: String!
  $contentType: String!
) {
  prepareFileUpload(
    fileName: $fileName
    contentType: $contentType
  ) {
    uploadUrl
    fileKey
  }
}

Variables

{
  "contentType": "image/jpeg",
  "fileName": "avatar.jpg"
}

Response

{
  "data": {
    "prepareFileUpload": {
      "fileKey": "user_uploads/2026-01-15_examplekey1_avatar.jpg",
      "uploadUrl": "http://localhost:4566/tnid-v2-uploads-local/user_uploads/2026-01-15_examplekey1_avatar.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=SOME_RANDOM_ACCESS_KEY%2F20260115%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20260115T090000Z&X-Amz-Expires=900&X-Amz-SignedHeaders=content-type%3Bhost&X-Amz-Signature=0000000000000000000000000000000000000000000000000000000000000000"
    }
  }
}