How to Attach Files to Topics using the Zendesk API

It seems to be undocumented in the API but through some questions on the forums I got it working. Here is a guide for someone else looking to do it as well.


  • First you upload the file you need to attach to the topic:
curl \
  -H "Content-Type: application/binary" \
  --data-binary path/to/binary.bin \
  -v -u
  • Next you need to grab the “token” from the returned JSON string. It will be a 15 character string i.e. “brztup9rng1ywaw”. You can do this many times to attach all the files at once.
  • Finally you update the topic you want to attach the files to. This assumes you have the topic id you want to update i.e. “24982733” in this example, if you don’t you would have to find that first.
curl \
  -H "Content-Type: application/json" \
  -d '{"topic":{"uploads":["brztup9rng1ywaw"]}}' \
  -v -u -X PUT
comments powered by Disqus