0

I tried below code to create organization using my github account getting error

mutation { createOrganization(input: { login: "besttestzzzz", admin: true }) { organization { id login } } }

{ "input": { "admin": [ "testgithubaccount" ],

"clientMutationId": "",
"login": "testgithubaccount"

} }

I got errors view the below image.

view the below image

2 Answers 2

0

Sure, you can!

gh api graphql -f query='
    mutation NeueOrg{
        createEnterpriseOrganization(
            input: { adminLogins: ["MyGH_Account"], billingEmail:"[email protected]", 
                enterpriseId: "MREFOkVudGVydHJpc2UxMzM5", login: "NeueOrg", profileName: "Neue Org"
            }
        )
        {enterprise {
            id
        }
    }
}'
Sign up to request clarification or add additional context in comments.

Comments

-1

GitHub's GraphQL API does not provide direct endpoints to create organizations. Organization creation is typically done through the GitHub web interface or using the REST API.

Here's how you can use rest API:

curl -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -d '{
  "login": "new-org",
  "profile_name": "New Organization",
  "admin": "your-username"
}' https://api.github.com/user/repos

1 Comment

There is no REST endpoint to create an organization. Also, your example code creates a repository, not an org.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.