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

> Create a new CoworkerContract record.

A contract is a customer's plan agreement at a location. An active contract categorizes the customer as a Member; without one, they are a Contact. Its plan controls billing and can determine access, pricing, and eligibility for location services and inventory.

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

## Enums

<Accordion title="eCancellationReason">
  | Value | Name                     |
  | ----- | ------------------------ |
  | 1     | PriceTooHigh             |
  | 2     | NewJobRelocation         |
  | 3     | MovedToOtherSpace        |
  | 4     | ChangeWorkEnvironment    |
  | 5     | LackCommunityInterations |
  | 6     | PoorSpaceCondition       |
  | 7     | OtherMembers             |
  | 8     | Rellocated               |
  | 9     | BusinessExpansion        |
  | 10    | Pause                    |
  | 11    | Renewed                  |
  | 12    | Upgraded                 |
  | 13    | Downgraded               |
  | 19    | Covid19                  |
  | 99    | Other                    |
</Accordion>

<Accordion title="eDeliveryHandlingPreference">
  | Value | Name                       |
  | ----- | -------------------------- |
  | 1     | StoreForCollection         |
  | 2     | Forward                    |
  | 3     | OpenScanForward            |
  | 4     | OpenScanRecycle            |
  | 5     | OpenScanShred              |
  | 6     | OpenScanStoreForCollection |
  | 7     | Recycle                    |
  | 8     | ReturnToSender             |
  | 9     | Shred                      |
  | 10    | DepositCheck               |
  | 11    | Unknown                    |
</Accordion>

## Request Body

### Required Fields

<ParamField body="IssuedById" type="integer" required>
  ID of the location that issued this contract; it is supplied from the agent's current location context..
</ParamField>

<ParamField body="CoworkerId" type="integer" required>
  ID of the customer this contract belongs to; a customer with an active contract is a Member, while one without an active contract is a Contact..
</ParamField>

<ParamField body="TariffId" type="integer" required>
  ID of the plan assigned to this contract; its billing interval, price override rules, policies, and plan-based access or eligibility govern the customer..
</ParamField>

<ParamField body="BillingDay" type="integer" required>
  Day of each month to bill this contract, from 1 through 28; scheduled monthly price changes must use this day..
</ParamField>

<ParamField body="Quantity" type="integer" required>
  Number of plan units on the contract, at least 1; it multiplies price, included time, and contract value..
</ParamField>

### Optional Fields

<ParamField body="NextTariffId" type="integer">
  ID of the plan scheduled to replace the current plan at a future renewal; leave empty when no change is scheduled..
</ParamField>

<ParamField body="Notes" type="string">
  Free-text internal notes about this customer contract..
</ParamField>

<ParamField body="StartDate" type="string">
  Date when the contract begins; it is used to calculate billing and any minimum contract term..
</ParamField>

<ParamField body="RenewalDate" type="string">
  System-calculated UTC date of the next plan invoice, derived from the plan, billing day, and cancellation settings..
</ParamField>

<ParamField body="InvoicedPeriod" type="string">
  System-maintained UTC cutoff for the most recently invoiced contract period; do not set it manually..
</ParamField>

<ParamField body="ContractTerm" type="string">
  System-calculated UTC end of the minimum contract term; change the plan or start date instead..
</ParamField>

<ParamField body="Price" type="number">
  Optional per-unit price override for this contract; when empty, the assigned plan's price is used before applying quantity..
</ParamField>

<ParamField body="Value" type="number">
  Optional per-unit contract value used for value calculations; when empty, the effective contract price is used..
</ParamField>

<ParamField body="Desks" type="integer[]">
  List of IDs of floor-plan units assigned to this contract; each unit must belong to a location the user can access..
</ParamField>

<ParamField body="Variants" type="integer[]">
  List of IDs of floor-plan unit variants assigned to this contract; each variant's unit must belong to a location the user can access and connected to any of the desks/units associated with the contract..
</ParamField>

<ParamField body="PurchaseOrder" type="string">
  Customer purchase-order reference for this contract..
</ParamField>

<ParamField body="IncludeSignupFee" type="boolean">
  Whether the next eligible invoice includes the plan's sign-up fee..
</ParamField>

<ParamField body="InvoiceAdvancedCycles" type="boolean">
  Whether invoices include charges from future billing cycles when the plan permits them..
</ParamField>

<ParamField body="ApplyProRating" type="boolean">
  Whether the contract's initial charges are prorated for a partial billing period..
</ParamField>

<ParamField body="NextAutoInvoice" type="string">
  System-calculated UTC date when automatic additional-charge invoicing next runs; it follows the plan's auto-invoice settings..
</ParamField>

<ParamField body="PricePlanTermsAccepted" type="boolean">
  Whether the customer accepted the assigned plan's terms and conditions..
</ParamField>

<ParamField body="CancellationDate" type="string">
  Optional UTC date on which the contract ends; cancellation policy and invoicing determine the earliest allowed date..
</ParamField>

<ParamField body="CancellationLimitDays" type="integer">
  Optional minimum cancellation notice in days before the next billing day; when empty, the assigned plan's cancellation notice applies..
</ParamField>

<ParamField body="ProRateCancellation" type="boolean">
  Whether the cancellation invoice is prorated for the unused part of the billing period..
</ParamField>

<ParamField body="CancelTeamContracts" type="boolean">
  Whether cancelling this contract also cancels the customer's related team contracts..
</ParamField>

<ParamField body="CancellationReason" type="integer">
  Reason recorded for cancellation: PriceTooHigh, NewJobRelocation, MovedToOtherSpace, ChangeWorkEnvironment, LackCommunityInterations, PoorSpaceCondition, OtherMembers, Rellocated, BusinessExpansion, Pause, Renewed, Upgraded, Downgraded, Covid19, or Other.. See `eCancellationReason?` enum above.
</ParamField>

<ParamField body="CancellationNotes" type="string">
  Free-text notes explaining the cancellation..
</ParamField>

<ParamField body="DeliveryHandlingPreferenceChecks" type="integer">
  Preferred handling for delivered checks: StoreForCollection, Forward, OpenScanForward, OpenScanRecycle, OpenScanShred, OpenScanStoreForCollection, Recycle, ReturnToSender, Shred, DepositCheck, or Unknown.. See `eDeliveryHandlingPreference?` enum above.
</ParamField>

<ParamField body="DeliveryHandlingPreferenceMail" type="integer">
  Preferred handling for delivered mail: StoreForCollection, Forward, OpenScanForward, OpenScanRecycle, OpenScanShred, OpenScanStoreForCollection, Recycle, ReturnToSender, Shred, DepositCheck, or Unknown.. See `eDeliveryHandlingPreference?` enum above.
</ParamField>

<ParamField body="DeliveryHandlingPreferenceParcels" type="integer">
  Preferred handling for delivered parcels: StoreForCollection, Forward, OpenScanForward, OpenScanRecycle, OpenScanShred, OpenScanStoreForCollection, Recycle, ReturnToSender, Shred, DepositCheck, or Unknown.. See `eDeliveryHandlingPreference?` enum above.
</ParamField>

<ParamField body="DeliveryHandlingPreferencePublicity" type="integer">
  Preferred handling for delivered publicity: StoreForCollection, Forward, OpenScanForward, OpenScanRecycle, OpenScanShred, OpenScanStoreForCollection, Recycle, ReturnToSender, Shred, DepositCheck, or Unknown.. See `eDeliveryHandlingPreference?` enum above.
</ParamField>

<ParamField body="DeliveryInstructions" type="string">
  Free-text instructions for handling deliveries received for this contract..
</ParamField>

<ParamField body="IdentityChecksDueOn" type="string">
  Optional UTC date when identity verification is due for this contract..
</ParamField>

<ParamField body="AddressChecksDueOn" type="string">
  Optional UTC date when address verification is due for this contract..
</ParamField>

<ParamField body="StartDateLocal" type="string">
  Location-timezone projection of StartDate, generated for display and reporting; change StartDate instead..
</ParamField>

<ParamField body="RenewalDateLocal" type="string">
  Location-timezone projection of the system-calculated RenewalDate; do not set it directly..
</ParamField>

<ParamField body="NextAutoInvoiceLocal" type="string">
  Location-timezone projection of the system-calculated NextAutoInvoice date; do not set it directly..
</ParamField>

<ParamField body="PricePlanTermsAcceptedOnLocal" type="string">
  Location-timezone projection of the plan-terms acceptance timestamp; it is an audit value..
</ParamField>

<ParamField body="CancellationDateLocal" type="string">
  Location-timezone projection of CancellationDate, generated for display; change CancellationDate instead..
</ParamField>

<ParamField body="ContractTermLocal" type="string">
  Location-timezone projection of the system-calculated ContractTerm; do not set it directly..
</ParamField>

<ParamField body="InvoicedPeriodLocal" type="string">
  Location-timezone projection of the system-maintained InvoicedPeriod cutoff; do not set it directly..
</ParamField>

<ParamField body="PoBoxNumber" type="string">
  Post-office box number associated with this contract..
</ParamField>

### Children

<ParamField body="ContractSchedules" type="object[]">
  Scheduled future price changes for this contract. Each entry sets a new Price to apply on a given date

  <Expandable>
    <ParamField body="Price" type="number">
      The new contract price to apply on the scheduled date.
    </ParamField>

    <ParamField body="ApplyOn" type="string" required>
      Date on which the system will automatically update the contract price to the value in Price.
    </ParamField>
  </Expandable>
</ParamField>

## Code Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST \
    "https://spaces.nexudus.com/api/billing/coworkercontracts" \
    -H "Authorization: Bearer YOUR_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "IssuedById": 0,
      "CoworkerId": 0,
      "TariffId": 0,
      "BillingDay": 0,
      "Quantity": 0,
      "ContractSchedules": [
          {
              "Price": null,
              "ApplyOn": "2025-01-15T10:30:00Z"
          }
      ]
  }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://spaces.nexudus.com/api/billing/coworkercontracts',
    {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        IssuedById: 0,
        CoworkerId: 0,
        TariffId: 0,
        BillingDay: 0,
        Quantity: 0,
        ContractSchedules: [object Object]
      })
    }
  );

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

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

  response = requests.post(
      'https://spaces.nexudus.com/api/billing/coworkercontracts',
      headers={
          'Authorization': 'Bearer YOUR_TOKEN',
          'Content-Type': 'application/json'
      },
      json={
          'IssuedById': 0,
          'CoworkerId': 0,
          'TariffId': 0,
          'BillingDay': 0,
          'Quantity': 0,
          'ContractSchedules': [object Object]
      }
  )

  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 coworkercontract was created successfully.
</ResponseField>

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

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