# Create Discount Campaign (Order - Single Discount Code)

This endpoint can be used to create a discount campaign using a single custom discount code. This discount campaign will create the discount code on order level and can have a MONETARY or a PERCENTAGE rate type. When the MAX_USAGE is null, the code can be used unlimited.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "General Admission Partner API",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://api.ticketing.cm.com/partnerapi/v1.0"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "oauth2",
        "flows": {
          "clientCredentials": {
            "tokenUrl": "https://example.com/oauth2/token",
            "scopes": {}
          }
        }
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/events/{event_uuid}/discountcampaigns/order/singlediscountcode": {
      "post": {
        "summary": "Create Discount Campaign (Order - Single Discount Code)",
        "description": "This endpoint can be used to create a discount campaign using a single custom discount code. This discount campaign will create the discount code on order level and can have a MONETARY or a PERCENTAGE rate type. When the MAX_USAGE is null, the code can be used unlimited.",
        "operationId": "create-discount-campaign-order-single-discount-code",
        "parameters": [
          {
            "name": "event_uuid",
            "in": "path",
            "description": "Uuid of your event. Example: 00000000-0000-0000-0000-000000000000",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Discount Campaign Name"
                  },
                  "discount_code": {
                    "type": "string",
                    "description": "DISCOUNTCODE-_123"
                  },
                  "max_usage": {
                    "type": "number",
                    "description": "Can be an integer or null (when null the discount code can be used an unlimited amount times)",
                    "format": "float"
                  },
                  "online_from": {
                    "type": "string",
                    "description": "ISO date - discount can be used from a moment in time"
                  },
                  "online_till": {
                    "type": "string",
                    "description": "ISO date - discount can be used until a moment in time"
                  },
                  "rate": {
                    "type": "number",
                    "description": "Is either a fixed rate or a percentage rate",
                    "format": "float"
                  },
                  "rate_type_id": {
                    "type": "string",
                    "enum": [
                      "MONETARY",
                      "PERCENTAGE"
                    ]
                  },
                  "currency_id": {
                    "type": "string"
                  }
                }
              },
              "examples": {
                "Request Example": {
                  "value": {
                    "name": "Discount Campaign Name",
                    "discount_code": "DISCOUNTCODE-_123",
                    "max_usage": null,
                    "online_from": "2025-03-24T09:34:35+00:00",
                    "online_till": "2025-03-28T09:34:35+00:00",
                    "rate": 3,
                    "rate_type_id": "MONETARY",
                    "currency_id": "EUR"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n    \"uuid\": \"00000000-0000-0000-0000-000000000000\",\n    \"name\": \"Discount Campaign Name\",\n    \"online_from\": \"2025-03-24T09:34:35+00:00\",\n    \"online_till\": \"2025-03-28T09:34:35+00:00\",\n    \"discount_codes_amount\": 1,\n    \"discount_codes_amount_used\": 0,\n    \"max_usage\": null,\n    \"rate\": 3,\n    \"rate_type_id\": \"MONETARY\",\n    \"currency_id\": \"EUR\",\n    \"discount_type_id\": \"DISCOUNT_ORDER\",\n    \"created_at\": \"2025-03-24T12:03:03+00:00\",\n    \"updated_at\": \"2025-03-24T12:03:03+00:00\",\n    \"discount_campaign_products\": null\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "uuid": {
                      "type": "string",
                      "example": "00000000-0000-0000-0000-000000000000"
                    },
                    "name": {
                      "type": "string",
                      "example": "Discount Campaign Name"
                    },
                    "online_from": {
                      "type": "string",
                      "example": "2025-03-24T09:34:35+00:00"
                    },
                    "online_till": {
                      "type": "string",
                      "example": "2025-03-28T09:34:35+00:00"
                    },
                    "discount_codes_amount": {
                      "type": "integer",
                      "example": 1,
                      "default": 0
                    },
                    "discount_codes_amount_used": {
                      "type": "integer",
                      "example": 0,
                      "default": 0
                    },
                    "max_usage": {},
                    "rate": {
                      "type": "integer",
                      "example": 3,
                      "default": 0
                    },
                    "rate_type_id": {
                      "type": "string",
                      "example": "MONETARY"
                    },
                    "currency_id": {
                      "type": "string",
                      "example": "EUR"
                    },
                    "discount_type_id": {
                      "type": "string",
                      "example": "DISCOUNT_ORDER"
                    },
                    "created_at": {
                      "type": "string",
                      "example": "2025-03-24T12:03:03+00:00"
                    },
                    "updated_at": {
                      "type": "string",
                      "example": "2025-03-24T12:03:03+00:00"
                    },
                    "discount_campaign_products": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          }
        },
        "deprecated": false
      }
    }
  },
  "x-readme": {
    "headers": [
      {
        "key": "X-TF-PREFERREDLANGUAGEID",
        "value": "Language ID"
      }
    ],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true,
  "_id": "63aafdb047058c0010db405f:67e12eb4bd45ea0030a164c1"
}
```