Assigning tags to VM and service template using REST API


I am trying to assign tags to VM and service template through REST API

POST /api/vms/320/tags
  "action" : "assign",
  "resources" : [
    { "category" : "department", "name" : "TOF" }


That doesn’t seems to work and I am always getting

"results": [
            "success": false,
            "message": "Assigning Tag: category:'department' name:'TOF' - FAILED. Tag name 'TOF' not found  in region 1",
            "href": "",
            "tag_category": "department",
            "tag_name": "TOF"

What is region 1? Do I need to have tags baked in to the VM or service template before I can assign the value?


Tag names are always lower case alphanumeric, maybe “TOF” is the description? Try “tof” (if that’s the tag name).


I think I know what’s the issue. It looks like I need to create the tag resource first before I can assign to anything. Is there a REST API for doing that?

Sure, here’s the doc:

Perfect, thanks!

Did you solve the problem of assigning tags?

Yes, the tag must be created first before the assignment. That was the root cause.

Cool :+1: