# Create a user tag

```{raw} html
<div class="mo-api-page-show-toc" aria-hidden="true"></div>
```

Create a user tag for a workspace. After creation, the tag can be associated with workspace users.

```text
POST https://api.moi.matrixorigin.cn/v5/user/tag/create
```

## Preparation before calling

Prepare a [personal access token](../../../../../guides/genesis/api-keys.md) with the required permissions for the target workspace and the [target workspace ID](../../../../../guides/ai-studio/resource-center/workspace.md#copy-a-workspace-id).

## Request parameters

:::::::{div} mo-api-tabs
::::::{tab-set}
:::::{tab-item} Input example

```bash
curl -X POST "https://api.moi.matrixorigin.cn/v5/user/tag/create" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "example",
    "description": "Example tag"
  }'
```

:::::
:::::{tab-item} Parameter description

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | Yes | Tag name. |
| `description` | string | No | Tag description, up to 500 characters. |

A tag name cannot be empty and can contain at most 200 characters. It cannot contain spaces, tabs, backticks, or quotation marks, and cannot start with `{` or end with `}`.

:::::
::::::
:::::::

## Successful response

On success, returns the new tag ID.

:::::::{div} mo-api-tabs mo-api-response-tabs
::::::{tab-set}
:::::{tab-item} Response example

```json
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "id": 12
  }
}
```

:::::
:::::{tab-item} Field details

| Field | Type | Description |
| --- | --- | --- |
| `code` | string | `OK` on success. |
| `msg` | string | `OK` on success. |
| `data.id` | integer | New tag ID. |

:::::
::::::
:::::::

## Error response

:::::::{div} mo-api-tabs mo-api-response-tabs
::::::{tab-set}
:::::{tab-item} Response example

```json
{
  "code": "INVALID_ARGUMENT",
  "msg": "Invalid request parameters",
  "data": null
}
```

:::::
:::::{tab-item} Field details

| Field | Type | Description |
| --- | --- | --- |
| `code` | string | Error code. |
| `msg` | string | Error message. |
| `data` | null | — |

:::::
::::::
:::::::
