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

> Create a new CoworkerExtraService record.

A **CoworkerExtraService** records a charge or credit assigned to a customer. It covers three use cases:

* **Booking charges** — charges associated with bookings (e.g., meeting room usage fees). These are linked to a specific booking via `BookingId` and track the resource, time range, and price.
* **Time credit** — booking time allowances for specific resource types. Customers can spend these credits when booking resources of the matching type. The unit of credit depends on the `ChargePeriod` of the linked extra service (minutes, days, uses, etc.). `TotalUses` and `RemainingUses` track the allowance.
* **Printing credit** — credits for printing integrations such as PaperCut or Ezeep. The linked extra service has `IsPrintingCredit = true`. `TotalUses` and `RemainingUses` track the number of print jobs or pages available.

Records can be created manually or added automatically from a plan (tariff). When `IsFromTariff` is `true`, the record was provisioned by a customer's contract (CoworkerContract) and is linked via `CoworkerContractUniqueId`.

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

## Request Body

### Required Fields

<ParamField body="CoworkerId" type="integer" required>
  Coworker Id.
</ParamField>

<ParamField body="BusinessId" type="integer" required>
  Business Id.
</ParamField>

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

<ParamField body="TotalUses" type="integer" required>
  Total credit originally allocated (time or printing). Unit depends on the ChargePeriod of the linked extra service.
</ParamField>

<ParamField body="ChargePeriod" type="integer" required>
  Unit of measurement for time credit (Minutes, Days, Weeks, Months, Uses, FourWeekMonths). Defaults to `eChargePeriod.Minutes`.
</ParamField>

### Optional Fields

<ParamField body="Notes" type="string">
  Internal notes.
</ParamField>

<ParamField body="Free" type="boolean">
  Whether this charge or credit is free (no cost to the customer).
</ParamField>

<ParamField body="Price" type="number">
  Price charged for this extra service.
</ParamField>

<ParamField body="ValidFrom" type="string">
  Date from which this credit becomes usable.
</ParamField>

<ParamField body="ExpireDate" type="string">
  Date when this credit expires and can no longer be used.
</ParamField>

<ParamField body="DueDate" type="string">
  Payment due date for the charge.
</ParamField>

<ParamField body="PurchaseOrder" type="string">
  Purchase order.
</ParamField>

<ParamField body="InvoiceThisCoworker" type="boolean">
  Invoice the customer directly instead of the team or company paying member.
</ParamField>

<ParamField body="BookingId" type="integer">
  ID of the booking that generated this charge.
</ParamField>

<ParamField body="BookingFromTime" type="string">
  Start time of the booking that generated this charge.
</ParamField>

<ParamField body="BookingToTime" type="string">
  End time of the booking that generated this charge.
</ParamField>

<ParamField body="BookingResourceName" type="string">
  Name of the resource booked (e.g., meeting room name).
</ParamField>

<ParamField body="CoworkerContractUniqueId" type="string">
  Links this credit back to the customer contract that provisioned it.
</ParamField>

## Code Examples

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

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

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

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

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

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

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