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

# Delete segment definition

> Soft-deletes a custom segment definition.

The service does not reuse its ID and preserves customer memberships associated with it. The built-in definitions (`0` and `1`) cannot be deleted.

**Required scopes:** `customers:rw`


## OpenAPI

````yaml /api/customer-data-platform/openapi.json post /v1/delete_segment_definition
openapi: 3.0.0
info:
  title: Customer Data Platform API
  description: A service for collecting, storing, and managing end-user data.
  version: 0.0.1
servers:
  - url: https://api.text.com/cdp
    description: Main production server URL
security:
  - PersonalAccessToken: []
  - OAuth2BearerToken:
      - customers:ro
paths:
  /v1/delete_segment_definition:
    post:
      tags:
        - Segments
      summary: Delete segment definition
      description: >-
        Soft-deletes a custom segment definition.


        The service does not reuse its ID and preserves customer memberships
        associated with it. The built-in definitions (`0` and `1`) cannot be
        deleted.
      operationId: deleteSegmentDefinition
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeleteSegmentDefinitionRequest'
            example:
              segment_id: 2
      responses:
        '200':
          description: The definition was deleted.
        '401':
          description: Invalid access token
        '403':
          description: Insufficient scopes
        '404':
          description: Segment definition not found (unknown or already-deleted custom ID).
        '422':
          description: Invalid request body, or `segment_id` is a built-in (`0` or `1`).
        '500':
          description: Internal error
      security:
        - PersonalAccessToken: []
        - OAuth2BearerToken:
            - customers:rw
components:
  schemas:
    DeleteSegmentDefinitionRequest:
      type: object
      required:
        - segment_id
      additionalProperties: false
      properties:
        segment_id:
          type: integer
          format: int64
          example: 2
          description: >-
            The custom definition ID. Built-in definitions `0` and `1` cannot be
            deleted.
  securitySchemes:
    PersonalAccessToken:
      description: >-
        Use your `account ID` as the username and your personal access token
        (PAT) as the password, or pass a Base64-encoded value directly in the
        Authorization header. For more information, see the <a
        href="/authentication/personal-access-tokens">personal access tokens
        guide</a>.
      type: http
      scheme: basic
    OAuth2BearerToken:
      description: >-
        This API uses OAuth2 with the implicit grant flow. <a
        href="/authentication/oauth-authorization#implicit-grant">Learn about
        the implicit grant flow.</a>
      type: oauth2
      flows:
        implicit:
          authorizationUrl: https://accounts.livechat.com
          scopes: {}
        authorizationCode:
          authorizationUrl: https://accounts.livechat.com
          tokenUrl: https://accounts.livechat.com/token
          scopes: {}

````