Metafields may be managed using the Shopify action, whether you use REST or GraphQL. While metafields can be uniquely referenced for a resource, using their namespace and key, any updates to them must include the metafield ID.
Any attempts to update an existing metafield, without providing the ID, will receive this error from Shopify:
Received a Shopify error (resource invalid): metafields.key must be unique within this namespace on this resource
Use the following code as an example for how you might create a metafield if is missing, or update it if it already exists, using either REST or GraphQL: