Attachments API


Files can be uploaded to Aha! as a sub-resource on any resource that supports them. These resources support attachments:

Notes appear all across the system on various records like Feature descriptions or Release themes. The id for these note fields can be found in the attributes of the record.

The format of an attachment is either a multipart/form-data upload or a json payload pointing to a file url link:

{ 
  "attachment": {
    "file_url": "http://www.aha.io/", 
    "content_type": "text/html",
    "file_name": "home_page.html"
  }
}

POST /api/v1/comments/:comment_id/attachments

Upload a file to a comment

Parameters

Name Description
comment_id * Numeric ID of the comment the uploaded file should be attached to

POST /api/v1/comments/933135074/attachments

Example CURL command

curl "https://secure.aha.io/api/v1/comments/933135074/attachments" -d '------------XnJLe9ZIbbGUYtzPQJ16u1
Content-Disposition: form-data; name="attachment[data]"; filename="sample_plain_text.txt"
Content-Type: text/plain
Content-Length: 27

[uploaded data]
------------XnJLe9ZIbbGUYtzPQJ16u1--
' -X POST \
	-H "Authorization: Bearer 15b60d42d4bc417284a246ced6877b0bf13fb4aca415f7b55f7006bc3694a8ab" \
	-H "X-Aha-Account: account1" \
	-H "Content-Type: multipart/form-data; boundary=----------XnJLe9ZIbbGUYtzPQJ16u1" \
	-H "Accept: application/json"

Request

Authorization: Bearer 15b60d42d4bc417284a246ced6877b0bf13fb4aca415f7b55f7006bc3694a8ab
X-Aha-Account: account1
Content-Type: multipart/form-data; boundary=----------XnJLe9ZIbbGUYtzPQJ16u1
Accept: application/json
------------XnJLe9ZIbbGUYtzPQJ16u1
Content-Disposition: form-data; name="attachment[data]"; filename="sample_plain_text.txt"
Content-Type: text/plain
Content-Length: 27

[uploaded data]
------------XnJLe9ZIbbGUYtzPQJ16u1--

Response

Status: 200 OK
  Content-Type: application/json; charset=utf-8
{
  "attachment": {
    "id": "6398143099648200794",
    "download_url": "http://account1.lvh.me/attachments/token/9ceeae4e52a95e8a3f5d66dcf419d0eb13c5d11739d5a6ac2d83e717cab2f8c7.download",
    "created_at": "2017-03-16T17:02:56.078Z",
    "file_size": 27,
    "content_type": "text/plain",
    "file_name": "sample_plain_text.txt"
  }
}

POST /api/v1/comments/:comment_id/attachments

Upload a link to a comment

Parameters

Name Description
comment_id * Numeric ID of the comment the uploaded file should be attached to

POST /api/v1/comments/933135074/attachments

Example CURL command

curl "https://secure.aha.io/api/v1/comments/933135074/attachments" -d 'attachment[file_url]=http%3A%2F%2Fwww.aha.io%2F&attachment[content_type]=text%2Fhtml&attachment[file_name]=home_page.html' -X POST \
	-H "Authorization: Bearer 15b60d42d4bc417284a246ced6877b0bf13fb4aca415f7b55f7006bc3694a8ab" \
	-H "X-Aha-Account: account1" \
	-H "Content-Type: multipart/form-data" \
	-H "Accept: application/json"

Request

Authorization: Bearer 15b60d42d4bc417284a246ced6877b0bf13fb4aca415f7b55f7006bc3694a8ab
X-Aha-Account: account1
Content-Type: multipart/form-data
Accept: application/json
attachment[file_url]=http%3A%2F%2Fwww.aha.io%2F&attachment[content_type]=text%2Fhtml&attachment[file_name]=home_page.html

Response

Status: 200 OK
  Content-Type: application/json; charset=utf-8
{
  "attachment": {
    "id": "6398143100306583357",
    "download_url": "http://account1.lvh.me/attachments/token/3401de552bd680c12f7f30c1a9846ebe23d0bf328928f16e0b5ab8f3b6edc4d7.download",
    "created_at": "2017-03-16T17:02:56.231Z",
    "file_size": 0,
    "content_type": "text/html",
    "file_name": "home_page.html"
  }
}

POST /api/v1/tasks/:task_id/attachments

Upload a file to a task

Parameters

Name Description
task_id * Numeric ID of the task the uploaded file should be attached to

POST /api/v1/tasks/1041191038/attachments

Example CURL command

curl "https://secure.aha.io/api/v1/tasks/1041191038/attachments" -d '------------XnJLe9ZIbbGUYtzPQJ16u1
Content-Disposition: form-data; name="attachment[data]"; filename="sample_plain_text.txt"
Content-Type: text/plain
Content-Length: 27

[uploaded data]
------------XnJLe9ZIbbGUYtzPQJ16u1--
' -X POST \
	-H "Authorization: Bearer 15b60d42d4bc417284a246ced6877b0bf13fb4aca415f7b55f7006bc3694a8ab" \
	-H "X-Aha-Account: account1" \
	-H "Content-Type: multipart/form-data; boundary=----------XnJLe9ZIbbGUYtzPQJ16u1" \
	-H "Accept: application/json"

Request

Authorization: Bearer 15b60d42d4bc417284a246ced6877b0bf13fb4aca415f7b55f7006bc3694a8ab
X-Aha-Account: account1
Content-Type: multipart/form-data; boundary=----------XnJLe9ZIbbGUYtzPQJ16u1
Accept: application/json
------------XnJLe9ZIbbGUYtzPQJ16u1
Content-Disposition: form-data; name="attachment[data]"; filename="sample_plain_text.txt"
Content-Type: text/plain
Content-Length: 27

[uploaded data]
------------XnJLe9ZIbbGUYtzPQJ16u1--

Response

Status: 200 OK
  Content-Type: application/json; charset=utf-8
{
  "attachment": {
    "id": "6398143100967136121",
    "download_url": "http://account1.lvh.me/attachments/token/a02316fabac145df43f43651ac49fa1ed9ab24b560f829298c28d391b353cc0a.download",
    "created_at": "2017-03-16T17:02:56.387Z",
    "file_size": 27,
    "content_type": "text/plain",
    "file_name": "sample_plain_text.txt"
  }
}

POST /api/v1/tasks/:task_id/attachments

Upload a link to a task

Parameters

Name Description
task_id * Numeric ID of the task the uploaded file should be attached to

POST /api/v1/tasks/1041191038/attachments

Example CURL command

curl "https://secure.aha.io/api/v1/tasks/1041191038/attachments" -d 'attachment[file_url]=http%3A%2F%2Fwww.aha.io%2F&attachment[content_type]=text%2Fhtml&attachment[file_name]=home_page.html' -X POST \
	-H "Authorization: Bearer 15b60d42d4bc417284a246ced6877b0bf13fb4aca415f7b55f7006bc3694a8ab" \
	-H "X-Aha-Account: account1" \
	-H "Content-Type: multipart/form-data" \
	-H "Accept: application/json"

Request

Authorization: Bearer 15b60d42d4bc417284a246ced6877b0bf13fb4aca415f7b55f7006bc3694a8ab
X-Aha-Account: account1
Content-Type: multipart/form-data
Accept: application/json
attachment[file_url]=http%3A%2F%2Fwww.aha.io%2F&attachment[content_type]=text%2Fhtml&attachment[file_name]=home_page.html

Response

Status: 200 OK
  Content-Type: application/json; charset=utf-8
{
  "attachment": {
    "id": "6398143101561041990",
    "download_url": "http://account1.lvh.me/attachments/token/4c67ceabbbb9b10c1f2aabd6830ad7f78f467113256fa0132a80f148a9c4772e.download",
    "created_at": "2017-03-16T17:02:56.523Z",
    "file_size": 0,
    "content_type": "text/html",
    "file_name": "home_page.html"
  }
}

POST /api/v1/custom_fields/:custom_field_id/attachments

Upload a file to a custom note field

Parameters

Name Description
custom_field_id * Numeric ID of the custom field the uploaded file should be attached to

POST /api/v1/custom_fields/264108567/attachments

Example CURL command

curl "https://secure.aha.io/api/v1/custom_fields/264108567/attachments" -d '------------XnJLe9ZIbbGUYtzPQJ16u1
Content-Disposition: form-data; name="attachment[data]"; filename="sample_plain_text.txt"
Content-Type: text/plain
Content-Length: 27

[uploaded data]
------------XnJLe9ZIbbGUYtzPQJ16u1--
' -X POST \
	-H "Authorization: Bearer 15b60d42d4bc417284a246ced6877b0bf13fb4aca415f7b55f7006bc3694a8ab" \
	-H "X-Aha-Account: account1" \
	-H "Content-Type: multipart/form-data; boundary=----------XnJLe9ZIbbGUYtzPQJ16u1" \
	-H "Accept: application/json"

Request

Authorization: Bearer 15b60d42d4bc417284a246ced6877b0bf13fb4aca415f7b55f7006bc3694a8ab
X-Aha-Account: account1
Content-Type: multipart/form-data; boundary=----------XnJLe9ZIbbGUYtzPQJ16u1
Accept: application/json
------------XnJLe9ZIbbGUYtzPQJ16u1
Content-Disposition: form-data; name="attachment[data]"; filename="sample_plain_text.txt"
Content-Type: text/plain
Content-Length: 27

[uploaded data]
------------XnJLe9ZIbbGUYtzPQJ16u1--

Response

Status: 200 OK
  Content-Type: application/json; charset=utf-8
{
  "attachment": {
    "id": "6398143102290170782",
    "download_url": "http://account1.lvh.me/attachments/token/3ef27891b23a2c62953438207629a0288e31b906b18f6d90503c2d6e9a1a25d8.download",
    "created_at": "2017-03-16T17:02:56.694Z",
    "file_size": 27,
    "content_type": "text/plain",
    "file_name": "sample_plain_text.txt"
  }
}

POST /api/v1/custom_fields/:custom_field_id/attachments

Upload a link to a custom note field

Parameters

Name Description
custom_field_id * Numeric ID of the custom field the uploaded file should be attached to

POST /api/v1/custom_fields/264108567/attachments

Example CURL command

curl "https://secure.aha.io/api/v1/custom_fields/264108567/attachments" -d 'attachment[file_url]=http%3A%2F%2Fwww.aha.io%2F&attachment[content_type]=text%2Fhtml&attachment[file_name]=home_page.html' -X POST \
	-H "Authorization: Bearer 15b60d42d4bc417284a246ced6877b0bf13fb4aca415f7b55f7006bc3694a8ab" \
	-H "X-Aha-Account: account1" \
	-H "Content-Type: multipart/form-data" \
	-H "Accept: application/json"

Request

Authorization: Bearer 15b60d42d4bc417284a246ced6877b0bf13fb4aca415f7b55f7006bc3694a8ab
X-Aha-Account: account1
Content-Type: multipart/form-data
Accept: application/json
attachment[file_url]=http%3A%2F%2Fwww.aha.io%2F&attachment[content_type]=text%2Fhtml&attachment[file_name]=home_page.html

Response

Status: 200 OK
  Content-Type: application/json; charset=utf-8
{
  "attachment": {
    "id": "6398143103628064035",
    "download_url": "http://account1.lvh.me/attachments/token/2f9f59d4605dd0666ea598fc44376150fa901db9193bac1f5b4f8323209fc41d.download",
    "created_at": "2017-03-16T17:02:57.002Z",
    "file_size": 0,
    "content_type": "text/html",
    "file_name": "home_page.html"
  }
}

POST /api/v1/notes/:note_id/attachments

Upload a file to a note (description, theme, etc)

Parameters

Name Description
note_id * Numeric ID of the note the uploaded file should be attached to

POST /api/v1/notes/793547626/attachments

Example CURL command

curl "https://secure.aha.io/api/v1/notes/793547626/attachments" -d '------------XnJLe9ZIbbGUYtzPQJ16u1
Content-Disposition: form-data; name="attachment[data]"; filename="sample_plain_text.txt"
Content-Type: text/plain
Content-Length: 27

[uploaded data]
------------XnJLe9ZIbbGUYtzPQJ16u1--
' -X POST \
	-H "Authorization: Bearer 15b60d42d4bc417284a246ced6877b0bf13fb4aca415f7b55f7006bc3694a8ab" \
	-H "X-Aha-Account: account1" \
	-H "Content-Type: multipart/form-data; boundary=----------XnJLe9ZIbbGUYtzPQJ16u1" \
	-H "Accept: application/json"

Request

Authorization: Bearer 15b60d42d4bc417284a246ced6877b0bf13fb4aca415f7b55f7006bc3694a8ab
X-Aha-Account: account1
Content-Type: multipart/form-data; boundary=----------XnJLe9ZIbbGUYtzPQJ16u1
Accept: application/json
------------XnJLe9ZIbbGUYtzPQJ16u1
Content-Disposition: form-data; name="attachment[data]"; filename="sample_plain_text.txt"
Content-Type: text/plain
Content-Length: 27

[uploaded data]
------------XnJLe9ZIbbGUYtzPQJ16u1--

Response

Status: 200 OK
  Content-Type: application/json; charset=utf-8
{
  "attachment": {
    "id": "6398143104520297622",
    "download_url": "http://account1.lvh.me/attachments/token/3c3d0d16b6d519efaba7f10096b6d1282e99a1446964a8a0b592586479be88cd.download",
    "created_at": "2017-03-16T17:02:57.213Z",
    "file_size": 27,
    "content_type": "text/plain",
    "file_name": "sample_plain_text.txt"
  }
}

POST /api/v1/notes/:note_id/attachments

Upload a link to a note (description, theme, etc)

Parameters

Name Description
note_id * Numeric ID of the note the uploaded file should be attached to

POST /api/v1/notes/793547626/attachments

Example CURL command

curl "https://secure.aha.io/api/v1/notes/793547626/attachments" -d 'attachment[file_url]=http%3A%2F%2Fwww.aha.io%2F&attachment[content_type]=text%2Fhtml&attachment[file_name]=home_page.html' -X POST \
	-H "Authorization: Bearer 15b60d42d4bc417284a246ced6877b0bf13fb4aca415f7b55f7006bc3694a8ab" \
	-H "X-Aha-Account: account1" \
	-H "Content-Type: multipart/form-data" \
	-H "Accept: application/json"

Request

Authorization: Bearer 15b60d42d4bc417284a246ced6877b0bf13fb4aca415f7b55f7006bc3694a8ab
X-Aha-Account: account1
Content-Type: multipart/form-data
Accept: application/json
attachment[file_url]=http%3A%2F%2Fwww.aha.io%2F&attachment[content_type]=text%2Fhtml&attachment[file_name]=home_page.html

Response

Status: 200 OK
  Content-Type: application/json; charset=utf-8
{
  "attachment": {
    "id": "6398143107013682369",
    "download_url": "http://account1.lvh.me/attachments/token/b12670b3c89504d97776fa76fcbfd813aa968102aa4cf895210e684fa9efed68.download",
    "created_at": "2017-03-16T17:02:57.793Z",
    "file_size": 0,
    "content_type": "text/html",
    "file_name": "home_page.html"
  }
}

Overview

API Resources