Skip to main content

Uploads

File upload via presigned URLs (Cloudflare R2). Requires authentication.

POST /uploads/presign

Get a presigned URL to upload a file.

curl -X POST https://api.paylinks.ro/api/v1/uploads/presign \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"filename": "product.pdf", "contentType": "application/pdf"}'

Request Body:

FieldTypeRequiredDescription
filenamestringYesFile name
contentTypestringYesMIME type (e.g., application/pdf, image/png)

Response (200):

{
"uploadUrl": "https://r2.paylinks.ro/presigned-upload-url...",
"fileUrl": "https://files.paylinks.ro/uploads/abc123/product.pdf"
}

Upload Flow

  1. Call POST /uploads/presign to get a presigned URL
  2. PUT the file contents to the uploadUrl
  3. Use the fileUrl in paylink fields (imageUrl, fileUrl)
# Step 2: Upload the file
curl -X PUT "https://r2.paylinks.ro/presigned-upload-url..." \
-H "Content-Type: application/pdf" \
--data-binary @product.pdf