# POST /v2/membershipplan

Mitgliedschaftsplan als Entwurf erstellen

Erstellt einen Plan im Status draft mit Version 1. Fehlende Konfiguration nutzt Standards (ein Jahr, kein Rabatt, kostenlos, keine Verlängerung). Texte und Geltungsbereich dürfen im Entwurf fehlen. internal/published benötigen später insbesondere Kontosprachenname, Geltungsbereich und eigene Mehrwertsteuer; Veröffentlichung zusätzlich erfolgreichen Preflight. request_id dient der Audit-Korrelation. Keine Kaufzuweisung.

- Operation-ID: post_v2_membershipplan
- Dokumentation: /docs/api/v2/operations/post-v2-membershipplan-fc2811bf7d6d/
- OpenAPI-Version: 3.2.1
- Vollständige Spezifikation: /docs/api/v2/openapi.json
- Dokumentationsstatus: reviewed
- Ändert Zustand: ja
- Für Automation freigegeben: nein

## Server

Serverwerte stammen unverändert aus der Datei. Eine lokale Entwicklungsadresse ist keine bestätigte Produktionsadresse. `API_ORIGIN` muss auf die passende Instanz gesetzt werden.

```json
[
  {
    "url": "https://app2.edoobox.com",
    "description": "edoobox API"
  }
]
```

## Authentifizierung

Eine der folgenden Alternativen genügt (ODER). Innerhalb einer Alternative müssen alle Verfahren gemeinsam erfüllt sein (UND).

1. **bearerAuth** (HTTP bearer) — Existing edoobox v2 access token. Never substitute API key/secret headers. **UND** **accountContext** (header: edid) — Selected login/account context from the JWT, not a database primary key. Required even for a JWT with one account.
2. **sessionCookie** (cookie: _edlogin) — Existing browser login session, with the same permission checks as Bearer authentication. **UND** **accountContext** (header: edid) — Selected login/account context from the JWT, not a database primary key. Required even for a JWT with one account.

### Wirksame Security Requirements und vollständige Verfahren

```json
{
  "security": [
    {
      "bearerAuth": [],
      "accountContext": []
    },
    {
      "sessionCookie": [],
      "accountContext": []
    }
  ],
  "securitySchemes": {
    "bearerAuth": {
      "type": "http",
      "scheme": "bearer",
      "bearerFormat": "JWT",
      "description": "Existing edoobox v2 access token. Never substitute API key/secret headers."
    },
    "accountContext": {
      "type": "apiKey",
      "in": "header",
      "name": "edid",
      "description": "Selected login/account context from the JWT, not a database primary key. Required even for a JWT with one account."
    },
    "sessionCookie": {
      "type": "apiKey",
      "in": "cookie",
      "name": "_edlogin",
      "description": "Existing browser login session, with the same permission checks as Bearer authentication."
    }
  }
}
```

## Parameter

| Name | Ort | Pflicht | Beschreibung |
| --- | --- | --- | --- |
| X-Edoobox-If-Revision | header | nein | Optional account mutation revision from a preceding authenticated auth-context snapshot. The dispatcher compares it while holding the account lock; mismatch409 requires a new review. |

### Vollständige wirksame Parameterdefinitionen

```json
[
  {
    "name": "X-Edoobox-If-Revision",
    "in": "header",
    "required": false,
    "schema": {
      "type": "string",
      "pattern": "^[a-f0-9]{32}$",
      "examples": [
        "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
      ]
    },
    "description": "Optional account mutation revision from a preceding authenticated auth-context snapshot. The dispatcher compares it while holding the account lock; mismatch409 requires a new review."
  }
]
```

## Anfrage

```json
{
  "required": false,
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "validity": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "fixed_range",
                      "relative_duration",
                      "usage_count"
                    ],
                    "default": "relative_duration"
                  },
                  "from": {
                    "type": [
                      "integer",
                      "number",
                      "string",
                      "null"
                    ],
                    "description": "Unix-Sekunden oder strtotime-lesbarer Datumsstring; feste Gültigkeit benötigt from < until."
                  },
                  "until": {
                    "type": [
                      "integer",
                      "number",
                      "string",
                      "null"
                    ]
                  },
                  "value": {
                    "type": [
                      "integer",
                      "number",
                      "string",
                      "boolean"
                    ],
                    "description": "Positive Dauer für relative_duration; Standard 1."
                  },
                  "unit": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "enum": [
                      "day",
                      "month",
                      "year",
                      null
                    ],
                    "default": "year"
                  },
                  "uses": {
                    "type": [
                      "integer",
                      "number",
                      "string",
                      "boolean"
                    ],
                    "description": "Positive Anzahl für usage_count."
                  },
                  "promo_code_redemption": {
                    "type": [
                      "boolean",
                      "integer",
                      "string"
                    ],
                    "description": "Normalisierung mit FILTER_VALIDATE_BOOL; z.B. true/false, 1/0 und \"true\"/\"false\"."
                  }
                },
                "additionalProperties": true
              },
              "discount": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "percent",
                      "fixed"
                    ],
                    "default": "percent"
                  },
                  "value": {
                    "type": [
                      "string",
                      "number"
                    ],
                    "description": "Nichtnegativer Betrag, Punkt oder Komma; maximal vier Eingabenachkommastellen, auf zwei gerundet. Bei percent höchstens 100."
                  },
                  "currency": {
                    "type": "string",
                    "description": "Dreistelliger ISO-Code für fixed; bei percent verworfen."
                  }
                },
                "additionalProperties": true
              },
              "sale": {
                "type": "object",
                "properties": {
                  "amount": {
                    "type": [
                      "string",
                      "number"
                    ],
                    "description": "Nichtnegativ, Punkt oder Komma, maximal vier Nachkommastellen, auf zwei gerundet; Standard 0."
                  },
                  "currency": {
                    "type": "string",
                    "description": "Dreistelliger Währungscode, auf Großbuchstaben normalisiert; Standard Kontowährung."
                  },
                  "vat": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "pattern": "^vat_[a-f0-9]{12}_-?[0-9]+$",
                    "description": "Öffentliche v2-ID aus diesem Konto; keine rohe Datenbank-ID."
                  }
                },
                "additionalProperties": true
              },
              "publication": {
                "type": "object",
                "properties": {
                  "design": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "pattern": "^design_[a-f0-9]{12}_-?[0-9]+$",
                    "description": "Öffentliche v2-ID aus diesem Konto; keine rohe Datenbank-ID."
                  }
                },
                "additionalProperties": true
              },
              "renewal": {
                "type": "object",
                "properties": {
                  "allowed": {
                    "type": [
                      "boolean",
                      "integer",
                      "string"
                    ],
                    "description": "Normalisierung mit FILTER_VALIDATE_BOOL; z.B. true/false, 1/0 und \"true\"/\"false\"."
                  },
                  "default": {
                    "type": [
                      "boolean",
                      "integer",
                      "string"
                    ],
                    "description": "Normalisierung mit FILTER_VALIDATE_BOOL; z.B. true/false, 1/0 und \"true\"/\"false\"."
                  },
                  "reminder_days": {
                    "type": [
                      "integer",
                      "number",
                      "string",
                      "boolean"
                    ],
                    "description": "Wird auf 0–365 begrenzt, Standard 30."
                  },
                  "duration_value": {
                    "type": [
                      "integer",
                      "number",
                      "string",
                      "boolean"
                    ],
                    "description": "Positive Verlängerungsdauer, insbesondere für fixed_range."
                  },
                  "duration_unit": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "enum": [
                      "day",
                      "month",
                      "year",
                      null
                    ]
                  }
                },
                "additionalProperties": true
              },
              "texts": {
                "type": "object",
                "additionalProperties": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string",
                      "maxLength": 150
                    },
                    "description_html": {
                      "type": "string",
                      "description": "Wird HTML-bereinigt."
                    }
                  },
                  "additionalProperties": true
                },
                "description": "Sprachcode → Textobjekt. Codes werden klein geschrieben; Name der Kontostandardsprache ist erst für internal/published erforderlich."
              },
              "scopes": {
                "type": [
                  "array",
                  "object"
                ],
                "items": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "root",
                        "category",
                        "offer"
                      ]
                    },
                    "resource": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "v2 category-/offer-ID; bei root null."
                    },
                    "id": {
                      "type": "string",
                      "description": "Eingabealias für resource."
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "type"
                  ]
                },
                "additionalProperties": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "root",
                        "category",
                        "offer"
                      ]
                    },
                    "resource": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "v2 category-/offer-ID; bei root null."
                    },
                    "id": {
                      "type": "string",
                      "description": "Eingabealias für resource."
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "type"
                  ]
                }
              },
              "allow_parallel_instances": {
                "type": [
                  "boolean",
                  "integer",
                  "string"
                ],
                "description": "Normalisierung mit FILTER_VALIDATE_BOOL; z.B. true/false, 1/0 und \"true\"/\"false\"."
              },
              "sort_order": {
                "type": [
                  "integer",
                  "number",
                  "string",
                  "boolean"
                ],
                "description": "Wird serverseitig nach Integer konvertiert; für neue Clients eine ganze Zahl senden."
              },
              "internal_reference": {
                "type": "string",
                "description": "Gekürzt auf 100 Zeichen."
              },
              "request_id": {
                "type": "string",
                "description": "Optionale Audit-Korrelation; für Pläne keine Idempotenzgarantie."
              },
              "validity_type": {
                "type": "string",
                "enum": [
                  "fixed_range",
                  "relative_duration",
                  "usage_count"
                ],
                "default": "relative_duration",
                "description": "Flacher Eingabealias; die entsprechende verschachtelte Eigenschaft hat Vorrang."
              },
              "fixed_valid_from": {
                "type": [
                  "integer",
                  "number",
                  "string",
                  "null"
                ],
                "description": "Flacher Eingabealias; die entsprechende verschachtelte Eigenschaft hat Vorrang."
              },
              "fixed_valid_until": {
                "type": [
                  "integer",
                  "number",
                  "string",
                  "null"
                ],
                "description": "Flacher Eingabealias; die entsprechende verschachtelte Eigenschaft hat Vorrang."
              },
              "duration_value": {
                "type": [
                  "integer",
                  "number",
                  "string",
                  "boolean"
                ],
                "description": "Flacher Eingabealias; die entsprechende verschachtelte Eigenschaft hat Vorrang."
              },
              "duration_unit": {
                "type": "string",
                "description": "Flacher Eingabealias; die entsprechende verschachtelte Eigenschaft hat Vorrang."
              },
              "included_uses": {
                "type": [
                  "integer",
                  "number",
                  "string",
                  "boolean"
                ],
                "description": "Flacher Eingabealias; die entsprechende verschachtelte Eigenschaft hat Vorrang."
              },
              "promo_code_redemption_enabled": {
                "type": [
                  "boolean",
                  "integer",
                  "string"
                ],
                "description": "Flacher Eingabealias; die entsprechende verschachtelte Eigenschaft hat Vorrang."
              },
              "discount_type": {
                "type": "string",
                "enum": [
                  "percent",
                  "fixed"
                ],
                "default": "percent",
                "description": "Flacher Eingabealias; die entsprechende verschachtelte Eigenschaft hat Vorrang."
              },
              "discount_value": {
                "type": [
                  "string",
                  "number"
                ],
                "description": "Flacher Eingabealias; die entsprechende verschachtelte Eigenschaft hat Vorrang."
              },
              "discount_currency_iso": {
                "type": "string",
                "description": "Flacher Eingabealias; die entsprechende verschachtelte Eigenschaft hat Vorrang."
              },
              "sale_price": {
                "type": [
                  "string",
                  "number"
                ],
                "description": "Flacher Eingabealias; die entsprechende verschachtelte Eigenschaft hat Vorrang."
              },
              "sale_currency_iso": {
                "type": "string",
                "description": "Flacher Eingabealias; die entsprechende verschachtelte Eigenschaft hat Vorrang."
              },
              "vat": {
                "type": [
                  "string",
                  "null"
                ],
                "pattern": "^vat_[a-f0-9]{12}_-?[0-9]+$",
                "description": "Flacher Eingabealias; die entsprechende verschachtelte Eigenschaft hat Vorrang."
              },
              "design": {
                "type": [
                  "string",
                  "null"
                ],
                "pattern": "^design_[a-f0-9]{12}_-?[0-9]+$",
                "description": "Flacher Eingabealias; die entsprechende verschachtelte Eigenschaft hat Vorrang."
              },
              "auto_renew_allowed": {
                "type": [
                  "boolean",
                  "integer",
                  "string"
                ],
                "description": "Flacher Eingabealias; die entsprechende verschachtelte Eigenschaft hat Vorrang."
              },
              "auto_renew_default": {
                "type": [
                  "boolean",
                  "integer",
                  "string"
                ],
                "description": "Flacher Eingabealias; die entsprechende verschachtelte Eigenschaft hat Vorrang."
              },
              "reminder_days": {
                "type": [
                  "integer",
                  "number",
                  "string",
                  "boolean"
                ],
                "description": "Flacher Eingabealias; die entsprechende verschachtelte Eigenschaft hat Vorrang."
              },
              "renewal_duration_value": {
                "type": [
                  "integer",
                  "number",
                  "string",
                  "boolean"
                ],
                "description": "Flacher Eingabealias; die entsprechende verschachtelte Eigenschaft hat Vorrang."
              },
              "renewal_duration_unit": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Flacher Eingabealias; die entsprechende verschachtelte Eigenschaft hat Vorrang."
              }
            },
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      },
      "examples": {
        "request": {
          "summary": "Mitgliedschaftsplan als Entwurf erstellen",
          "value": {
            "data": {
              "texts": {
                "de": {
                  "name": "Jahresmitgliedschaft",
                  "description_html": "<p>Vorteile für ein Jahr</p>"
                }
              },
              "validity": {
                "type": "relative_duration",
                "value": 1,
                "unit": "year"
              },
              "sale": {
                "amount": "120.00",
                "currency": "CHF"
              },
              "discount": {
                "type": "percent",
                "value": "10.00"
              },
              "scopes": [
                {
                  "type": "root"
                }
              ]
            }
          }
        }
      }
    }
  }
}
```

## Antworten

HTTP-Status und Antwortinhalt gemeinsam auswerten. Die folgenden Beschreibungen und Schemata sind die Angaben der Quelldatei.

```json
{
  "200": {
    "description": "data enthält das dokumentierte Ergebnisobjekt; error=false und success=true.",
    "content": {
      "application/json": {
        "example": {
          "success": true,
          "error": false,
          "data": {
            "id": "membershipplan_012345abcdef_123456",
            "version": 1,
            "status": "draft",
            "name": "Jahresmitgliedschaft",
            "description_html": "<p>Vorteile für ein Jahr</p>",
            "language": "de",
            "validity": {
              "type": "relative_duration",
              "from": null,
              "until": null,
              "value": 1,
              "unit": "year",
              "uses": null,
              "promo_code_redemption": false
            },
            "discount": {
              "type": "percent",
              "value": "10.00",
              "currency": null
            },
            "sale": {
              "amount": "120.00",
              "currency": "CHF",
              "vat": null
            },
            "publication": {
              "design": null
            },
            "renewal": {
              "allowed": false,
              "default": false,
              "reminder_days": 30,
              "duration_value": null,
              "duration_unit": null
            },
            "allow_parallel_instances": false,
            "active_customer_count": 0,
            "sort_order": 0,
            "internal_reference": "Mitgliedschaft 2027",
            "scopes": [
              {
                "type": "root",
                "resource": null
              }
            ],
            "published_at": null,
            "archived_at": null,
            "created_at": 1790000000,
            "updated_at": 1790000000,
            "texts": {
              "de": {
                "name": "Jahresmitgliedschaft",
                "description_html": "<p>Vorteile für ein Jahr</p>",
                "content_hash": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
              }
            }
          }
        },
        "schema": {
          "type": "object",
          "properties": {
            "success": {
              "type": "boolean"
            },
            "error": {
              "type": [
                "boolean",
                "string"
              ]
            },
            "error_code": {
              "type": "string"
            },
            "data": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "pattern": "^membershipplan_[a-f0-9]{12}_-?[0-9]+$",
                  "description": "Öffentliche v2-ID aus diesem Konto; keine rohe Datenbank-ID."
                },
                "version": {
                  "type": "integer"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "draft",
                    "internal",
                    "published",
                    "archived"
                  ]
                },
                "name": {
                  "type": "string"
                },
                "description_html": {
                  "type": "string"
                },
                "language": {
                  "type": "string"
                },
                "validity": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "fixed_range",
                        "relative_duration",
                        "usage_count"
                      ]
                    },
                    "from": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "until": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "value": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "unit": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "uses": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "promo_code_redemption": {
                      "type": "boolean"
                    }
                  },
                  "additionalProperties": true
                },
                "discount": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "percent",
                        "fixed"
                      ]
                    },
                    "value": {
                      "type": "string",
                      "pattern": "^-?[0-9]+\\.[0-9]{2}$",
                      "description": "Dezimalbetrag als String mit zwei Nachkommastellen."
                    },
                    "currency": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "additionalProperties": true
                },
                "sale": {
                  "type": "object",
                  "properties": {
                    "amount": {
                      "type": "string",
                      "pattern": "^-?[0-9]+\\.[0-9]{2}$",
                      "description": "Dezimalbetrag als String mit zwei Nachkommastellen."
                    },
                    "currency": {
                      "type": "string"
                    },
                    "vat": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "pattern": "^vat_[a-f0-9]{12}_-?[0-9]+$",
                      "description": "Öffentliche v2-ID aus diesem Konto; keine rohe Datenbank-ID."
                    }
                  },
                  "additionalProperties": true
                },
                "publication": {
                  "type": "object",
                  "properties": {
                    "design": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "pattern": "^design_[a-f0-9]{12}_-?[0-9]+$",
                      "description": "Öffentliche v2-ID aus diesem Konto; keine rohe Datenbank-ID."
                    }
                  },
                  "additionalProperties": true
                },
                "renewal": {
                  "type": "object",
                  "properties": {
                    "allowed": {
                      "type": "boolean"
                    },
                    "default": {
                      "type": "boolean"
                    },
                    "reminder_days": {
                      "type": "integer"
                    },
                    "duration_value": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "duration_unit": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "additionalProperties": true
                },
                "allow_parallel_instances": {
                  "type": "boolean"
                },
                "active_customer_count": {
                  "type": "integer"
                },
                "sort_order": {
                  "type": "integer"
                },
                "internal_reference": {
                  "type": "string"
                },
                "scopes": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "root",
                          "category",
                          "offer"
                        ]
                      },
                      "resource": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "description": "v2 category-/offer-ID; bei root null."
                      },
                      "id": {
                        "type": "string",
                        "description": "Eingabealias für resource."
                      }
                    },
                    "additionalProperties": true,
                    "required": [
                      "type"
                    ]
                  }
                },
                "published_at": {
                  "type": [
                    "integer",
                    "null"
                  ]
                },
                "archived_at": {
                  "type": [
                    "integer",
                    "null"
                  ]
                },
                "created_at": {
                  "type": "integer"
                },
                "updated_at": {
                  "type": "integer"
                },
                "texts": {
                  "type": [
                    "object",
                    "array"
                  ],
                  "additionalProperties": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "description_html": {
                        "type": "string"
                      },
                      "content_hash": {
                        "type": "string"
                      }
                    },
                    "additionalProperties": true
                  },
                  "items": {},
                  "description": "Sprachcode → Textobjekt; ohne Übersetzungen kann PHP [] liefern."
                }
              },
              "additionalProperties": true,
              "required": [
                "id",
                "version",
                "status",
                "name",
                "description_html",
                "language",
                "validity",
                "discount",
                "sale",
                "publication",
                "renewal",
                "allow_parallel_instances",
                "active_customer_count",
                "sort_order",
                "internal_reference",
                "scopes",
                "published_at",
                "archived_at",
                "created_at",
                "updated_at",
                "texts"
              ]
            },
            "type": {
              "type": "string"
            }
          },
          "additionalProperties": true
        }
      }
    },
    "headers": {
      "X-Edoobox-Revision": {
        "schema": {
          "type": "string",
          "pattern": "^[a-f0-9]{32}$"
        },
        "description": "Rotated account revision supplied for the next action in one reviewed sequence."
      }
    }
  },
  "400": {
    "description": "Invalid request.",
    "content": {
      "application/json": {
        "example": {
          "success": false,
          "error": "ED40006"
        }
      }
    }
  },
  "401": {
    "description": "Missing/expired token, missing account context, account paused or model-specific authorization failure.",
    "content": {
      "application/json": {
        "example": {
          "success": false,
          "error": "ED40103"
        }
      }
    }
  },
  "402": {
    "description": "Missing/invalid action data or subscription/operation restriction.",
    "content": {
      "application/json": {
        "example": {
          "success": false,
          "error": "ED80100"
        }
      }
    }
  },
  "403": {
    "description": "Permission denied. Browser CORS rejection may have an empty body.",
    "content": {
      "application/json": {
        "example": {
          "success": false,
          "error": "ED40340"
        }
      }
    }
  },
  "404": {
    "description": "Unknown resource/action or unsupported method.",
    "content": {
      "application/json": {
        "example": {
          "success": false,
          "error": "ED80019"
        }
      }
    }
  },
  "409": {
    "description": "The account changed after the reviewed read. No domain operation is dispatched; obtain fresh state and review again.",
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "additionalProperties": true
        },
        "example": {
          "error": "ED40901",
          "error_code": "mutation_revision_conflict"
        }
      }
    }
  },
  "422": {
    "description": "Validation failed.",
    "content": {
      "application/json": {
        "example": {
          "success": false,
          "error": "ED80020"
        }
      }
    }
  },
  "429": {
    "description": "Request/login rate limit exceeded. Honor Retry-After when supplied; legacy rate-limit paths may omit it. Retry only proven reads within a bounded deadline; a mutation is never automatically replayed after an ambiguous response.",
    "content": {
      "application/json": {
        "example": {
          "success": false,
          "error": "ED42902"
        }
      }
    },
    "headers": {
      "Retry-After": {
        "description": "Optional server delay in whole seconds or an HTTP date. Absence is not permission for an immediate retry.",
        "schema": {
          "type": "string",
          "examples": [
            "30"
          ]
        }
      }
    }
  },
  "502": {
    "description": "Server-side operation failed.",
    "content": {
      "application/json": {
        "example": {
          "success": false,
          "error": "ED50201"
        }
      }
    }
  },
  "503": {
    "description": "The account mutation lock or revision store is unavailable. No unprotected fallback is executed.",
    "headers": {
      "Retry-After": {
        "schema": {
          "type": "integer",
          "const": 1
        }
      }
    },
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "additionalProperties": true
        },
        "example": {
          "error": "ED50301",
          "error_code": "mutation_revision_busy"
        }
      }
    }
  }
}
```

## Aufrufbeispiele

Anpassen vor dem Ausführen. Platzhalter und veröffentlichte Beispiele sind synthetisch. Die Beispiele senden hier keine Anfrage; sie ergänzen keine unbekannten Pflichtfelder.

### cURL

```sh
# Zeigt Authentifizierungsalternative 1; alle Verfahren dieser Alternative sind gemeinsam erforderlich.
# Request Body: synthetisches Beispiel aus der Spezifikation; Werte und Vollständigkeit vor Verwendung prüfen.
: "${API_ORIGIN:?API_ORIGIN setzen}"
: "${AUTH_BEARERAUTH:?AUTH_BEARERAUTH setzen}"
: "${AUTH_ACCOUNTCONTEXT:?AUTH_ACCOUNTCONTEXT setzen}"
cat > payload.json <<'EDOOBOX_JSON_EXAMPLE'
{
  "data": {
    "texts": {
      "de": {
        "name": "Jahresmitgliedschaft",
        "description_html": "<p>Vorteile für ein Jahr</p>"
      }
    },
    "validity": {
      "type": "relative_duration",
      "value": 1,
      "unit": "year"
    },
    "sale": {
      "amount": "120.00",
      "currency": "CHF"
    },
    "discount": {
      "type": "percent",
      "value": "10.00"
    },
    "scopes": [
      {
        "type": "root"
      }
    ]
  }
}
EDOOBOX_JSON_EXAMPLE
curl --request 'POST' \
  --url "${API_ORIGIN%/}"'/v2/membershipplan' \
  --header 'Authorization: Bearer '"${AUTH_BEARERAUTH}" \
  --header 'edid: '"${AUTH_ACCOUNTCONTEXT}" \
  --header 'Content-Type: application/json' \
  --data-binary '@payload.json'
```

### JavaScript (Node.js)

```javascript
// Zeigt Authentifizierungsalternative 1; alle Verfahren dieser Alternative sind gemeinsam erforderlich.
// Request Body: synthetisches Beispiel aus der Spezifikation; Werte und Vollständigkeit vor Verwendung prüfen.
const required = (name) => {
  const value = process.env[name];
  if (!value) throw new Error(`Set ${name}`);
  return value;
};
let path = "/v2/membershipplan";
const origin = required('API_ORIGIN');
const url = new URL((origin.endsWith('/') ? origin.slice(0, -1) : origin) + path);
const headers = {};
headers["Authorization"] = "Bearer " + required("AUTH_BEARERAUTH");
headers["edid"] = "" + required("AUTH_ACCOUNTCONTEXT");
headers['Content-Type'] = "application/json";
const body = JSON.stringify({
  "data": {
    "texts": {
      "de": {
        "name": "Jahresmitgliedschaft",
        "description_html": "<p>Vorteile für ein Jahr</p>"
      }
    },
    "validity": {
      "type": "relative_duration",
      "value": 1,
      "unit": "year"
    },
    "sale": {
      "amount": "120.00",
      "currency": "CHF"
    },
    "discount": {
      "type": "percent",
      "value": "10.00"
    },
    "scopes": [
      {
        "type": "root"
      }
    ]
  }
});
const response = await fetch(url, { method: "POST", headers, body, redirect: 'manual' });
const text = await response.text();
console.log(response.status, text);
// HTTP-Status und dokumentierte error/success-Felder gemeinsam prüfen.
```

### Python

```python
# Zeigt Authentifizierungsalternative 1; alle Verfahren dieser Alternative sind gemeinsam erforderlich.
# Request Body: synthetisches Beispiel aus der Spezifikation; Werte und Vollständigkeit vor Verwendung prüfen.
import os
import urllib.parse
import urllib.request
import urllib.error

path = "/v2/membershipplan"
url = os.environ["API_ORIGIN"].rstrip("/") + path
headers = {}
headers["Authorization"] = "Bearer " + os.environ["AUTH_BEARERAUTH"]
headers["edid"] = "" + os.environ["AUTH_ACCOUNTCONTEXT"]
headers["Content-Type"] = "application/json"
body = "{\"data\":{\"texts\":{\"de\":{\"name\":\"Jahresmitgliedschaft\",\"description_html\":\"<p>Vorteile für ein Jahr</p>\"}},\"validity\":{\"type\":\"relative_duration\",\"value\":1,\"unit\":\"year\"},\"sale\":{\"amount\":\"120.00\",\"currency\":\"CHF\"},\"discount\":{\"type\":\"percent\",\"value\":\"10.00\"},\"scopes\":[{\"type\":\"root\"}]}}".encode("utf-8")

# Redirects nicht automatisch verfolgen.
class NoRedirect(urllib.request.HTTPRedirectHandler):
    def redirect_request(self, req, fp, code, msg, headers, newurl):
        return None
request = urllib.request.Request(url, headers=headers, method="POST", data=body)
try:
    response = urllib.request.build_opener(NoRedirect).open(request, timeout=30)
except urllib.error.HTTPError as error:
    response = error
print(response.status, response.read().decode("utf-8", errors="replace"))
# HTTP-Status und dokumentierte error/success-Felder gemeinsam prüfen.
```

## Vollständige Operationsdefinition und edoobox-Hinweise

Alle Originalfelder einschliesslich `x-edoobox-*`, requestBody und responses bleiben erhalten. Teilweise dokumentierte Schemata sind kein vollständiger Validierungsvertrag.

```json
{
  "operationId": "post_v2_membershipplan",
  "summary": "Mitgliedschaftsplan als Entwurf erstellen",
  "description": "Erstellt einen Plan im Status draft mit Version 1. Fehlende Konfiguration nutzt Standards (ein Jahr, kein Rabatt, kostenlos, keine Verlängerung). Texte und Geltungsbereich dürfen im Entwurf fehlen. internal/published benötigen später insbesondere Kontosprachenname, Geltungsbereich und eigene Mehrwertsteuer; Veröffentlichung zusätzlich erfolgreichen Preflight. request_id dient der Audit-Korrelation. Keine Kaufzuweisung.",
  "tags": [
    "membershipplan"
  ],
  "security": [
    {
      "bearerAuth": [],
      "accountContext": []
    },
    {
      "sessionCookie": [],
      "accountContext": []
    }
  ],
  "parameters": [
    {
      "name": "X-Edoobox-If-Revision",
      "in": "header",
      "required": false,
      "schema": {
        "type": "string",
        "pattern": "^[a-f0-9]{32}$",
        "examples": [
          "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
        ]
      },
      "description": "Optional account mutation revision from a preceding authenticated auth-context snapshot. The dispatcher compares it while holding the account lock; mismatch409 requires a new review."
    }
  ],
  "responses": {
    "200": {
      "description": "data enthält das dokumentierte Ergebnisobjekt; error=false und success=true.",
      "content": {
        "application/json": {
          "example": {
            "success": true,
            "error": false,
            "data": {
              "id": "membershipplan_012345abcdef_123456",
              "version": 1,
              "status": "draft",
              "name": "Jahresmitgliedschaft",
              "description_html": "<p>Vorteile für ein Jahr</p>",
              "language": "de",
              "validity": {
                "type": "relative_duration",
                "from": null,
                "until": null,
                "value": 1,
                "unit": "year",
                "uses": null,
                "promo_code_redemption": false
              },
              "discount": {
                "type": "percent",
                "value": "10.00",
                "currency": null
              },
              "sale": {
                "amount": "120.00",
                "currency": "CHF",
                "vat": null
              },
              "publication": {
                "design": null
              },
              "renewal": {
                "allowed": false,
                "default": false,
                "reminder_days": 30,
                "duration_value": null,
                "duration_unit": null
              },
              "allow_parallel_instances": false,
              "active_customer_count": 0,
              "sort_order": 0,
              "internal_reference": "Mitgliedschaft 2027",
              "scopes": [
                {
                  "type": "root",
                  "resource": null
                }
              ],
              "published_at": null,
              "archived_at": null,
              "created_at": 1790000000,
              "updated_at": 1790000000,
              "texts": {
                "de": {
                  "name": "Jahresmitgliedschaft",
                  "description_html": "<p>Vorteile für ein Jahr</p>",
                  "content_hash": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
                }
              }
            }
          },
          "schema": {
            "type": "object",
            "properties": {
              "success": {
                "type": "boolean"
              },
              "error": {
                "type": [
                  "boolean",
                  "string"
                ]
              },
              "error_code": {
                "type": "string"
              },
              "data": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^membershipplan_[a-f0-9]{12}_-?[0-9]+$",
                    "description": "Öffentliche v2-ID aus diesem Konto; keine rohe Datenbank-ID."
                  },
                  "version": {
                    "type": "integer"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "draft",
                      "internal",
                      "published",
                      "archived"
                    ]
                  },
                  "name": {
                    "type": "string"
                  },
                  "description_html": {
                    "type": "string"
                  },
                  "language": {
                    "type": "string"
                  },
                  "validity": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "fixed_range",
                          "relative_duration",
                          "usage_count"
                        ]
                      },
                      "from": {
                        "type": [
                          "integer",
                          "null"
                        ]
                      },
                      "until": {
                        "type": [
                          "integer",
                          "null"
                        ]
                      },
                      "value": {
                        "type": [
                          "integer",
                          "null"
                        ]
                      },
                      "unit": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "uses": {
                        "type": [
                          "integer",
                          "null"
                        ]
                      },
                      "promo_code_redemption": {
                        "type": "boolean"
                      }
                    },
                    "additionalProperties": true
                  },
                  "discount": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "percent",
                          "fixed"
                        ]
                      },
                      "value": {
                        "type": "string",
                        "pattern": "^-?[0-9]+\\.[0-9]{2}$",
                        "description": "Dezimalbetrag als String mit zwei Nachkommastellen."
                      },
                      "currency": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "additionalProperties": true
                  },
                  "sale": {
                    "type": "object",
                    "properties": {
                      "amount": {
                        "type": "string",
                        "pattern": "^-?[0-9]+\\.[0-9]{2}$",
                        "description": "Dezimalbetrag als String mit zwei Nachkommastellen."
                      },
                      "currency": {
                        "type": "string"
                      },
                      "vat": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "pattern": "^vat_[a-f0-9]{12}_-?[0-9]+$",
                        "description": "Öffentliche v2-ID aus diesem Konto; keine rohe Datenbank-ID."
                      }
                    },
                    "additionalProperties": true
                  },
                  "publication": {
                    "type": "object",
                    "properties": {
                      "design": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "pattern": "^design_[a-f0-9]{12}_-?[0-9]+$",
                        "description": "Öffentliche v2-ID aus diesem Konto; keine rohe Datenbank-ID."
                      }
                    },
                    "additionalProperties": true
                  },
                  "renewal": {
                    "type": "object",
                    "properties": {
                      "allowed": {
                        "type": "boolean"
                      },
                      "default": {
                        "type": "boolean"
                      },
                      "reminder_days": {
                        "type": "integer"
                      },
                      "duration_value": {
                        "type": [
                          "integer",
                          "null"
                        ]
                      },
                      "duration_unit": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "additionalProperties": true
                  },
                  "allow_parallel_instances": {
                    "type": "boolean"
                  },
                  "active_customer_count": {
                    "type": "integer"
                  },
                  "sort_order": {
                    "type": "integer"
                  },
                  "internal_reference": {
                    "type": "string"
                  },
                  "scopes": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "root",
                            "category",
                            "offer"
                          ]
                        },
                        "resource": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "v2 category-/offer-ID; bei root null."
                        },
                        "id": {
                          "type": "string",
                          "description": "Eingabealias für resource."
                        }
                      },
                      "additionalProperties": true,
                      "required": [
                        "type"
                      ]
                    }
                  },
                  "published_at": {
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "archived_at": {
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "created_at": {
                    "type": "integer"
                  },
                  "updated_at": {
                    "type": "integer"
                  },
                  "texts": {
                    "type": [
                      "object",
                      "array"
                    ],
                    "additionalProperties": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "description_html": {
                          "type": "string"
                        },
                        "content_hash": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    },
                    "items": {},
                    "description": "Sprachcode → Textobjekt; ohne Übersetzungen kann PHP [] liefern."
                  }
                },
                "additionalProperties": true,
                "required": [
                  "id",
                  "version",
                  "status",
                  "name",
                  "description_html",
                  "language",
                  "validity",
                  "discount",
                  "sale",
                  "publication",
                  "renewal",
                  "allow_parallel_instances",
                  "active_customer_count",
                  "sort_order",
                  "internal_reference",
                  "scopes",
                  "published_at",
                  "archived_at",
                  "created_at",
                  "updated_at",
                  "texts"
                ]
              },
              "type": {
                "type": "string"
              }
            },
            "additionalProperties": true
          }
        }
      },
      "headers": {
        "X-Edoobox-Revision": {
          "schema": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "description": "Rotated account revision supplied for the next action in one reviewed sequence."
        }
      }
    },
    "400": {
      "description": "Invalid request.",
      "content": {
        "application/json": {
          "example": {
            "success": false,
            "error": "ED40006"
          }
        }
      }
    },
    "401": {
      "description": "Missing/expired token, missing account context, account paused or model-specific authorization failure.",
      "content": {
        "application/json": {
          "example": {
            "success": false,
            "error": "ED40103"
          }
        }
      }
    },
    "402": {
      "description": "Missing/invalid action data or subscription/operation restriction.",
      "content": {
        "application/json": {
          "example": {
            "success": false,
            "error": "ED80100"
          }
        }
      }
    },
    "403": {
      "description": "Permission denied. Browser CORS rejection may have an empty body.",
      "content": {
        "application/json": {
          "example": {
            "success": false,
            "error": "ED40340"
          }
        }
      }
    },
    "404": {
      "description": "Unknown resource/action or unsupported method.",
      "content": {
        "application/json": {
          "example": {
            "success": false,
            "error": "ED80019"
          }
        }
      }
    },
    "409": {
      "description": "The account changed after the reviewed read. No domain operation is dispatched; obtain fresh state and review again.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "additionalProperties": true
          },
          "example": {
            "error": "ED40901",
            "error_code": "mutation_revision_conflict"
          }
        }
      }
    },
    "422": {
      "description": "Validation failed.",
      "content": {
        "application/json": {
          "example": {
            "success": false,
            "error": "ED80020"
          }
        }
      }
    },
    "429": {
      "description": "Request/login rate limit exceeded. Honor Retry-After when supplied; legacy rate-limit paths may omit it. Retry only proven reads within a bounded deadline; a mutation is never automatically replayed after an ambiguous response.",
      "content": {
        "application/json": {
          "example": {
            "success": false,
            "error": "ED42902"
          }
        }
      },
      "headers": {
        "Retry-After": {
          "description": "Optional server delay in whole seconds or an HTTP date. Absence is not permission for an immediate retry.",
          "schema": {
            "type": "string",
            "examples": [
              "30"
            ]
          }
        }
      }
    },
    "502": {
      "description": "Server-side operation failed.",
      "content": {
        "application/json": {
          "example": {
            "success": false,
            "error": "ED50201"
          }
        }
      }
    },
    "503": {
      "description": "The account mutation lock or revision store is unavailable. No unprotected fallback is executed.",
      "headers": {
        "Retry-After": {
          "schema": {
            "type": "integer",
            "const": 1
          }
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "additionalProperties": true
          },
          "example": {
            "error": "ED50301",
            "error_code": "mutation_revision_busy"
          }
        }
      }
    }
  },
  "x-edoobox-mutates-state": true,
  "requestBody": {
    "required": false,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "data": {
              "type": "object",
              "properties": {
                "validity": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "fixed_range",
                        "relative_duration",
                        "usage_count"
                      ],
                      "default": "relative_duration"
                    },
                    "from": {
                      "type": [
                        "integer",
                        "number",
                        "string",
                        "null"
                      ],
                      "description": "Unix-Sekunden oder strtotime-lesbarer Datumsstring; feste Gültigkeit benötigt from < until."
                    },
                    "until": {
                      "type": [
                        "integer",
                        "number",
                        "string",
                        "null"
                      ]
                    },
                    "value": {
                      "type": [
                        "integer",
                        "number",
                        "string",
                        "boolean"
                      ],
                      "description": "Positive Dauer für relative_duration; Standard 1."
                    },
                    "unit": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "enum": [
                        "day",
                        "month",
                        "year",
                        null
                      ],
                      "default": "year"
                    },
                    "uses": {
                      "type": [
                        "integer",
                        "number",
                        "string",
                        "boolean"
                      ],
                      "description": "Positive Anzahl für usage_count."
                    },
                    "promo_code_redemption": {
                      "type": [
                        "boolean",
                        "integer",
                        "string"
                      ],
                      "description": "Normalisierung mit FILTER_VALIDATE_BOOL; z.B. true/false, 1/0 und \"true\"/\"false\"."
                    }
                  },
                  "additionalProperties": true
                },
                "discount": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "percent",
                        "fixed"
                      ],
                      "default": "percent"
                    },
                    "value": {
                      "type": [
                        "string",
                        "number"
                      ],
                      "description": "Nichtnegativer Betrag, Punkt oder Komma; maximal vier Eingabenachkommastellen, auf zwei gerundet. Bei percent höchstens 100."
                    },
                    "currency": {
                      "type": "string",
                      "description": "Dreistelliger ISO-Code für fixed; bei percent verworfen."
                    }
                  },
                  "additionalProperties": true
                },
                "sale": {
                  "type": "object",
                  "properties": {
                    "amount": {
                      "type": [
                        "string",
                        "number"
                      ],
                      "description": "Nichtnegativ, Punkt oder Komma, maximal vier Nachkommastellen, auf zwei gerundet; Standard 0."
                    },
                    "currency": {
                      "type": "string",
                      "description": "Dreistelliger Währungscode, auf Großbuchstaben normalisiert; Standard Kontowährung."
                    },
                    "vat": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "pattern": "^vat_[a-f0-9]{12}_-?[0-9]+$",
                      "description": "Öffentliche v2-ID aus diesem Konto; keine rohe Datenbank-ID."
                    }
                  },
                  "additionalProperties": true
                },
                "publication": {
                  "type": "object",
                  "properties": {
                    "design": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "pattern": "^design_[a-f0-9]{12}_-?[0-9]+$",
                      "description": "Öffentliche v2-ID aus diesem Konto; keine rohe Datenbank-ID."
                    }
                  },
                  "additionalProperties": true
                },
                "renewal": {
                  "type": "object",
                  "properties": {
                    "allowed": {
                      "type": [
                        "boolean",
                        "integer",
                        "string"
                      ],
                      "description": "Normalisierung mit FILTER_VALIDATE_BOOL; z.B. true/false, 1/0 und \"true\"/\"false\"."
                    },
                    "default": {
                      "type": [
                        "boolean",
                        "integer",
                        "string"
                      ],
                      "description": "Normalisierung mit FILTER_VALIDATE_BOOL; z.B. true/false, 1/0 und \"true\"/\"false\"."
                    },
                    "reminder_days": {
                      "type": [
                        "integer",
                        "number",
                        "string",
                        "boolean"
                      ],
                      "description": "Wird auf 0–365 begrenzt, Standard 30."
                    },
                    "duration_value": {
                      "type": [
                        "integer",
                        "number",
                        "string",
                        "boolean"
                      ],
                      "description": "Positive Verlängerungsdauer, insbesondere für fixed_range."
                    },
                    "duration_unit": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "enum": [
                        "day",
                        "month",
                        "year",
                        null
                      ]
                    }
                  },
                  "additionalProperties": true
                },
                "texts": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "maxLength": 150
                      },
                      "description_html": {
                        "type": "string",
                        "description": "Wird HTML-bereinigt."
                      }
                    },
                    "additionalProperties": true
                  },
                  "description": "Sprachcode → Textobjekt. Codes werden klein geschrieben; Name der Kontostandardsprache ist erst für internal/published erforderlich."
                },
                "scopes": {
                  "type": [
                    "array",
                    "object"
                  ],
                  "items": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "root",
                          "category",
                          "offer"
                        ]
                      },
                      "resource": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "description": "v2 category-/offer-ID; bei root null."
                      },
                      "id": {
                        "type": "string",
                        "description": "Eingabealias für resource."
                      }
                    },
                    "additionalProperties": true,
                    "required": [
                      "type"
                    ]
                  },
                  "additionalProperties": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "root",
                          "category",
                          "offer"
                        ]
                      },
                      "resource": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "description": "v2 category-/offer-ID; bei root null."
                      },
                      "id": {
                        "type": "string",
                        "description": "Eingabealias für resource."
                      }
                    },
                    "additionalProperties": true,
                    "required": [
                      "type"
                    ]
                  }
                },
                "allow_parallel_instances": {
                  "type": [
                    "boolean",
                    "integer",
                    "string"
                  ],
                  "description": "Normalisierung mit FILTER_VALIDATE_BOOL; z.B. true/false, 1/0 und \"true\"/\"false\"."
                },
                "sort_order": {
                  "type": [
                    "integer",
                    "number",
                    "string",
                    "boolean"
                  ],
                  "description": "Wird serverseitig nach Integer konvertiert; für neue Clients eine ganze Zahl senden."
                },
                "internal_reference": {
                  "type": "string",
                  "description": "Gekürzt auf 100 Zeichen."
                },
                "request_id": {
                  "type": "string",
                  "description": "Optionale Audit-Korrelation; für Pläne keine Idempotenzgarantie."
                },
                "validity_type": {
                  "type": "string",
                  "enum": [
                    "fixed_range",
                    "relative_duration",
                    "usage_count"
                  ],
                  "default": "relative_duration",
                  "description": "Flacher Eingabealias; die entsprechende verschachtelte Eigenschaft hat Vorrang."
                },
                "fixed_valid_from": {
                  "type": [
                    "integer",
                    "number",
                    "string",
                    "null"
                  ],
                  "description": "Flacher Eingabealias; die entsprechende verschachtelte Eigenschaft hat Vorrang."
                },
                "fixed_valid_until": {
                  "type": [
                    "integer",
                    "number",
                    "string",
                    "null"
                  ],
                  "description": "Flacher Eingabealias; die entsprechende verschachtelte Eigenschaft hat Vorrang."
                },
                "duration_value": {
                  "type": [
                    "integer",
                    "number",
                    "string",
                    "boolean"
                  ],
                  "description": "Flacher Eingabealias; die entsprechende verschachtelte Eigenschaft hat Vorrang."
                },
                "duration_unit": {
                  "type": "string",
                  "description": "Flacher Eingabealias; die entsprechende verschachtelte Eigenschaft hat Vorrang."
                },
                "included_uses": {
                  "type": [
                    "integer",
                    "number",
                    "string",
                    "boolean"
                  ],
                  "description": "Flacher Eingabealias; die entsprechende verschachtelte Eigenschaft hat Vorrang."
                },
                "promo_code_redemption_enabled": {
                  "type": [
                    "boolean",
                    "integer",
                    "string"
                  ],
                  "description": "Flacher Eingabealias; die entsprechende verschachtelte Eigenschaft hat Vorrang."
                },
                "discount_type": {
                  "type": "string",
                  "enum": [
                    "percent",
                    "fixed"
                  ],
                  "default": "percent",
                  "description": "Flacher Eingabealias; die entsprechende verschachtelte Eigenschaft hat Vorrang."
                },
                "discount_value": {
                  "type": [
                    "string",
                    "number"
                  ],
                  "description": "Flacher Eingabealias; die entsprechende verschachtelte Eigenschaft hat Vorrang."
                },
                "discount_currency_iso": {
                  "type": "string",
                  "description": "Flacher Eingabealias; die entsprechende verschachtelte Eigenschaft hat Vorrang."
                },
                "sale_price": {
                  "type": [
                    "string",
                    "number"
                  ],
                  "description": "Flacher Eingabealias; die entsprechende verschachtelte Eigenschaft hat Vorrang."
                },
                "sale_currency_iso": {
                  "type": "string",
                  "description": "Flacher Eingabealias; die entsprechende verschachtelte Eigenschaft hat Vorrang."
                },
                "vat": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "pattern": "^vat_[a-f0-9]{12}_-?[0-9]+$",
                  "description": "Flacher Eingabealias; die entsprechende verschachtelte Eigenschaft hat Vorrang."
                },
                "design": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "pattern": "^design_[a-f0-9]{12}_-?[0-9]+$",
                  "description": "Flacher Eingabealias; die entsprechende verschachtelte Eigenschaft hat Vorrang."
                },
                "auto_renew_allowed": {
                  "type": [
                    "boolean",
                    "integer",
                    "string"
                  ],
                  "description": "Flacher Eingabealias; die entsprechende verschachtelte Eigenschaft hat Vorrang."
                },
                "auto_renew_default": {
                  "type": [
                    "boolean",
                    "integer",
                    "string"
                  ],
                  "description": "Flacher Eingabealias; die entsprechende verschachtelte Eigenschaft hat Vorrang."
                },
                "reminder_days": {
                  "type": [
                    "integer",
                    "number",
                    "string",
                    "boolean"
                  ],
                  "description": "Flacher Eingabealias; die entsprechende verschachtelte Eigenschaft hat Vorrang."
                },
                "renewal_duration_value": {
                  "type": [
                    "integer",
                    "number",
                    "string",
                    "boolean"
                  ],
                  "description": "Flacher Eingabealias; die entsprechende verschachtelte Eigenschaft hat Vorrang."
                },
                "renewal_duration_unit": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Flacher Eingabealias; die entsprechende verschachtelte Eigenschaft hat Vorrang."
                }
              },
              "additionalProperties": true
            }
          },
          "additionalProperties": true
        },
        "examples": {
          "request": {
            "summary": "Mitgliedschaftsplan als Entwurf erstellen",
            "value": {
              "data": {
                "texts": {
                  "de": {
                    "name": "Jahresmitgliedschaft",
                    "description_html": "<p>Vorteile für ein Jahr</p>"
                  }
                },
                "validity": {
                  "type": "relative_duration",
                  "value": 1,
                  "unit": "year"
                },
                "sale": {
                  "amount": "120.00",
                  "currency": "CHF"
                },
                "discount": {
                  "type": "percent",
                  "value": "10.00"
                },
                "scopes": [
                  {
                    "type": "root"
                  }
                ]
              }
            }
          }
        }
      }
    }
  },
  "x-edoobox-runtimeMutationGuard": true,
  "x-edoobox-documentationReview": {
    "file": "docs/openapi/operation-contracts/01-membership.json",
    "notes": []
  },
  "x-edoobox-source": {
    "file": "application/models/v2/Membershipplan.php",
    "method": "postMembershipplan",
    "line": 61
  },
  "x-edoobox-documentationStatus": "reviewed",
  "x-edoobox-readOnly": false,
  "x-edoobox-safeForAutomation": false,
  "x-edoobox-permission": {
    "resource": "membershipplan",
    "short": "mepl",
    "checkedByDispatcher": true,
    "levels": [
      2,
      3,
      4
    ],
    "description": "Resource permission mapping from APIPermissions(), Authfunc::_getCheckJWT. Additional model/admin/plugin checks may apply; resources absent from api_permission do not acquire a fictitious scope."
  }
}
```
