> ## 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 CommunityPerk

> Create a new CommunityPerk record.

A CommunityPerk represents a perk, discount, or benefit that a location offers to its customers in partnership with other businesses. Perks can be discounts, free trials, or any other benefit negotiated with a partner business — for example, 50% off a car rental or a free hot drink at a nearby café. They are published on the Members Portal where customers can view and claim them. Use Active to control visibility — when false, the perk is only visible on the Admin Panel. Use ShowInHomePage to feature a perk on the Members Portal home page after users log in. Availability can be restricted via OnlyForContacts and OnlyForMembers. If neither flag is set, the perk is available to all customers. Use Tariffs to further restrict access to customers on specific pricing plans. Which perks are listed in a location is also controlled by the Access.Data.Perks BusinessSetting, whose value is an eDataVisibilityCriteria enum integer. This determines which locations' perks are visible to customers at a given location — for example ThisLocationOnly (7) shows only perks belonging to the current location, while AllLocations (3) shows perks from all locations in the network.

## 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 **`CommunityPerk-Create`** role.
</Note>

## Enums

<Accordion title="eDataVisibilityCriteria">
  | Value | Name |
  | - | - |
  | 1 | AllChildren |
  | 2 | AllParents |
  | 3 | AllLocations |
  | 4 | HomeLocationOnly |
  | 5 | HomeLocationChildren |
  | 6 | HomeLocationParents |
  | 7 | ThisLocationOnly |
  | 8 | AllParentChildren |
</Accordion>

## Request Body

### Required Fields

<ParamField body="BusinessId" type="integer" required>
  ID of the location this perk belongs to.
</ParamField>

<ParamField body="Title" type="string" required>
  Name of the perk as displayed on the Members Portal and the Admin Panel.
</ParamField>

<ParamField body="DisplayOrder" type="integer" required>
  Position of this perk in the list relative to other perks. Lower values appear first.
</ParamField>

### Optional Fields

<ParamField body="PerkUrl" type="string">
  Optional URL opened when a customer uses the Claim button; leave blank to omit the button.
</ParamField>

<ParamField body="SummaryText" type="string">
  Short description shown under the perk title on the Perks listing page of the Members Portal.
</ParamField>

<ParamField body="FullText" type="string">
  Full description of the perk, displayed when a customer clicks on it from the Perks listing page.
</ParamField>

<ParamField body="NewImageUrl" type="string">
  URL of a new small image to upload for this perk.
</ParamField>

<ParamField body="ClearImageFile" type="boolean">
  Set to true to remove the current small image from this perk.
</ParamField>

<ParamField body="NewLargeImageUrl" type="string">
  URL of a new large image to upload for this perk.
</ParamField>

<ParamField body="ClearLargeImageFile" type="boolean">
  Set to true to remove the current large image from this perk.
</ParamField>

<ParamField body="Active" type="boolean">
  Whether this perk is published and visible to customers on the Members Portal. When false, the perk is only visible on the Admin Panel.
</ParamField>

<ParamField body="GroupName" type="string">
  Group or category this perk belongs to, used to organise perks on the Members Portal.
</ParamField>

<ParamField body="ShowInHomePage" type="boolean">
  Whether to feature this perk on the Members Portal home page after users log in.
</ParamField>

<ParamField body="OnlyForContacts" type="boolean">
  Whether to exclude members and show this perk only to contacts, who have no active contract; do not set this and OnlyForMembers together.
</ParamField>

<ParamField body="OnlyForMembers" type="boolean">
  Whether to exclude contacts and show this perk only to members, who have an active contract; do not set this and OnlyForContacts together.
</ParamField>

<ParamField body="Tariffs" type="integer[]">
  List of plan IDs eligible for this perk when a customer is a member; an empty list does not restrict members by plan, and contacts are not checked against this list.
</ParamField>

## Code Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST \
    "https://spaces.nexudus.com/api/content/communityperks" \
    -H "Authorization: Bearer YOUR_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "BusinessId": 0,
      "Title": "",
      "DisplayOrder": 0
  }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://spaces.nexudus.com/api/content/communityperks',
    {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        BusinessId: 0,
        Title: '',
        DisplayOrder: 0
      })
    }
  );

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

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

  response = requests.post(
      'https://spaces.nexudus.com/api/content/communityperks',
      headers={
          'Authorization': 'Bearer YOUR_TOKEN',
          'Content-Type': 'application/json'
      },
      json={
          'BusinessId': 0,
          'Title': '',
          'DisplayOrder': 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 communityperk was created successfully.
</ResponseField>

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

```json Example Response theme={null}
{
  "Status": 200,
  "Message": "CommunityPerk 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": "Title: is a required field",
  "Value": null,
  "Errors": [
    {
      "AttemptedValue": null,
      "Message": "is a required field",
      "PropertyName": "Title"
    }
  ],
  "WasSuccessful": false
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.