---
title: "Create target group"
method: POST
path: "/target-groups/create"
tags: ["Target Groups"]
---

# Create target group

`POST /target-groups/create`

## Request

- Base URL: `https://api.databuddy.cc`
- URL: `https://api.databuddy.cc/target-groups/create`
- Auth: API key in header `x-api-key`

Creates a new target group. Requires feature flag update permission.

## Request body

- object
  - `websiteId` string, required
  - `name` string, required
  - `description` string
  - `color` string, required
  - `rules` object[], required
    - `type` 'user_id' | 'email' | 'property', required
    - `operator` 'equals' | 'contains' | 'starts_with' | 'ends_with' | 'in' | 'not_in' | 'exists' | 'not_exists', required
    - `field` string
    - `value` string
    - `values` string[]
    - `enabled` boolean, required
    - `batch` boolean, required
    - `batchValues` string[]

## Response `200`

OK

- object
  - `color` string, required
  - `createdAt` string, date-time, required
  - `createdBy` string, nullable, required
  - `deletedAt` string, date-time, nullable, required
  - `description` string, nullable, required
  - `id` string, required
  - `name` string, required
  - `updatedAt` string, date-time, required
  - `websiteId` string, required

## Other responses

- `400`: 400
- `401`: 401
- `402`: 402
- `403`: 403
- `404`: 404
- `409`: 409
- `429`: 429
- `500`: 500
- `503`: 503

---

[API](https://skmtc.dev/databuddy/apis/databuddy-api.md) - [All operations](https://skmtc.dev/databuddy/apis/databuddy-api/llms.txt) - [OpenAPI document](https://skmtc.dev/databuddy/apis/databuddy-api/revisions/ddfbba648d52?raw)
