How do I upload a file with the API?

Uploading a file is one of the most common questions asked so you are not alone!

We have two approaches:

Regardless of which version you use, each will give you back a ref id in the response. You use this ID to attach the file to an object (task, comment). So the reference id you get back in the first call you pass into the final call.

If your call is successful you will get a ‘ref’ field in the response. That is the first part done!

"ref": "tf_231A6C68-FED4-4D2F-A048A74FA5E88DD5"

The last step is just attaching that file to a project or so on. You have the option to send in that ref id in several different calls. These calls include:

  • Adding a task
  • Updating a task
  • Adding a sub task
  • Updating a sub task
  • Adding a comment
  • Updating a comment
  • Create a message
  • Updating a message
  • Adding a file to a task

You will find all these calls in the reference section of this site. The parameter name is ‘pendingFileAttachments’. You need the id from step one to pass in here.

Feedback

If you have any feedback or suggestions, feel free to contact us at api@teamwork.com.