---
updatedAt: 2025-11-18T09:45:00.000Z
agentTools:
  projectIndex: https://dev.kevel.com/llms.txt
---

# Create Segment

## API Syntax

When using the Create Segment API endpoint, it is important to understand the syntax required to make the request. Because the Kevel API is a RESTful API, there is a specific request format that must be followed to ensure the endpoint can process the request. The format is:

`POST https://api.kevel.co/v1/segment`

Where:

* `POST` - the type of API request being made.
* `<https://api.kevel.co>` - the URL for the request.
* `v1` - the API version.
* `segment` - the API endpoint being called.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "management-api-2",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://api.kevel.co"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "apiKey",
        "name": "X-Adzerk-ApiKey",
        "in": "header"
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/v1/segment/": {
      "post": {
        "summary": "Create Segment",
        "description": "",
        "operationId": "create-segment",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "Name"
                ],
                "properties": {
                  "Name": {
                    "type": "string",
                    "maxLength": 200,
                    "description": "The human-friendly name of the segment. Max length is 200 characters."
                  },
                  "Source": {
                    "type": "string",
                    "maxLength": 100,
                    "description": "Where the segment came from. Max length is 100 characters."
                  },
                  "Reach": {
                    "type": "object",
                    "description": "The estimated reach of the segment for all time and the last 4 weeks.",
                    "properties": {
                      "all_time": {
                        "type": "integer",
                        "format": "int32"
                      },
                      "28d": {
                        "type": "integer",
                        "format": "int32"
                      }
                    }
                  },
                  "Description": {
                    "type": "string",
                    "maxLength": 500,
                    "description": "An extended human-friendly description of the segment. Max length is 500 characters."
                  },
                  "Category": {
                    "type": "string",
                    "maxLength": 100,
                    "description": "The category a segment belongs to. Max length is 100 characters."
                  },
                  "Advertisers": {
                    "type": "array",
                    "items": {
                      "properties": {
                        "AdvertiserId": {
                          "type": "integer",
                          "format": "int32"
                        }
                      },
                      "type": "object"
                    },
                    "description": "A list of Advertisers that have access to the Segment."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n  \"Id\": 123456,\n  \"Source\": \"audience\",\n  \"Name\": \"best customers\",\n  \"Reach\": { \"all_time\": 3187463, \"28d\": 387434 },\n  \"Description\": \"top 1% spenders in the last 30 days.\",\n  \"Category\": \"CRM\",\n  \"IsDeleted\": false\n}\n"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "Id": {
                      "type": "integer",
                      "example": 123456,
                      "default": 0
                    },
                    "Source": {
                      "type": "string",
                      "example": "audience"
                    },
                    "Name": {
                      "type": "string",
                      "example": "best customers"
                    },
                    "Reach": {
                      "type": "object",
                      "properties": {
                        "all_time": {
                          "type": "integer",
                          "example": 3187463,
                          "default": 0
                        },
                        "28d": {
                          "type": "integer",
                          "example": 387434,
                          "default": 0
                        }
                      }
                    },
                    "Description": {
                      "type": "string",
                      "example": "top 1% spenders in the last 30 days."
                    },
                    "Category": {
                      "type": "string",
                      "example": "CRM"
                    },
                    "IsDeleted": {
                      "type": "boolean",
                      "example": false,
                      "default": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          }
        },
        "deprecated": false,
        "x-readme": {
          "code-samples": [
            {
              "language": "curl",
              "code": "curl -X POST -H \"X-Adzerk-ApiKey:<APIKEY>\" -H \"Content-Type:application/json\" https://api.kevel.co/v1/segment --data-binary '{\"Category\":\"CRM\",\"Source\":\"audience\",\"Description\":\"top 1% spenders in the last 30 days.\",\"Reach\":\"{\"all_time\":3187463, \"28d\":387434}\",\"Name\":\"best customers\"}' "
            },
            {
              "language": "javascript",
              "code": "// coming soon to @adzerk-management-sdk\nconst Adzerk = require('@adzerk/management-sdk');\nconst apiKey = process.env.ADZERK_API_KEY;\n\nasync function createSegment() {\n  let specifications = await Adzerk.fetchSpecifications();\n  let client = await Adzerk.buildClient({apiKey, specifications});\n\n  let segment = await client.run(\"segment\", \"create\", {\n    name: \"best customers\",\n    source: \"audience\",\n    description: \"top 1% spenders in the last 30 days.\",\n  });\n\n  console.log(segment);\n}\n\ncreateSegment();"
            },
            {
              "language": "ruby",
              "code": "## coming soon to @adzerk-management-sdk\nrequire \"adzerk\"\n\ndef create_segment()\n    client = Adzerk::Client.new(ENV[\"ADZERK_API_KEY\"])\n    pp client.segment.create(name: \"best customers\", source: \"audience\", description: \"top 1% spenders in the last 30 days.\")\nend\ncreate_segment()"
            }
          ],
          "samples-languages": [
            "curl",
            "javascript",
            "ruby"
          ]
        }
      }
    }
  },
  "x-readme": {
    "headers": [
      {
        "key": "X-Adzerk-Sdk-Version",
        "value": "Readme.io:ManagementAPI2"
      }
    ],
    "explorer-enabled": false,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true
}
```