Error creating a hidden CI/CD variable via API

Im trying to create a hidden and masked cicd variable via API(Project-level CI/CD variables API | GitLab), but following the documentation i create this request

curl --request POST --header “PRIVATE-TOKEN: my-token” --url “https://gitlab.com/api/v4/projects/“projectID”/variables” --form “key=hi” --form “value=bye” --form “masked_and_hidden=true”

The response I get is:

{“message”:{“value”:[“is invalid”]}}

If i send the flag masked_and_hidden=false it all goes ok

Is this a bug, or is the documentation incorrect? Any insights would be appreciated!

Versions

  • GitLab.com SaaS