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

> Update an existing ResourceAccessRule record.

Updates an existing ResourceAccessRule 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 **`ResourceAccessRule-Edit`** role.
</Note>

## Request Body

### Required Fields

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

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

<ParamField body="Name" type="string" required>
  Rule name.
</ParamField>

<ParamField body="AppliedResourcesCount" type="integer" required>
  Applied Resources Count.
</ParamField>

<ParamField body="EvaluationOrder" type="integer" required>
  Order in which this rule is evaluated relative to other rules on the same resource. Lower values are evaluated first..
</ParamField>

<ParamField body="CancellationFeeType" type="integer" required>
  How the cancellation fee is calculated: Absolute (fixed amount) or Percentage (of booking cost)..
</ParamField>

### Optional Fields

<ParamField body="Resources" type="integer[]">
  Resources.
</ParamField>

<ParamField body="AddedResources" type="integer[]">
  Added Resources.
</ParamField>

<ParamField body="RemovedResources" type="integer[]">
  Removed Resources.
</ParamField>

<ParamField body="Active" type="boolean">
  Whether this rule is currently active and evaluated during booking..
</ParamField>

<ParamField body="OnlyForContacts" type="boolean">
  When true, this rule applies only to contacts (non-member customers)..
</ParamField>

<ParamField body="ApplyRuleFrom" type="string">
  Date from which this rule starts being evaluated. Null means no start-date restriction..
</ParamField>

<ParamField body="ApplyRuleTo" type="string">
  Date after which this rule stops being evaluated. Null means no end-date restriction..
</ParamField>

<ParamField body="BookInAdvanceLimit" type="number">
  Maximum number of days in advance a booking can be made. Null means no limit..
</ParamField>

<ParamField body="LateBookingLimit" type="number">
  Minimum lead time (in minutes) required before a booking can start. Prevents last-minute bookings..
</ParamField>

<ParamField body="LateCancellationLimit" type="integer">
  Cut-off in minutes before the booking start time. Cancellations after this point are considered late and may incur a fee..
</ParamField>

<ParamField body="IntervalLimit" type="integer">
  Minimum interval (in minutes) between consecutive bookings on this resource, used as a buffer for setup or cleaning..
</ParamField>

<ParamField body="MaxBookingLength" type="integer">
  Maximum allowed duration for a single booking, in minutes..
</ParamField>

<ParamField body="MinBookingLength" type="integer">
  Minimum allowed duration for a single booking, in minutes..
</ParamField>

<ParamField body="NoReturnPolicy" type="integer">
  Cooldown in minutes: prevents the same user from booking this specific resource again within this window after their last booking ends..
</ParamField>

<ParamField body="NoReturnPolicyAllResources" type="integer">
  Cooldown in minutes: prevents the same user from booking any resource after booking this one, for the specified window\..
</ParamField>

<ParamField body="NoReturnPolicyAllUsers" type="integer">
  Cooldown in minutes: prevents any user from booking this resource within the specified window after the previous booking ends..
</ParamField>

<ParamField body="RejectWithMessage" type="string">
  Message shown to the user when their booking is rejected by this rule..
</ParamField>

<ParamField body="OnlyForMembers" type="boolean">
  When true, this rule applies only to active members (coworkers with a plan)..
</ParamField>

<ParamField body="Tariffs" type="integer[]">
  Tariffs.
</ParamField>

<ParamField body="AddedTariffs" type="integer[]">
  Added Tariffs.
</ParamField>

<ParamField body="RemovedTariffs" type="integer[]">
  Removed Tariffs.
</ParamField>

<ParamField body="AllowedTariffs" type="integer[]">
  Allowed Tariffs.
</ParamField>

<ParamField body="AddedAllowedTariffs" type="integer[]">
  Added Allowed Tariffs.
</ParamField>

<ParamField body="RemovedAllowedTariffs" type="integer[]">
  Removed Allowed Tariffs.
</ParamField>

<ParamField body="Members" type="integer[]">
  Members.
</ParamField>

<ParamField body="AddedMembers" type="integer[]">
  Added Members.
</ParamField>

<ParamField body="RemovedMembers" type="integer[]">
  Removed Members.
</ParamField>

<ParamField body="Teams" type="integer[]">
  Teams.
</ParamField>

<ParamField body="AddedTeams" type="integer[]">
  Added Teams.
</ParamField>

<ParamField body="RemovedTeams" type="integer[]">
  Removed Teams.
</ParamField>

<ParamField body="AllowedTeams" type="integer[]">
  Allowed Teams.
</ParamField>

<ParamField body="AddedAllowedTeams" type="integer[]">
  Added Allowed Teams.
</ParamField>

<ParamField body="RemovedAllowedTeams" type="integer[]">
  Removed Allowed Teams.
</ParamField>

<ParamField body="EventCategories" type="integer[]">
  Event Categories.
</ParamField>

<ParamField body="AddedEventCategories" type="integer[]">
  Added Event Categories.
</ParamField>

<ParamField body="RemovedEventCategories" type="integer[]">
  Removed Event Categories.
</ParamField>

<ParamField body="Courses" type="integer[]">
  Courses.
</ParamField>

<ParamField body="AddedCourses" type="integer[]">
  Added Courses.
</ParamField>

<ParamField body="RemovedCourses" type="integer[]">
  Removed Courses.
</ParamField>

<ParamField body="StopEvaluationIfRuleIsMet" type="boolean">
  When true, no further rules are evaluated after this one matches..
</ParamField>

<ParamField body="CancellationFeeProductId" type="integer">
  Cancellation Fee Product Id.
</ParamField>

<ParamField body="ChargeCancellationFee" type="boolean">
  When true, a fee is charged for late cancellations (past the LateCancellationLimit)..
</ParamField>

<ParamField body="CancellationFeeAmount" type="number">
  Fixed cancellation fee amount. Used when CancellationFeeType is Absolute..
</ParamField>

<ParamField body="CancellationFeePercentage" type="number">
  Cancellation fee as a percentage of the booking cost. Used when CancellationFeeType is Percentage..
</ParamField>

<ParamField body="RepeatBookingQuantityLimit" type="integer">
  Maximum number of occurrences allowed when creating a recurring booking under this rule..
</ParamField>

<ParamField body="RepeatBookingPeriodLimitInMonths" type="integer">
  Maximum time span (in months) over which a recurring booking series can extend under this rule..
</ParamField>

### Children

<ParamField body="EligibleTimeSlots" type="object[]">
  Time slots defining when this rule applies (eligibility windows). The year, month and day component of FromTime/ToTime is always 1976-01-01.

  <Expandable>
    <ParamField body="DayOfWeek" type="integer" required>
      Day Of Week.
    </ParamField>

    <ParamField body="FromTime" type="string" required>
      Start time.
    </ParamField>

    <ParamField body="ToTime" type="string" required>
      End time.
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="TimeSlots" type="object[]">
  The days and times the resources can be booked when this rule applies. The year, month and day component of FromTime/ToTime is always 1976-01-01.

  <Expandable>
    <ParamField body="DayOfWeek" type="integer" required>
      Day Of Week.
    </ParamField>

    <ParamField body="FromTime" type="string" required>
      Start time.
    </ParamField>

    <ParamField body="ToTime" type="string" required>
      End time.
    </ParamField>
  </Expandable>
</ParamField>

## Code Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PUT \
    "https://spaces.nexudus.com/api/spaces/resourceaccessrules" \
    -H "Authorization: Bearer YOUR_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "BusinessId": 0,
      "Name": "",
      "AppliedResourcesCount": 0,
      "EvaluationOrder": 0,
      "CancellationFeeType": 0,
      "Id": 87654321,
      "EligibleTimeSlots": [
          {
              "DayOfWeek": 0,
              "FromTime": "2025-01-15T10:30:00Z",
              "ToTime": "2025-01-15T10:30:00Z"
          }
      ],
      "TimeSlots": [
          {
              "DayOfWeek": 0,
              "FromTime": "2025-01-15T10:30:00Z",
              "ToTime": "2025-01-15T10:30:00Z"
          }
      ]
  }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://spaces.nexudus.com/api/spaces/resourceaccessrules',
    {
      method: 'PUT',
      headers: {
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        BusinessId: 0,
        Name: '',
        AppliedResourcesCount: 0,
        EvaluationOrder: 0,
        CancellationFeeType: 0,
        Id: 87654321,
        EligibleTimeSlots: [object Object],
        TimeSlots: [object Object]
      })
    }
  );

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

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

  response = requests.put(
      'https://spaces.nexudus.com/api/spaces/resourceaccessrules',
      headers={
          'Authorization': 'Bearer YOUR_TOKEN',
          'Content-Type': 'application/json'
      },
      json={
          'BusinessId': 0,
          'Name': '',
          'AppliedResourcesCount': 0,
          'EvaluationOrder': 0,
          'CancellationFeeType': 0,
          'Id': 87654321,
          'EligibleTimeSlots': [object Object],
          'TimeSlots': [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 update.
</ResponseField>

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

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

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

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