Skip to main content
POST
/
files
/
provider
/
{provider}
/
upload
curl -X POST "https://api.tktchurch.com/v1/files/provider/s3/upload" \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \
  -H "Content-Type: image/jpeg" \
  -H "Content-Disposition: attachment; filename=\"example.jpg\"" \
  --data-binary "@/path/to/example.jpg"
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "originalName": "example.jpg",
  "url": "https://storage.example.com/uploads/abc123.jpg",
  "key": "uploads/abc123.jpg",
  "contentType": "image/jpeg",
  "size": 1048576,
  "provider": "s3",
  "providerMetadata": {
    "bucket": "my-bucket",
    "region": "us-east-1"
  },
  "uploadedBy": "123e4567-e89b-12d3-a456-426614174001",
  "createdAt": "2024-01-20T15:00:00Z",
  "updatedAt": "2024-01-20T15:00:00Z"
}
This endpoint requires authentication and the uploadFiles permission. The maximum file size is 10MB.

Path Parameters

provider
string
required
The storage provider to use. One of:
  • s3: Amazon S3 storage
  • local: Local file storage

Request Headers

Content-Type
string
required
The MIME type of the file being uploaded
Content-Disposition
string
required
Must include the filename parameter, e.g. attachment; filename="example.jpg"

Request Body

The request body should contain the raw file data.

Response

id
string
File’s unique identifier (UUID)
originalName
string
Original filename
url
string
URL to access the file
key
string
Storage key/path of the file
contentType
string
MIME type of the file
size
integer
File size in bytes
provider
string
Storage provider used (s3 or local)
providerMetadata
object
Provider-specific metadata
uploadedBy
string
UUID of the user who uploaded the file
createdAt
string
Upload timestamp in ISO 8601 format
updatedAt
string
Last update timestamp in ISO 8601 format

Error Responses

error
object
Error details when the request fails
Common error cases:
  • 400 Bad Request: Invalid provider or missing filename
  • 401 Unauthorized: Missing or invalid access token
  • 403 Forbidden: Missing required permission
  • 413 Payload Too Large: File exceeds size limit
curl -X POST "https://api.tktchurch.com/v1/files/provider/s3/upload" \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \
  -H "Content-Type: image/jpeg" \
  -H "Content-Disposition: attachment; filename=\"example.jpg\"" \
  --data-binary "@/path/to/example.jpg"
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "originalName": "example.jpg",
  "url": "https://storage.example.com/uploads/abc123.jpg",
  "key": "uploads/abc123.jpg",
  "contentType": "image/jpeg",
  "size": 1048576,
  "provider": "s3",
  "providerMetadata": {
    "bucket": "my-bucket",
    "region": "us-east-1"
  },
  "uploadedBy": "123e4567-e89b-12d3-a456-426614174001",
  "createdAt": "2024-01-20T15:00:00Z",
  "updatedAt": "2024-01-20T15:00:00Z"
}