> ## Documentation Index
> Fetch the complete documentation index at: https://docs.metabind.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Tag

> Create a new tag

## Path Parameters

<ParamField path="organizationId" type="string" required>
  Organization ID
</ParamField>

<ParamField path="projectId" type="string" required>
  Project ID
</ParamField>

## Request Body

<ParamField body="name" type="string" required>
  Display name for the tag
</ParamField>

<ParamField body="description" type="string">
  Optional description
</ParamField>

### Example Request

```json theme={null}
{
  "name": "Artificial Intelligence",
  "description": "AI-related content"
}
```

## Response

Returns the created Tag object. The `slug` is automatically generated from the name.

```json theme={null}
{
  "id": "tag789",
  "name": "Artificial Intelligence",
  "slug": "artificial-intelligence",
  "description": "AI-related content",
  "createdAt": "2024-03-22T10:00:00Z",
  "updatedAt": "2024-03-22T10:00:00Z"
}
```

## Error Responses

### Tag Name Already Exists

```json theme={null}
{
  "error": {
    "code": "TAG_NAME_ALREADY_EXISTS",
    "message": "A tag with this name already exists"
  }
}
```

## Code Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.metabind.ai/app/v1/organizations/org123/projects/proj456/tags" \
    -H "Authorization: Bearer YOUR_JWT" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "Artificial Intelligence",
      "description": "AI-related content"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://api.metabind.ai/app/v1/organizations/org123/projects/proj456/tags',
    {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer YOUR_JWT',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        name: 'Artificial Intelligence',
        description: 'AI-related content'
      })
    }
  );

  const tag = await response.json();
  console.log(`Created tag: ${tag.slug}`);
  ```
</CodeGroup>
