Here is the example how you can stop/serve your App Engine version using API, just replace the PROJECTID,SERVICEID and VERSIONID:

curl --request PATCH \
"https://appengine.googleapis.com/v1/apps/PROJECTID/services/SERVICEID/versions/VERSIONID?updateMask=servingStatus" \
  --header "Authorization: Bearer $(gcloud auth print-access-token)" \
  --header "Accept: application/json" \
  --header "Content-Type: application/json" \
  --data '{"servingStatus":"STOPPED"}' \
  --compressed

For you to fully understand how it builds, there's an API Explorer or a panel. It has a title "Try this API" in the right side of screen, click the box icon to maximize or click this link to redirect. Fill the required fields:

  1. appsId - your PROJECT ID.
  2. servicesId - go to App Engine > Services or execute gcloud command: gcloud app services list to see your App Engine Services. The default name or servicesID of your App Engine Services is default.
  3. versionsId - go to App Engine > Versions or execute gcloud command: gcloud app versions list to see the App Engine versions deployed and copy the VERSION ID you want to update.
  4. updateMask - the configuration in App Engine version you want to update, example: servingStatus or instanceClass

To know more about fields and its definition in API, visit this table of contents. It will help you a lot how you can configure your App Engine Versions via API.

NOTE : You cannot stop the App Engine Version if your apps is configured in automatic scaling.