Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

46 lines (35 sloc) 1.886 kb


For accessing files on a given project, please see the Files API.

Attaching files via the API

Some operations, like creating messages or comments, or updating existing messages or comments, allow you to attach a file to the record. To do this via the API, you need to send a POST request to the /upload URI, with the HTTP Accept header set to application/xml. The body of the request should be the content of the file you want to attach:

POST /upload HTTP/1.0
Accept: application/xml
Content-Type: application/octet-stream
Content-Length: 23123

... (file contents go here)

If the upload succeeds, you'll get an XML response back, telling you the ID of your upload. (Your upload is not yet associated with any record, and if you do not do anything with it, it will be deleted sometime within the next 30 minutes.)

HTTP/1.0 201 OK
Content-Type: application/xml

<?xml version="1.0" encoding="UTF-8"?>

Armed with the ID, your next step is to attach the file to a record. Using the "Create message" action, for instance, you pass an array of attachment data in. Assuming you had two files you wanted to attach (which you had previously uploaded, as described), your attachment data would look something like this (formatted as XML):

  <name>A pretty sunset</name>
  <name>The ocean</name>
Jump to Line
Something went wrong with that request. Please try again.