Overview
The S3 API provides secure file upload functionality using pre-signed URLs. This allows users to upload images and files directly to Amazon S3 without exposing credentials.All S3 endpoints require authentication. Include your Clerk JWT token in the
Authorization header.Generate Pre-Signed URL
Generate a pre-signed URL for uploading files to S3.Headers
Bearer token from Clerk authentication
Must be
application/jsonRequest Body
The type of file being uploaded. Determines the S3 folder structure.Common types:
profile- Profile images/avatarsrepo- Repository thumbnailscompany- Company logos (for experience)institution- Institution logos (for education)project- Project screenshots or images
The name of the file to upload, including extensionExamples:
avatar.jpgproject-screenshot.pngcompany-logo.svg
Response
success or errorHuman-readable status message
Pre-signed URL data
Example Request
Success Response
Status: 200 OKError Responses
Unauthorized
Status: 401 UnauthorizedMissing Parameters
Status: 400 Bad RequestURL Generation Failed
Status: 500 Internal Server ErrorServer Error
Status: 500 Internal Server ErrorUpload Flow
The complete file upload process involves two steps:Step 1: Get Pre-Signed URL
Request a pre-signed URL from the GitFolio API:Step 2: Upload File to S3
Use the pre-signed URL to upload the file directly to S3:Complete Upload Example
Here’s a complete example for uploading a profile image:File Types and Sizes
Supported File Types
The API supports common image formats:- Images:
.jpg,.jpeg,.png,.gif,.webp,.svg - Documents:
.pdf(for resumes, if supported)
File Size Limits
File Naming
Best practices for filenames:- Use descriptive names:
avatar.jpginstead ofimg123.jpg - Avoid special characters and spaces
- Include file extensions
- Use lowercase for consistency
S3 Folder Structure
Files are organized in S3 by user and type:type parameter determines which folder the file goes into.
Security Considerations
Pre-signed URL expiration
Pre-signed URL expiration
Pre-signed URLs expire after 5 minutes (300 seconds). If upload fails or takes too long:
- Request a new pre-signed URL
- Don’t cache or reuse expired URLs
- Implement retry logic with new URL generation
File validation
File validation
Always validate files before uploading:
- Check file type (MIME type)
- Verify file size
- Scan for malware if possible
- Validate image dimensions for images
User isolation
User isolation
Each user’s files are stored in their own folder:
- Users can only generate URLs for their own folder
- Files are namespaced by user ID
- No access to other users’ files
Public accessibility
Public accessibility
Uploaded files are publicly accessible:
- Anyone with the URL can view the file
- Don’t upload sensitive or private data
- Files are not encrypted at rest
- Consider using S3 lifecycle policies for deletion