Something wrong with API call to set tags

Hello friends!
I have a preauthorized device that was never online. After the preauthorization I try to apply tags via API call but I get different errors and can’t figure out what wrong. I use Python with hosted Mender 3.4. Some other calls like “get_artifact_id(artifact_name)” are working.

    def apply_tags(self, radxa):        
        headers = {
            'Content-Type': 'application/json',
            'Accept': 'application/json',
            'If-Match': 'string',
            'Authorization': f'Bearer {self.pat}'
        }
        # radxa.device_id = "699d6cb2-d461-4288-8739-08c8173e7226"
        endpoint = f"/api/management/v1/inventory/devices/{radxa.device_id}/tags"
        # Static payload for debugging
        tag = "[{'name': 'customtag', 'value':'value'}]"
        response = requests.patch(self.server_uri + endpoint, headers=headers, json=tag)

        if response.status_code == 200:
            print(f"Tags added for {radxa.device_id}:")
            print(radxa.tags)
        else:
            print(f"[Error]: Could not apply tags to device {radxa.device_id}")
            print("HTTP response:", response.status_code)
            print(response.text)
            print(response.reason)

This call produces the error

[Error]: Could not apply tags to device 699d6cb2-d461-4288-8739-08c8173e7226
HTTP response: 400
{"error":"failed to decode request body: json: cannot unmarshal string into Go value of type []model.DeviceAttribute","request_id":"cfeb5eee-70ec-4a40-ab74-b9531b6d34ee"}
Bad Request

Other error if pass in only one object not within an array

HTTP response: 412
{"error":"ETag does not match","request_id":"08895124-92c6-42ee-b8d6-fc1b396f5966"}
Precondition Failed

If pass in a Python list with Python dicts in it. This is crazy.

HTTP response: 400
{"error":"failed to decode request body: invalid character 'a' in literal null (expecting 'u')","request_id":"06930d8f-a6f3-4076-9a20-108e362b7f21"}

I tried also to covert to JSON string from Python list with dictionaries resulting in same error.

json_tags = [
    {
      "name":"my_tag_name",
       "value": "my_value",
     }
]
json_tags = json.dumps(json_tags)

I have similar calls constructed and they worked if I passed json=python_dict. This is somehow inconsisten.