Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

REST API Upload non-local attachment via web URL (HTTP 415 error)

Bryce Hillam
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 30, 2025

I'm trying to use Confluence Automation Rules to upload an attachment (a PDF export of a page, generated by a Web Request to a third-party API).

My Automation Rule successfully generates the page export and I receive a download URL for the PDF. I'm trying to send a web request to the Confluence REST API to upload the PDF as an attachment to a Confluence page, using the Create Attachment endpoint. and a Send Web Request action.

It's not clear what is the proper way to format this request when attaching a file via a URL. I assume it is possible to do so since the standard user interface permits this. The curl examples all upload a binary file from the local filesystem, which is useless for an Automation Rule.

My Confluence token has write:confluence-file, write:attachment:confluence, and read:content-details:confluence scopes (and nothing else).

The API request is configured as follows:

Untitled.png

I always receive the response HTTP 415 Unsupported Media Type.

If I migrate Content-Type: multipart/form-data; boundary=... to the Headers then I instead get HTTP 403 Forbidden.

I've also tried retrieving the file using another Web Request and storing the result into a variable, then retrieving that smart value in the body of the request as follows (with and without .urlEncode), unsuccesfully - I have tried with Content-Disposition: application/pdf and application/octet-stream, also without any content type specifier.

Capture.JPG

Is it possible to attach a file to a page from a web URL? How should I modify the request to do so?

If not, is there some way I can retrieve the binary blob from my file download URL, and encode it in the request as application/pdf or application/octet-stream?

edit:

I tried Authorization: Basic {{encodedCredentials}}, instead of Bearer Authorization and still get 403 "Current user not permitted to use Confluence", where credentials are encoded offline using echo "<email>:<PAT>" | base64.

I've also seen claims online that base64Encode is a function that exists and can be used per below however that didn't work at all (nested braces don't seem to be supported).

{{base64Encode("{{initiator.emailAddress}}:{{confluencePAT}}")}}

 

1 answer

0 votes
Oleksii Melnyk
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 16, 2025

Hi @Bryce Hillam !
Unfortunately, Confluence/Jira Automation doesn't support uploading a file directly from an external URL - the API requires a multipart/form-data request, which isn't supported by the Web Request action.

For similar use cases, I use a combination of JSM + Jira Edge Connector with a custom Python script that fetches the file from the URL and uploads it to Confluence using the correct API call.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events