Skip to content
Leadtime
English
Esc
navigateopen⌘Jpreview

Upload file to workspace

Uploads a file to the workspace and returns file metadata including a unique file ID and public URL. This endpoint is used for uploading various file types such as logos, avatars, documents, or custom icons. The uploaded file is associated with the workspace and can be referenced in other API endpoints using the returned file ID. The file is stored securely and a public URL is generated for accessing it. Common use cases include uploading workspace logos (for light and dark themes), user avatars, or custom icon images. The optional type parameter can be used to categorize the file (e.g., “logo”, “avatar”, “document”) for organizational purposes.

POST/workspace/upload
Authorization
AuthorizationOAuth2 access token · headerrequired
Scopes:api:write
or
AuthorizationBearer token (JWT) · headerrequired
Query parameters
fieldsToReturnstring
Comma-separated list of top-level response fields to return. Overrides the endpoint compact default unless responseShape=full is used.
responseShapestring
Advanced override. Omit for the endpoint compact default. Use full only when you need the complete endpoint response, including nested fields that are not selectable with fieldsToReturn.
Allowed:compactfull
Header parameters
LT-Response-Shapestring
Advanced override. Set to full only when you need the complete endpoint response, including nested fields that are not selectable with fieldsToReturn.
Allowed:full
Request body
requiredmultipart/form-data
filestringrequired
File to upload
typestring
File type/category (e.g., "logo", "avatar", "document")
Responses
200
filenamestringrequired
Original filename of the uploaded file as provided by the client. This is preserved for reference but may differ from the stored filename.
idstringrequired
Unique file identifier. Use this ID to reference the file in other API endpoints that accept file references (e.g., when setting workspace logos, user avatars, or custom icons).
mimetypestringrequired
MIME type of the uploaded file (e.g., "image/png", "image/jpeg", "image/svg+xml"). Indicates the file format and how it should be processed or displayed.
sizenumberrequired
File size in bytes. Use this to validate file size limits or display file size information to users.
urlstringrequired
Workspace-authenticated download URL. Public API clients must send the same Bearer token used for the upload request.
401Unauthorized - Invalid or missing authentication token
403Forbidden - Insufficient API scopes or permissions
Request
curl -X POST "https://leadtime.app/api/public/workspace/upload" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: multipart/form-data" \
  -d '{
  "file": "string",
  "type": "logo"
}'
Response
{
  "filename": "logo.png",
  "id": "file_123",
  "mimetype": "image/png",
  "size": 1024,
  "url": "https://app.example.com/api/public/workspace/files/file_123"
}