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

# Create EventProduct

> Create a new EventProduct record.

An Event Product (internally EventProduct) is a purchasable ticket or RSVP option for an event, with its own price, capacity, availability window, and customer-targeting rules.

## Authentication

<Note>
  This endpoint requires OAuth2 authentication. Include a valid bearer token in the `Authorization` header.
  The authenticated user must be a full unrestricted administrator or have the **`EventProduct-Create`** role.
</Note>

## Request Body

### Required Fields

<ParamField body="CalendarEventId" type="integer" required>
  ID of the event this ticket belongs to; the event's location determines the owning location for this record..
</ParamField>

<ParamField body="Name" type="string" required>
  Required ticket name shown to customers on the Members Portal and app..
</ParamField>

<ParamField body="DisplayOrder" type="integer" required>
  Display position of this ticket among the event's tickets; lower values appear first..
</ParamField>

<ParamField body="StartDate" type="string" required>
  UTC start of the inclusive window during which this ticket can be purchased; must not be after EndDate..
</ParamField>

<ParamField body="EndDate" type="string" required>
  UTC end of the inclusive window during which this ticket can be purchased; must not be before StartDate..
</ParamField>

<ParamField body="Price" type="number" required>
  Price charged per ticket in the selected currency; zero makes the ticket free (RSVP only)..
</ParamField>

<ParamField body="CurrencyId" type="integer" required>
  ID of the ISO 4217 currency used for the ticket price..
</ParamField>

### Optional Fields

<ParamField body="Description" type="string">
  Optional plain-text description of this ticket shown on the Members Portal and app..
</ParamField>

<ParamField body="TicketNotes" type="string">
  Optional plain-text notes appended to the confirmation message sent to customers who purchase this ticket..
</ParamField>

<ParamField body="Visible" type="boolean">
  Whether customers can see and purchase this ticket from the Members Portal and app; when false the ticket is hidden from the storefront..
</ParamField>

<ParamField body="Allocation" type="integer">
  Maximum number of this ticket type that can be sold; leave empty for no product-specific cap, while the event's overall capacity still applies..
</ParamField>

<ParamField body="MaxTicketsPerAttendee" type="integer">
  Maximum number of this ticket a single customer can purchase; leave empty for no per-customer limit..
</ParamField>

<ParamField body="TaxRateId" type="integer">
  Optional ID of the tax rate applied when this ticket is invoiced; required when the event's location requires tax rates..
</ParamField>

<ParamField body="FinancialAccountId" type="integer">
  Optional ID of the financial account used to record ticket revenue; required when the event's location requires financial accounts..
</ParamField>

<ParamField body="OnlyForContacts" type="boolean">
  Whether only contacts, meaning customers without an active contract, can purchase this ticket; this combines with every other targeting rule, so setting it with OnlyForMembers makes the ticket unavailable to all customers..
</ParamField>

<ParamField body="OnlyForMembers" type="boolean">
  Whether only members, meaning customers with an active contract, can purchase this ticket; this combines with every other targeting rule, so setting it with OnlyForContacts makes the ticket unavailable to all customers..
</ParamField>

<ParamField body="Tariffs" type="integer[]">
  List of plans a customer's active contract must use to purchase this ticket; an empty list applies no plan restriction, and a non-empty list is enforced in addition to other targeting rules..
</ParamField>

<ParamField body="Members" type="integer[]">
  List of specific customers who can purchase this ticket; an empty list applies no customer-specific restriction, and a non-empty list is enforced in addition to plan, team, member, and contact rules..
</ParamField>

<ParamField body="Teams" type="integer[]">
  List of teams a customer must belong to to purchase this ticket; an empty list applies no team restriction, and a non-empty list is enforced in addition to other targeting rules..
</ParamField>

## Code Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST \
    "https://spaces.nexudus.com/api/content/eventproducts" \
    -H "Authorization: Bearer YOUR_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "CalendarEventId": 0,
      "Name": "",
      "DisplayOrder": 0,
      "StartDate": "2025-01-15T10:30:00Z",
      "EndDate": "2025-01-15T10:30:00Z",
      "Price": 0,
      "CurrencyId": 0
  }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://spaces.nexudus.com/api/content/eventproducts',
    {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        CalendarEventId: 0,
        Name: '',
        DisplayOrder: 0,
        StartDate: '2025-01-15T10:30:00Z',
        EndDate: '2025-01-15T10:30:00Z',
        Price: 0,
        CurrencyId: 0
      })
    }
  );

  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://spaces.nexudus.com/api/content/eventproducts',
      headers={
          'Authorization': 'Bearer YOUR_TOKEN',
          'Content-Type': 'application/json'
      },
      json={
          'CalendarEventId': 0,
          'Name': '',
          'DisplayOrder': 0,
          'StartDate': '2025-01-15T10:30:00Z',
          'EndDate': '2025-01-15T10:30:00Z',
          'Price': 0,
          'CurrencyId': 0
      }
  )

  data = response.json()
  ```
</CodeGroup>

## Response

### 200

<ResponseField name="Status" type="integer">
  HTTP status code. `200` on success.
</ResponseField>

<ResponseField name="Message" type="string">
  A human-readable message confirming the creation.
</ResponseField>

<ResponseField name="Value" type="object">
  Contains the `Id` of the newly created record.
</ResponseField>

<ResponseField name="WasSuccessful" type="boolean">
  `true` if the eventproduct was created successfully.
</ResponseField>

<ResponseField name="Errors" type="array">
  `null` on success.
</ResponseField>

```json Example Response theme={null}
{
  "Status": 200,
  "Message": "EventProduct was successfully created.",
  "Value": {
    "Id": 87654321
  },
  "OpenInDialog": false,
  "OpenInWindow": false,
  "RedirectURL": null,
  "JavaScript": null,
  "UpdatedOn": "2025-01-15T10:30:00Z",
  "UpdatedBy": "admin@example.com",
  "Errors": null,
  "WasSuccessful": true
}
```

### 400

<ResponseField name="Message" type="string">
  A summary of the validation error(s), in the format `PropertyName: error message`.
</ResponseField>

<ResponseField name="Value" type="any">
  `null` on validation failure.
</ResponseField>

<ResponseField name="Errors" type="object[]">
  Array of validation errors.

  <Expandable>
    <ResponseField name="AttemptedValue" type="any">
      The value that was submitted for the field, or `null` if missing.
    </ResponseField>

    <ResponseField name="Message" type="string">
      The validation error message.
    </ResponseField>

    <ResponseField name="PropertyName" type="string">
      The name of the property that failed validation.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="WasSuccessful" type="boolean">
  `false` when the request fails validation.
</ResponseField>

```json Example Response theme={null}
{
  "Message": "Name: is a required field",
  "Value": null,
  "Errors": [
    {
      "AttemptedValue": null,
      "Message": "is a required field",
      "PropertyName": "Name"
    }
  ],
  "WasSuccessful": false
}
```
