Uploading an attachment is a three-step process:
- Request an upload URL for each file.
- Upload the file to the returned URL.
- Include the returned
fileId in the
attachments array when creating a
task,
comment or
reply.
Step 1: Request upload URLs
Request a temporary upload URL for each file.
/attachments/upload-urls
Parameters
| Name |
Required |
Type/Format |
Description |
| files |
yes |
Array |
Array of file objects, e.g. {"name": "photo.png"}. Up to 20 files per request. |
Sample CURL →
curl -X POST
https://api.goodday.work/2.0/attachments/upload-urls
-H "Content-Type: application/json"
-H "gd-api-token: AUTH-TOKEN"
-d '{
"files": [
{ "name": "spec.pdf" },
{ "name": "screenshot.png" }
]
}'
Response
Sample response →
[
{
"fileId": "FILE-ID",
"name": "spec.pdf",
"uploadUrl": "https://...",
"mime": "application/pdf"
},
{
"fileId": "FILE-ID",
"name": "screenshot.png",
"uploadUrl": "https://...",
"mime": "image/png"
}
]
Each returned object contains:
uploadUrl - temporary URL used to upload the file.
fileId - identifier used later in the attachments array.
mime - content type to use when uploading the file.
Requesting an upload URL does not attach the file to anything. It only
reserves temporary storage and returns the fileId to reference later.
Step 2: Upload the file
Upload each file with a separate PUT request to its
uploadUrl. Set the Content-Type header to the
returned mime value.
Sample CURL →
curl -X PUT "UPLOAD-URL"
-H "Content-Type: image/png"
--data-binary @screenshot.png
A successful upload returns HTTP 200 with an empty response body.
If the Content-Type header is omitted, the upload still
succeeds, but image preview thumbnails are not generated.
The upload URL expires after one hour and can be used only once.
Step 3: Reference the uploaded file
Once you receive the fileID, you can attach one or more files to a task, message, or document by providing an array of attachments in the following format:
[
{
"fileId": "FILE-ID",
"name": "spec.pdf",
"size": 24576,
"mime": "application/pdf"
}
]
While filesize and MimeType are optional we highly recommend to pass this correct data for best user experience.
Fields
| Name |
Required |
Type/Format |
Description |
| fileId |
yes |
String |
Identifier returned by the upload URL request |
| name |
yes |
String |
File name, maximum 255 characters |
| size |
no |
Integer |
File size in bytes |
| mime |
no |
String |
MIME type, i.e. image/png. If omitted, it is inferred from the file name |
Up to 20 files can be attached in a single request.
If a fileId was never uploaded, or its upload URL expired
before the upload completed, the request still succeeds. The invalid
attachment is simply ignored.