How to add file uploads to articles via the API?

Last updated: February 8, 2025

  1. Upload your file via the /attachments endpoint

  2. Use the link returned from the attachments endpoint and add it to your article via the html img tag. Here's an example: <img src={file_url}> .

  3. Use the PATCH or POST /knowledge-base{id}/articles endpoint to create or update an article with the div block included in your HTML.

Example curl request for a local file:

curl -L \
  --request POST \
  --url 'https://api.usepylon.com/attachments' \
  --header 'Authorization: Bearer INSERT_JWT_TOKEN_HERE' \
  --form 'file=@INSERT_ABSOLUTE_PATH_HERE' \
  --form 'description=Your file description'