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

# Update CoworkerProduct

> Update an existing CoworkerProduct record.

Updates an existing CoworkerProduct record. You must include the `Id` of the record to update along with all required fields.

## 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 **`CoworkerProduct-Edit`** role.
</Note>

## Enums

<Accordion title="eRecurrentChargePattern — RepeatCycle values">
  | Value | Name           |
  | ----- | -------------- |
  | 1     | PricePlan      |
  | 2     | Day            |
  | 3     | Week           |
  | 4     | Month          |
  | 5     | Year           |
  | 6     | LastDayOfMonth |
</Accordion>

## Request Body

### Required Fields

<ParamField body="Id" type="integer" required>
  The Id of the CoworkerProduct record to update.
</ParamField>

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

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

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

<ParamField body="Quantity" type="integer" required>
  Quantity.
</ParamField>

<ParamField body="RepeatCycle" type="integer" required>
  Repeat cycle pattern. PricePlan can only be used if the customer has a main contract; prefer ContractProduct instead of CoworkerProducts repeating on PricePlan.
</ParamField>

<ParamField body="CreditAmount" type="number" required>
  Credit amount.
</ParamField>

<ParamField body="DiscountAmount" type="number" required>
  Discount amount.
</ParamField>

### Optional Fields

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

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

<ParamField body="ActivateNow" type="boolean">
  Activate immediately, releasing any benefits (credits or passes) even before the product is invoiced and paid.
</ParamField>

<ParamField body="InvoiceThisCoworker" type="boolean">
  Invoice this customer for this product instead of the paying member of their team.
</ParamField>

<ParamField body="Price" type="number">
  Price override.
</ParamField>

<ParamField body="RegularCharge" type="boolean">
  Whether this is a regular charge.
</ParamField>

<ParamField body="RepeatUnit" type="integer">
  Number of repeat units.
</ParamField>

<ParamField body="InvoiceOn" type="string">
  Invoice on date.
</ParamField>

<ParamField body="RepeatFrom" type="string">
  Repeat from date.
</ParamField>

<ParamField body="RepeatUntil" type="string">
  Repeat until date.
</ParamField>

<ParamField body="SaleDate" type="string">
  Sale date.
</ParamField>

<ParamField body="DueDate" type="string">
  Due date.
</ParamField>

<ParamField body="Invoiced" type="boolean">
  Whether it has been invoiced.
</ParamField>

<ParamField body="MrmReminded" type="boolean">
  Mrm Reminded.
</ParamField>

<ParamField body="ApplyProRating" type="boolean">
  Apply pro-rating.
</ParamField>

<ParamField body="ProposalUniqueId" type="string">
  Proposal Unique Id.
</ParamField>

<ParamField body="CoworkerInvoiceId" type="integer">
  Coworker invoice ID.
</ParamField>

<ParamField body="CoworkerInvoiceNumber" type="string">
  Coworker invoice number.
</ParamField>

<ParamField body="CoworkerInvoicePaid" type="boolean">
  Whether coworker invoice is paid.
</ParamField>

## Code Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PUT \
    "https://spaces.nexudus.com/api/billing/coworkerproducts" \
    -H "Authorization: Bearer YOUR_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "CoworkerId": 0,
      "BusinessId": 0,
      "ProductId": 0,
      "Quantity": 0,
      "RepeatCycle": 0,
      "CreditAmount": 0,
      "DiscountAmount": 0,
      "Id": 87654321
  }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://spaces.nexudus.com/api/billing/coworkerproducts',
    {
      method: 'PUT',
      headers: {
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        CoworkerId: 0,
        BusinessId: 0,
        ProductId: 0,
        Quantity: 0,
        RepeatCycle: 0,
        CreditAmount: 0,
        DiscountAmount: 0,
        Id: 87654321
      })
    }
  );

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

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

  response = requests.put(
      'https://spaces.nexudus.com/api/billing/coworkerproducts',
      headers={
          'Authorization': 'Bearer YOUR_TOKEN',
          'Content-Type': 'application/json'
      },
      json={
          'CoworkerId': 0,
          'BusinessId': 0,
          'ProductId': 0,
          'Quantity': 0,
          'RepeatCycle': 0,
          'CreditAmount': 0,
          'DiscountAmount': 0,
          'Id': 87654321
      }
  )

  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 update.
</ResponseField>

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

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

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

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