Add tags to users

In this section we'll cover how to add tags to users.

Before you start you must have a user account on Morta, and you must have owner level access to a project. You must also have at least one table in your project where there is a tag column with at least one value.

Add tag to a user

To add a tag, you must known the publicId of the user and the tag reference Id

import requests

OWNER_ROLE = 4

headers = {
  "Authorization": "Bearer YourToken"
}
payload = {
  "tagReferenceId": "table/9b634c18-8c13-4644-82e4-dcf149474a6c/83ccdb2a-82e0-4c1f-aabc-9817183add5b/42943c17-c869-499f-ab81-e296a70fc9d8",
}
user_id = "UserId"

response = requests.post("https://api.morta.io/v1/user/{user_id}/tags", json=payload, headers=headers)

if response.ok:
  # do something here