# Create tag

- Operation ID: `createTag`
- HTTP method: `POST`
- Path: `/tags-collector/tags`
- [Human-readable API reference](https://hub.synerise.com/api-reference/data-management#tag/Asset-tags/operation/createTag)

## Self-contained OpenAPI method

The fenced document below contains this method's documentation and all of its local references. It is self-contained; no category or master specification fetch is required.

```yaml
openapi: 3.0.0
info:
  title: Synerise Public API
  version: 1.9.1
paths:
  /tags-collector/tags:
    post:
      tags:
        - Asset tags
      summary: Create tag
      description: |
        Creates a tag that can be assigned to assets, for example promotions.

        ---

        **API consumers:** <a href="/api-reference/authorization?tag=Authorization&amp;operationId=userLogin" target="_blank" rel="noopener">Synerise User</a>, <a href="/api-reference/authorization?tag=Authorization&amp;operationId=authenticateUsingPOST_v3" target="_blank" rel="noopener">Profile (Client)</a>, <a href="/api-reference/authorization?tag=Authorization&amp;operationId=profileLogin" target="_blank" rel="noopener">Workspace (Business Profile)</a>

        **API key permission required:** `TAGS_COLLECTOR_TAG_CREATE`

        **User role permission required:** `assets_tags: create`
      operationId: createTag
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - value
                - priority
              properties:
                color:
                  type: string
                  description: Hex code of the tag color
                  nullable: true
                description:
                  type: string
                  description: Description of the tag
                directory:
                  type: string
                  description: Hash ID of the directory where the tag is assigned
                  nullable: true
                icon:
                  type: string
                  description: URL of the tag's icon
                  nullable: true
                priority:
                  type: integer
                  description: Tag priority. Lower values mean higher priority.
                  default: 0
                value:
                  type: string
                  description: Name of the tag
        description: ""
        required: true
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                type: object
                properties:
                  authorId:
                    type: integer
                    description: ID of the user who created the tag
                  color:
                    type: string
                    description: Hex code of the tag color
                    nullable: true
                  createdAt:
                    type: string
                    format: date-time
                    description: Creation time
                  description:
                    type: string
                    description: Description of the tag
                  directory:
                    type: object
                    description: Information about the directory where the tag is assigned. Can be `null`.
                    properties:
                      createdAt:
                        type: string
                        format: date-time
                        description: Creation time
                      hash:
                        type: string
                        description: HashID of the directory
                      name:
                        type: string
                        description: Name of the directory
                      params:
                        type: object
                        description: Free-form parameters
                        additionalProperties:
                          anyOf:
                            - type: string
                            - type: number
                            - type: boolean
                      type:
                        type: object
                        description: Details of the directory type
                        properties:
                          createdAt:
                            type: string
                            format: date-time
                            description: Creation time
                          hash:
                            type: string
                            description: HashID of the directory type
                          name:
                            type: string
                            description: Name of the directory type
                  hash:
                    type: string
                    description: Hash ID of the tag
                  icon:
                    type: string
                    description: URL of the tag's icon
                    nullable: true
                  priority:
                    type: integer
                    description: Tag priority. Lower values mean higher priority.
                    default: 0
                  value:
                    type: string
                    description: Name of the tag
        "401":
          description: Unauthorized
        "403":
          description: Forbidden
        "404":
          description: Not Found
      x-snr-doc-urls:
        - /api-reference/data-management#tag/Asset-tags/operation/createTag
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl --request POST \
              --url https://api.synerise.com/tags-collector/tags \
              --header 'content-type: application/json' \
              --data '{"color":"string","description":"string","directory":"string","icon":"string","priority":0,"value":"string"}'
        - lang: Python
          label: Python
          source: |-
            import http.client

            conn = http.client.HTTPSConnection("api.synerise.com")

            payload = "{\"color\":\"string\",\"description\":\"string\",\"directory\":\"string\",\"icon\":\"string\",\"priority\":0,\"value\":\"string\"}"

            headers = { 'content-type': "application/json" }

            conn.request("POST", "/tags-collector/tags", payload, headers)

            res = conn.getresponse()
            data = res.read()

            print(data.decode("utf-8"))
        - lang: JavaScript
          label: JavaScript
          source: |-
            const data = JSON.stringify({
              "color": "string",
              "description": "string",
              "directory": "string",
              "icon": "string",
              "priority": 0,
              "value": "string"
            });

            const xhr = new XMLHttpRequest();
            xhr.withCredentials = true;

            xhr.addEventListener("readystatechange", function () {
              if (this.readyState === this.DONE) {
                console.log(this.responseText);
              }
            });

            xhr.open("POST", "https://api.synerise.com/tags-collector/tags");
            xhr.setRequestHeader("content-type", "application/json");

            xhr.send(data);
        - lang: Node.js
          label: Node.js
          source: |-
            const http = require("https");

            const options = {
              "method": "POST",
              "hostname": "api.synerise.com",
              "port": null,
              "path": "/tags-collector/tags",
              "headers": {
                "content-type": "application/json"
              }
            };

            const req = http.request(options, function (res) {
              const chunks = [];

              res.on("data", function (chunk) {
                chunks.push(chunk);
              });

              res.on("end", function () {
                const body = Buffer.concat(chunks);
                console.log(body.toString());
              });
            });

            req.write(JSON.stringify({
              color: 'string',
              description: 'string',
              directory: 'string',
              icon: 'string',
              priority: 0,
              value: 'string'
            }));
            req.end();
        - lang: PHP
          label: PHP
          source: |-
            <?php

            $request = new HttpRequest();
            $request->setUrl('https://api.synerise.com/tags-collector/tags');
            $request->setMethod(HTTP_METH_POST);

            $request->setHeaders([
              'content-type' => 'application/json'
            ]);

            $request->setBody('{"color":"string","description":"string","directory":"string","icon":"string","priority":0,"value":"string"}');

            try {
              $response = $request->send();

              echo $response->getBody();
            } catch (HttpException $ex) {
              echo $ex;
            }
        - lang: Java
          label: Java
          source: |-
            HttpResponse<String> response = Unirest.post("https://api.synerise.com/tags-collector/tags")
              .header("content-type", "application/json")
              .body("{\"color\":\"string\",\"description\":\"string\",\"directory\":\"string\",\"icon\":\"string\",\"priority\":0,\"value\":\"string\"}")
              .asString();
servers:
  - description: Microsoft Azure EU
    url: https://api.synerise.com
  - description: Microsoft Azure USA
    url: https://api.azu.synerise.com
  - description: Google Cloud Platform
    url: https://api.geb.synerise.com
tags:
  - name: Asset tags
```
