# create_segment

Créer un segment

## Rôle

Dynamique (définition validée et compilée comme dans l'UI) ou statique (vide à la création). Quota de segments du plan.

## Accès

Scope principal : `marketing:write`. Le scope ne remplace pas les gardes de visibilité, d'organisation, de module ni les scopes complémentaires des gestes composés.

[Catalogue complet](/documentation/mcp-reference/) · [Approbations](/documentation/approbations/)

## Paramètres

Le schéma ci-dessous est produit par la fonction qui enregistre les outils, y compris `idempotency_key` lorsqu'elle s'applique. Consultez les objets imbriqués dans le schéma complet.
```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    },
    "kind": {
      "type": "string",
      "enum": [
        "dynamic",
        "static"
      ]
    },
    "object": {
      "description": "Défaut : contact",
      "type": "string",
      "enum": [
        "contact",
        "company"
      ]
    },
    "definition": {
      "description": "Dynamique : critères validés et compilés comme dans l'UI (422 sinon)",
      "type": "object",
      "properties": {
        "contactable": {
          "default": true,
          "type": "boolean"
        },
        "all": {
          "default": [],
          "maxItems": 20,
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "object": {
                "type": "string",
                "enum": [
                  "contact",
                  "company",
                  "affiliation",
                  "quote",
                  "order",
                  "contract",
                  "invoice",
                  "sales_activity",
                  "marketing_consent",
                  "marketing_delivery",
                  "event_invitation",
                  "marketing_touch",
                  "tag"
                ]
              },
              "field": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64
              },
              "op": {
                "type": "string",
                "enum": [
                  "is",
                  "is_not",
                  "contains",
                  "gt",
                  "lt",
                  "between",
                  "in",
                  "empty",
                  "not_empty",
                  "within_days",
                  "older_than_days"
                ]
              },
              "value": {
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 200
                  },
                  {
                    "type": "number"
                  },
                  {
                    "type": "boolean"
                  },
                  {
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 200
                    }
                  }
                ]
              },
              "not": {
                "type": "boolean"
              }
            },
            "required": [
              "object",
              "field",
              "op"
            ]
          }
        },
        "anyGroups": {
          "default": [],
          "maxItems": 5,
          "type": "array",
          "items": {
            "minItems": 1,
            "maxItems": 10,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "object": {
                  "type": "string",
                  "enum": [
                    "contact",
                    "company",
                    "affiliation",
                    "quote",
                    "order",
                    "contract",
                    "invoice",
                    "sales_activity",
                    "marketing_consent",
                    "marketing_delivery",
                    "event_invitation",
                    "marketing_touch",
                    "tag"
                  ]
                },
                "field": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64
                },
                "op": {
                  "type": "string",
                  "enum": [
                    "is",
                    "is_not",
                    "contains",
                    "gt",
                    "lt",
                    "between",
                    "in",
                    "empty",
                    "not_empty",
                    "within_days",
                    "older_than_days"
                  ]
                },
                "value": {
                  "anyOf": [
                    {
                      "type": "string",
                      "maxLength": 200
                    },
                    {
                      "type": "number"
                    },
                    {
                      "type": "boolean"
                    },
                    {
                      "maxItems": 50,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "maxLength": 200
                      }
                    }
                  ]
                },
                "not": {
                  "type": "boolean"
                }
              },
              "required": [
                "object",
                "field",
                "op"
              ]
            }
          }
        }
      }
    },
    "idempotency_key": {
      "description": "Clé d'idempotence (recommandée) : rejouer la MÊME mutation avec la même clé renvoie la réponse originale sans ré-exécuter - TTL 24 h",
      "type": "string",
      "minLength": 1,
      "maxLength": 200
    }
  },
  "required": [
    "name",
    "kind"
  ],
  "additionalProperties": false
}
```


Voir les schémas complets dans /documentation/mcp.json.
