Data pipeline export request fails with XSRF check failed error
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Problem
When attempting to export data using the data pipeline API in Confluence via the command line, the export fails with the following error in the console:
XSRF check failed
Cause
The Confluence REST API is protected from Cross Site Request Forgery (XSRF/CSRF) attacks for security reasons.
Resolution
To call protected APIs from your command line or external systems you can add the X-Atlassian-Token
header to each request, and set the value to no-check
. Adding this header to a request bypasses the server-side XSRF check and allows the request to be fulfilled. This is only available for requests made by command line tools or external systems, not browser requests.
Here's an example export request with the X-Atlassian-Token
header. We used cURL and a personal access token for this request.
curl -H "Authorization:Bearer <personal-access-token>" -H "X-Atlassian-Token: no-check"
-X POST http://<base-url>/rest/datapipeline/latest/export
This issue only affects Confluence.