Create metafiel definition with GraphQL API

I’m creating a custom app and testing it on a development store.
Upon installation I need the app to create a new metafield definition on products.
My app asks for “write_products” scope, api version is “2024-01”
Im using the following mutation:

`mutation CreateMetafieldDefinition($definition: MetafieldDefinitionInput!) {
      metafieldDefinitionCreate(definition: $definition) {
        createdDefinition {
          id
          name
        }
        userErrors {
          field
          message
          code
        }
      }
    }`

with example of variables:

{
"definition":
{"name":"my metafield",
"namespace":"custom",
"key":"my_metafield",
"type":"json","ownerType":"PRODUCT"}}

and I’m getting the error in the response: Access denied for metafieldDefinitionCreate field. Required access: API client to have access to the namespace and the resource type associated with the metafield definition

I also tried not using the “custom” namespace and used “$app:mynamespace” and it failed the same.

Do I need to ask for other scopes?
I my mutation wrong?
What am I missing here?
Thanks

The mutation itself looks okay - you could try adding the write_product_listings scope too, and try using the $app namespace in its explicit format. Although $app:mynamespace should theoretically work, using the explicit namespace provided in your app’s settings can sometimes resolve issues.