How to add file uploads to articles via the API?
Last updated: February 8, 2025
Upload your file via the
/attachmentsendpointUse the link returned from the attachments endpoint and add it to your article via the html
imgtag. Here's an example:<img src={file_url}>.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'