Create Draft Pull Request from the API

I am creating Pull Request through the GitHub API, and was trying to submit a Pull Requets in draft mode. I followed ths updated API Documentation for creating a pull request, and took these steps:

  1. Added an Accept header to the request with 

    application/vnd.github.shadow-cat-preview+json

  2. Sent this in my POST request

    { draft: true }

But the resulting Pull Request was still a “regular” one.

Can anyone tell if I am doing something wrong, or perhaps this functionality is not yet available? 

Thanks for the question.

According to the blog post introducing this support, it appears that creating draft pull requests is limited to the v4 GraphQL API and the v3 REST API only supports draft indicators in API responses. It appears that if you want to create draft pull requests, you’ll need to use the v4 GraphQL API.

I hope that helps!

1 Like