---
title: Create New Tag REST API
description: "#### **Endpoint** ``` POST /wp-json/rtcl/v1/tags/new ``` #### Description Creates a new listing tag or returns an existing one if the tag already exists. ### Request Headers | Header | Required | Description | | --- | --- | --- |…"
url: "https://www.radiustheme.com/docs/classified-listing/docs/rest-api/create-new-tag-rest-api/"
updated: "2026-01-29"
category: Developer Docs / REST API
---

# Create New Tag REST API

#### **Endpoint**

```
POST /wp-json/rtcl/v1/tags/new
```

#### Description

Creates a new listing tag or returns an existing one if the tag already exists.

### Request Headers

| Header | Required | Description |
| --- | --- | --- |
| `Content-Type` | ✅ Yes | `application/json` |
| `x-api-key` | ✅ Yes | API key used for request authentication |

### **Request Parameters**

#### **Body Parameters**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| name | string | Yes | Name of the tag to be created |

#### **Example Request Body**

```
{
  "name": "Premium"
}
```

### cURL Example

```
curl -X POST https://example.com/wp-json/rtcl/v1/tags/new 
  -H "Content-Type: application/json" 
  -H "Authorization: Bearer YOUR_JWT_TOKEN" 
  -d '{
    "name": "Premium"
  }'
```

### **Request Validation Logic**

1. The `name` parameter is trimmed and sanitized.
2. If the tag name is empty, the API returns an error.
3. The API checks if the tag already exists in the listing tag taxonomy.
4. If the tag exists → returns the existing tag.
5. If not → creates a new tag and returns it.

### **Success Responses**

#### **Existing Tag Found**

```
{
  "term_id": 12,
  "name": "Premium",
  "slug": "premium",
  "term_group": 0,
  "term_taxonomy_id": 12,
  "taxonomy": "rtcl_tag",
  "description": "",
  "parent": 0,
  "count": 4
}
```

### **New Tag Created**

```
{
  "term_id": 25,
  "term_taxonomy_id": 25
}
```

### **Error Responses**

#### **Missing or Empty Tag Name**

**Status:** `403 Forbidden`

```
{
  "code": "SANITIZATION_ERROR",
  "message": "Tag name is required",
  "data": {
    "status": 403
  }
}
```

#### **Error While Creating Tag**

**Status:** `403 Forbidden`

```
{
  "code": "SANITIZATION_ERROR",
  "message": "Error while creating new tag.",
  "data": {
    "status": 403
  }
}
```
