less than 1 minute read

This posts builds on the previous post “Finding your GitHub org (beta) project ID”

At $DAY_JOB, someone had asked if GitHub allowed users to quickly create draft issues for a GitHub project (the new kind). There was no quick way to easily do this. There is no upload CSV option and using the GitHub CLI to create issues wouldn’t add them to the board.

But, a quick look at GitHub’s GraphQL API shows us there is a addProjectV2DraftIssue mutation that we can use.

Here’s a quick bit of Python you can borrow that quickly creates draft issues in a project using the mutation above.

from gql import gql, Client
from gql.transport.requests import RequestsHTTPTransport


transport = RequestsHTTPTransport(url="https://api.github.com/graphql",
                                  headers={'Authorization': 'token ' + GH_TOKEN})
client = Client(transport=transport)

bunch_of_issues = ["add infra", "add testing", "add docs", "add code"]

for issue in bunch_of_issues:

    mutation = gql(
    mutation ($projectId: ID!, $title: String!){
        addProjectV2DraftIssue(input:{projectId:$projectId, title:$title}) {
            projectItem {

    params = {
        "projectId": "MY_PROJECT_ID",
        "title": issue

    response = client.execute(mutation, variable_values=params)

You should now see the issues in the project, like the image below.

draft issues added to project

That’s it! Hope this might be useful to you.