# create_email_template

Créer un modèle d'email

## Rôle

Prépare un modèle sans envoi : nom, type campaign ou sequence, objet, blocs du catalogue existant. Image : fileId déjà accessible dans les modèles. Pied de page obligatoire ajouté automatiquement. Réutiliser idempotency_key lors d'un rejeu.

## 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": [
        "campaign",
        "sequence"
      ]
    },
    "subject": {
      "type": "string",
      "maxLength": 300
    },
    "preheader": {
      "default": "",
      "type": "string",
      "maxLength": 300
    },
    "blocks": {
      "maxItems": 60,
      "type": "array",
      "items": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "header"
              },
              "logo": {
                "default": "org",
                "type": "string",
                "enum": [
                  "org",
                  "unit"
                ]
              },
              "condition": {
                "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"
                ]
              }
            },
            "required": [
              "type"
            ]
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "title"
              },
              "text": {
                "type": "string",
                "maxLength": 200
              },
              "size": {
                "default": "large",
                "type": "string",
                "enum": [
                  "large",
                  "medium"
                ]
              },
              "condition": {
                "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"
                ]
              }
            },
            "required": [
              "type",
              "text"
            ]
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "paragraph"
              },
              "text": {
                "type": "string",
                "maxLength": 4000
              },
              "condition": {
                "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"
                ]
              }
            },
            "required": [
              "type",
              "text"
            ]
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "button"
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 80
              },
              "url": {
                "type": "string",
                "minLength": 1,
                "maxLength": 2000
              },
              "condition": {
                "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"
                ]
              }
            },
            "required": [
              "type",
              "label",
              "url"
            ]
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "image"
              },
              "fileId": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "alt": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              "width": {
                "default": 600,
                "type": "integer",
                "minimum": 100,
                "maximum": 600
              },
              "align": {
                "type": "string",
                "enum": [
                  "left",
                  "center",
                  "right"
                ]
              },
              "condition": {
                "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"
                ]
              }
            },
            "required": [
              "type",
              "fileId",
              "alt"
            ]
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "columns"
              },
              "left": {
                "type": "string",
                "maxLength": 4000
              },
              "right": {
                "type": "string",
                "maxLength": 4000
              },
              "condition": {
                "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"
                ]
              }
            },
            "required": [
              "type",
              "left",
              "right"
            ]
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "divider"
              },
              "condition": {
                "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"
                ]
              }
            },
            "required": [
              "type"
            ]
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "product"
              },
              "productId": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "condition": {
                "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"
                ]
              }
            },
            "required": [
              "type",
              "productId"
            ]
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "signature"
              },
              "condition": {
                "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"
                ]
              }
            },
            "required": [
              "type"
            ]
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "footer"
              }
            },
            "required": [
              "type"
            ]
          }
        ]
      }
    },
    "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",
    "subject",
    "blocks"
  ],
  "additionalProperties": false
}
```


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