---
title: "Preview or write Research Study export artifacts to GitHub through the optional writeback app."
method: POST
path: "/api/v1/research-studies/{studyId}/export"
tags: ["Research Studies"]
---

# Preview or write Research Study export artifacts to GitHub through the optional writeback app.

`POST /api/v1/research-studies/{studyId}/export`

## Request

- Base URL: `https://commentary.dev`
- URL: `https://commentary.dev/api/v1/research-studies/{studyId}/export`
- Auth: HTTP bearer

Requires commentary.research.write, the research.studies.github_export license feature, the optional GitHub writeback app, an installed repository target, and signed-in write permission to the target repository. Writes JSON and Markdown export files in one commit when action=writeback.

## Path parameters

- `studyId` string, required

## Headers

- `X-Commentary-Workspace-Id` string
- `X-Correlation-Id` string

## Request body

- object
  - `action` 'preview_writeback' | 'writeback'
  - `target` object
  - `commitMessage` string
  - `openPullRequest` boolean
  - `pullRequestTitle` string
  - `pullRequestBody` string

## Response `200`

Successful response.

- object

## Other responses

- `202`: Successful response.
- `400`: The request was invalid.
- `401`: Authentication is required.
- `403`: The token or session does not have permission for this resource.
- `404`: The resource was not found.
- `429`: The request was rate limited.

---

[API](https://skmtc.dev/commentary/apis/commentary-public-api.md) · [All operations](https://skmtc.dev/commentary/apis/commentary-public-api/llms.txt) · [OpenAPI document](https://skmtc.dev/commentary/apis/commentary-public-api/revisions/7aaafc198c52?raw)
