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

# Crée un segment

> Crée un segment ; sa taille est estimée dans la foulée



## OpenAPI

````yaml /api-reference/openapi.json post /api/v1/segments
openapi: 3.1.0
info:
  title: API DexNotify
  version: '1'
  description: >-
    SMS, e-mail, WhatsApp, notifications push, contacts et campagnes, par une
    seule API. Authentification par clé API dans l’en-tête `x-api-key`.
servers:
  - url: https://api.dexnotify.com
    description: Production et staging
security:
  - api-key: []
tags:
  - name: SMS
  - name: E-mail
  - name: WhatsApp
  - name: Contacts
  - name: Listes de contacts
  - name: Campagnes
  - name: Modèles e-mail
  - name: Automatisations
  - name: Notifications push
  - name: Campagnes push
  - name: Journal des messages
  - name: In-app
  - name: Live Activities
  - name: Utilisateurs et appareils
  - name: Segments
  - name: Modèles push
  - name: Événements
  - name: Statistiques
paths:
  /api/v1/segments:
    post:
      tags:
        - Segments
      summary: Crée un segment ; sa taille est estimée dans la foulée
      operationId: SegmentsController_create_v1
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  minLength: 2
                  maxLength: 120
                description:
                  type: string
                  maxLength: 500
                rules:
                  type: object
                  properties:
                    match:
                      default: all
                      type: string
                      enum:
                        - all
                        - any
                    conditions:
                      minItems: 1
                      maxItems: 20
                      type: array
                      items:
                        oneOf:
                          - type: object
                            properties:
                              kind:
                                type: string
                                const: field
                              field:
                                type: string
                                minLength: 1
                                maxLength: 80
                              operator:
                                type: string
                                enum:
                                  - eq
                                  - ne
                                  - in
                                  - nin
                                  - gt
                                  - gte
                                  - lt
                                  - lte
                                  - contains
                                  - exists
                                  - within_last
                                  - not_within_last
                                  - version_gt
                                  - version_lt
                              value:
                                anyOf:
                                  - type: string
                                  - type: number
                                  - type: boolean
                                  - maxItems: 100
                                    type: array
                                    items:
                                      type:
                                        - string
                                        - number
                            required:
                              - kind
                              - field
                              - operator
                              - value
                          - type: object
                            properties:
                              kind:
                                type: string
                                const: event
                              event:
                                type: string
                                minLength: 1
                                maxLength: 120
                              atLeast:
                                type: integer
                                minimum: 1
                                maximum: 10000
                              withinDays:
                                type: integer
                                minimum: 1
                                maximum: 365
                            required:
                              - kind
                              - event
                              - atLeast
                              - withinDays
                    groups:
                      maxItems: 5
                      type: array
                      items:
                        type: object
                        properties:
                          match:
                            default: any
                            type: string
                            enum:
                              - all
                              - any
                          conditions:
                            minItems: 1
                            maxItems: 20
                            type: array
                            items:
                              oneOf:
                                - type: object
                                  properties:
                                    kind:
                                      type: string
                                      const: field
                                    field:
                                      type: string
                                      minLength: 1
                                      maxLength: 80
                                    operator:
                                      type: string
                                      enum:
                                        - eq
                                        - ne
                                        - in
                                        - nin
                                        - gt
                                        - gte
                                        - lt
                                        - lte
                                        - contains
                                        - exists
                                        - within_last
                                        - not_within_last
                                        - version_gt
                                        - version_lt
                                    value:
                                      anyOf:
                                        - type: string
                                        - type: number
                                        - type: boolean
                                        - maxItems: 100
                                          type: array
                                          items:
                                            type:
                                              - string
                                              - number
                                  required:
                                    - kind
                                    - field
                                    - operator
                                    - value
                                - type: object
                                  properties:
                                    kind:
                                      type: string
                                      const: event
                                    event:
                                      type: string
                                      minLength: 1
                                      maxLength: 120
                                    atLeast:
                                      type: integer
                                      minimum: 1
                                      maximum: 10000
                                    withinDays:
                                      type: integer
                                      minimum: 1
                                      maximum: 365
                                  required:
                                    - kind
                                    - event
                                    - atLeast
                                    - withinDays
                        required:
                          - conditions
                    excludedSegmentIds:
                      maxItems: 20
                      type: array
                      items:
                        type: string
                        pattern: ^[0-9a-fA-F]{24}$
                  required:
                    - conditions
              required:
                - name
                - rules
      responses:
        '201':
          description: Segment créé, taille estimée et datée
      security:
        - api-key: []
components:
  securitySchemes:
    api-key:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        Clé API du projet, créée dans le dashboard (Développeurs › Clés API et
        SDK). Une clé `dxn_prod_` vise la production, une clé `dxn_stag_` le
        staging.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.