r/clickup•
kamilsj

Implementing Create Task Attachment with Python and requests

I am struggling to properly implement adding attachments to task through API. I've checked a lot of different configurations and none of them works. This is my implementation.

Do you have a working solution for this endpoint?

https://developer.clickup.com/reference/createtaskattachment

# files is na array of files 
data = {
    "attachment": files,
}


def add_attachment_to_task(self, data):
    header = {
        "Authorization": self.personal_access_token,
        "accept": "application/json",
        "content-type": "multipart/form-data",
    }
    response = requests.post(f"https://api.clickup.com/api/v2/task/{self.task_id}/attachment", headers=header, data=data)
    return response.text

Posted Jan 29, 2025, 11:27 AM UTC

04
Loading comments…