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

> Create a new ProductExtraService record.

A **ProductExtraService** links an `ExtraService` to a `Product`. The meaning of `UsesIncluded` depends on the type of the linked extra service:

* **Booking time** (ExtraService with `IsPrintingCredit = false`) — customers receive an allowance of booking time for the resource type(s) associated with that extra service. For example, a product called "Hot Desk Bundle" might include 2 hours of meeting room usage — achieved by linking a "Meeting Room Hourly" extra service with \`\`UsesIncluded` 120`.
* **Printing credit** (ExtraService with `IsPrintingCredit = true`) — customers receive a number of print jobs/pages. `UsesIncluded` is the number of printing credits included. The linked extra service must have `ChargePeriod = 5` (Uses) and `Price = 1`.

Always check `IsPrintingCredit` on the linked extra service before interpreting `UsesIncluded`.

For booking-time extra services, the unit of `UsesIncluded` is determined by the **ChargePeriod** of the linked `ExtraService`:

| ExtraService ChargePeriod | UsesIncluded unit |
| ------------------------- | ----------------- |
| 1 (Minutes)               | Minutes           |
| 2 (Days)                  | Days              |
| 3 (Weeks)                 | Weeks             |
| 4 (Months)                | Months            |
| 5 (Uses)                  | Individual uses   |
| 6 (FourWeekMonths)        | 4-week periods    |

So \`\`UsesIncluded` 60` on a minutes extra service means 60 minutes of booking time included. On a daily extra service it means 60 full days.

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

## Request Body

### Required Fields

<ParamField body="ProductId" type="integer" required>
  Product Id.
</ParamField>

<ParamField body="ExtraServiceId" type="integer" required>
  Extra Service Id.
</ParamField>

<ParamField body="UsesIncluded" type="integer" required>
  Uses included.
</ParamField>

### Optional Fields

<ParamField body="ExpireTimeInMonths" type="integer">
  Expire Time In Months.
</ParamField>

<ParamField body="ExpireTimeInWeeks" type="integer">
  Expire Time In Weeks.
</ParamField>

<ParamField body="ExpirationType" type="integer">
  Expiration type. See `eRecurrentChargePattern?` enum above.
</ParamField>

<ParamField body="ExpiresIn" type="integer">
  Expires in.
</ParamField>

## Code Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST \
    "https://spaces.nexudus.com/api/billing/productextraservices" \
    -H "Authorization: Bearer YOUR_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "ProductId": 0,
      "ExtraServiceId": 0,
      "UsesIncluded": 0
  }'
  ```

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

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

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

  response = requests.post(
      'https://spaces.nexudus.com/api/billing/productextraservices',
      headers={
          'Authorization': 'Bearer YOUR_TOKEN',
          'Content-Type': 'application/json'
      },
      json={
          'ProductId': 0,
          'ExtraServiceId': 0,
          'UsesIncluded': 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 productextraservice was created successfully.
</ResponseField>

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

```json Example Response theme={null}
{
  "Status": 200,
  "Message": "ProductExtraService 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
}
```
