feat: adds docs for s3 compatible storage (#6538)

Co-authored-by: Matthias Nannt <mail@matthiasnannt.com>
This commit is contained in:
Anshuman Pandey
2025-09-15 13:04:46 +05:30
committed by GitHub
parent 41798266a0
commit 717adddeae
11 changed files with 399 additions and 222 deletions
+17 -188
View File
@@ -5675,7 +5675,7 @@
},
"/api/v1/management/storage": {
"post": {
"description": "API endpoint for uploading public files. Uploaded files are public and accessible by anyone. This endpoint requires authentication. It accepts a JSON body with fileName, fileType, environmentId, and optionally allowedFileExtensions to restrict file types. On success, it returns a signed URL for uploading the file to S3 along with a local upload URL.",
"description": "API endpoint for uploading public files. Uploaded files are public and accessible by anyone. This endpoint requires authentication. It accepts a JSON body with fileName, fileType, environmentId, and optionally allowedFileExtensions to restrict file types. On success, it returns a signed URL for uploading the file to S3.",
"parameters": [
{
"example": "{{apiKey}}",
@@ -5732,8 +5732,15 @@
"example": {
"data": {
"fileUrl": "http://localhost:3000/storage/cm1ubebtj000614kqe4hs3c67/public/profile--fid--abc123.png",
"localUrl": "http://localhost:3000/storage/cm1ubebtj000614kqe4hs3c67/public/profile.png",
"signedUrl": "http://localhost:3000/api/v1/client/cm1ubebtj000614kqe4hs3c67/storage/public",
"presignedFields": {
"Policy": "base64EncodedPolicy",
"X-Amz-Algorithm": "AWS4-HMAC-SHA256",
"X-Amz-Credential": "your-credential",
"X-Amz-Date": "20250312T000000Z",
"X-Amz-Signature": "your-signature",
"key": "uploads/public/profile--fid--abc123.png"
},
"signedUrl": "https://s3.example.com/your-bucket",
"updatedFileName": "profile--fid--abc123.png"
}
},
@@ -5745,9 +5752,12 @@
"description": "URL where the uploaded file can be accessed.",
"type": "string"
},
"localUrl": {
"description": "URL for uploading the file to local storage.",
"type": "string"
"presignedFields": {
"additionalProperties": {
"type": "string"
},
"description": "Form fields to include in the multipart/form-data POST to S3.",
"type": "object"
},
"signedUrl": {
"description": "Signed URL for uploading the file to S3.",
@@ -5765,7 +5775,7 @@
}
}
},
"description": "OK - Returns the signed URL, updated file name, and file URL."
"description": "OK - Returns the signed URL, presigned fields, updated file name, and file URL."
},
"400": {
"content": {
@@ -5829,187 +5839,6 @@
"tags": ["Management API - Storage"]
}
},
"/api/v1/management/storage/local": {
"post": {
"description": "Management API endpoint for uploading public files to local storage. This endpoint requires authentication. File metadata is provided via headers (X-File-Type, X-File-Name, X-Environment-ID, X-Signature, X-UUID, X-Timestamp) and the file is provided as a multipart/form-data file field named \"file\". The \"Content-Type\" header must be set to a valid MIME type.",
"parameters": [
{
"example": "{{apiKey}}",
"in": "header",
"name": "x-api-key",
"required": true,
"schema": {
"type": "string"
}
},
{
"description": "MIME type of the file. Must be a valid MIME type.",
"in": "header",
"name": "X-File-Type",
"required": true,
"schema": {
"type": "string"
}
},
{
"description": "URI encoded file name.",
"in": "header",
"name": "X-File-Name",
"required": true,
"schema": {
"type": "string"
}
},
{
"description": "ID of the environment.",
"in": "header",
"name": "X-Environment-ID",
"required": true,
"schema": {
"type": "string"
}
},
{
"description": "Signature for verifying the request.",
"in": "header",
"name": "X-Signature",
"required": true,
"schema": {
"type": "string"
}
},
{
"description": "Unique identifier for the signed upload.",
"in": "header",
"name": "X-UUID",
"required": true,
"schema": {
"type": "string"
}
},
{
"description": "Timestamp used for the signature.",
"in": "header",
"name": "X-Timestamp",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"multipart/form-data": {
"schema": {
"properties": {
"file": {
"description": "The file to be uploaded as a valid file object (buffer).",
"format": "binary",
"type": "string"
}
},
"required": ["file"],
"type": "object"
}
}
},
"required": true
},
"responses": {
"200": {
"content": {
"application/json": {
"example": {
"data": {
"message": "File uploaded successfully"
}
},
"schema": {
"properties": {
"data": {
"properties": {
"message": {
"description": "Success message.",
"type": "string"
}
},
"type": "object"
}
},
"type": "object"
}
}
},
"description": "OK - File uploaded successfully."
},
"400": {
"content": {
"application/json": {
"example": {
"error": "fileType is required"
},
"schema": {
"properties": {
"error": {
"description": "Detailed error message.",
"type": "string"
}
},
"type": "object"
}
}
},
"description": "Bad Request - Missing required fields, invalid header values, or file issues."
},
"401": {
"content": {
"application/json": {
"example": {
"error": "Not authenticated"
},
"schema": {
"properties": {
"error": {
"description": "Detailed error message.",
"type": "string"
}
},
"type": "object"
}
}
},
"description": "Unauthorized - Authentication failed, invalid signature, or user not authorized."
},
"500": {
"content": {
"application/json": {
"example": {
"error": "File upload failed"
},
"schema": {
"properties": {
"error": {
"description": "Detailed error message.",
"type": "string"
}
},
"type": "object"
}
}
},
"description": "Internal Server Error - File upload failed due to server error."
}
},
"servers": [
{
"description": "Formbricks API Server",
"url": "https://app.formbricks.com/api/v1"
}
],
"summary": "Upload Public File to Local Storage",
"tags": ["Management API - Storage"]
}
},
"/api/v1/management/surveys": {
"get": {
"description": "Fetches all existing surveys",