gh api -X PATCH repos/owner/repo/issues/5 -f state=closed

Category: GitHub CLI

gh api -X PATCH repos/owner/repo/issues/5 -f state=closed

Close an issue via the REST API

-X PATCH switches the HTTP method, and -f sends state=closed as a form parameter, closing issue 5 without gh issue close. REST endpoints map one-to-one with GitHub's API documentation. The -f flag adds string parameters; -F infers typed values.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.