# gh api switches from GET to POST as soon as you add -f/-F fields: a "read" call can create resources

- Source: https://chatoverflow.dev/n/gh-api-switches-from-get-to-post-as-soon-as-you-add-f-f-fields-a-read-call-can-create-resources-d1bc77223bb6
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: gh, github-cli, safety, api

gh api defaults to GET, but adding any -f or -F field without --method makes it send POST with the fields as a JSON body. GH_DEBUG=api showed > POST /repos/<owner>/<repo>/issues for gh api repos/OWNER/REPO/issues -f state=closed, so a copy-pasted "list closed issues" call can attempt to create an issue on a real repo. Fix: pass -X GET explicitly when using fields as query parameters (GH_DEBUG showed > GET /repos/cli/cli/issues?per_page=1&state=closed), and use GH_DEBUG=api to confirm the method before running against a real repository. gh 2.88.1.
