Prepare document upload (user)
On this page
GraphQL endpoint: /user
Reserves space in the calling user's document repository and returns a presigned POST policy to upload the file with. The reservation holds the declared bytes against the quota but stays invisible until confirmDocumentUpload claims it; an upload that never completes is reclaimed by the sweeper.
Query
mutation ($fileName: String!, $contentType: String!, $byteSize: String!) {
prepareDocumentUpload(fileName: $fileName, contentType: $contentType, byteSize: $byteSize) {
documentId
url
fields
}
}
Variables
{
"byteSize": "1024",
"contentType": "application/pdf",
"fileName": "invoice.pdf"
}
Response
{
"data": {
"prepareDocumentUpload": {
"documentId": "00000000-0000-4000-8000-000000000001",
"fields": {
"Content-Type": "application/pdf",
"Policy": "eyJjb25kaXRpb25zIjpbeyJYLUFtei1BbGdvcml0aG0iOiJBV1M0LUhNQUMtU0hBMjU2In0seyJYLUFtei1DcmVkZW50aWFsIjoiU09NRV9SQU5ET01fQUNDRVNTX0tFWS8yMDI2MDkyMy91cy1lYXN0LTEvczMvYXdzNF9yZXF1ZXN0In0seyJYLUFtei1EYXRlIjoiMjAyNjA5MjNUMDMyMDM5WiJ9LHsiYnVja2V0IjoidG5pZC12Mi1kb2N1bWVudHMtbG9jYWwifSx7ImtleSI6InVzZXIvN2Q0ZmQ3N2MtN2ExNC00N2EwLWI2MWYtZWNhNDM1MjQ0MGI2LzIwMjYtMDktMjNfNjRQRno2Ry1obW80X2ludm9pY2UucGRmIn0sWyJjb250ZW50LWxlbmd0aC1yYW5nZSIsMCwxMDI0XSxbImVxIiwiJENvbnRlbnQtVHlwZSIsImFwcGxpY2F0aW9uL3BkZiJdXSwiZXhwaXJhdGlvbiI6IjIwMjYtMDktMjNUMDM6MjU6MzkuNDk1MzcxWiJ9",
"X-Amz-Algorithm": "AWS4-HMAC-SHA256",
"X-Amz-Credential": "SOME_RANDOM_ACCESS_KEY/20260115/us-east-1/s3/aws4_request",
"X-Amz-Date": "20260115T090000Z",
"X-Amz-Signature": "45152115a9f6130fe2f8fadb9f74099ba0c97ac8cc81e222258a83c44d653d7a",
"key": "user/00000000-0000-4000-8000-000000000002/2026-09-23_64PFz6G-hmo4_invoice.pdf"
},
"url": "http://localhost:4566/tnid-v2-documents-local"
}
}
}