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

> Create a new TimePassTimeSlot record.

A TimePassTimeSlot defines the days and times during which a time pass can be used. Each time slot specifies a day of the week and a from/to time window that restricts when the pass is valid. Time values are stored in UTC. The base date is 1976-01-01 but the actual stored date depends on the time zone offset (e.g., 1975-12-31 for time zones ahead of UTC). Always convert local times to UTC before creating time slots.

## 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 **`TimePassTimeSlot-Create`** role.

## Enums

> [accordion] DayOfWeek — DayOfWeek values
>
> | Value | Name |
> | - | - |
> | 0 | Sunday |
> | 1 | Monday |
> | 2 | Tuesday |
> | 3 | Wednesday |
> | 4 | Thursday |
> | 5 | Friday |
> | 6 | Saturday |

## Request Body

### Required Fields

**TimePassId** `integer` *required*

ID of the time pass linked to this record.

**FromTime** `string` *required*

Start time, stored in UTC. The base date is 1976-01-01 but the actual date depends on the time zone offset..

**ToTime** `string` *required*

End time, stored in UTC. The base date is 1976-01-01 but the actual date depends on the time zone offset..

**DayOfWeek** `integer` *required*

The day of week value for this time pass time slot.

## Code Examples

```bash cURL theme={null}
curl -X POST \
  "https://spaces.nexudus.com/api/billing/timepasstimeslots" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "TimePassId": 0,
    "FromTime": "2025-01-15T10:30:00Z",
    "ToTime": "2025-01-15T10:30:00Z",
    "DayOfWeek": 0
}'
```

```javascript JavaScript theme={null}
const response = await fetch(
  'https://spaces.nexudus.com/api/billing/timepasstimeslots',
  {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_TOKEN',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      TimePassId: 0,
      FromTime: '2025-01-15T10:30:00Z',
      ToTime: '2025-01-15T10:30:00Z',
      DayOfWeek: 0
    })
  }
);

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

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

response = requests.post(
    'https://spaces.nexudus.com/api/billing/timepasstimeslots',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json'
    },
    json={
        'TimePassId': 0,
        'FromTime': '2025-01-15T10:30:00Z',
        'ToTime': '2025-01-15T10:30:00Z',
        'DayOfWeek': 0
    }
)

data = response.json()
```

## Response

### 200

**Status** `integer`

HTTP status code. `200` on success.

**Message** `string`

A human-readable message confirming the creation.

**Value** `object`

Contains the `Id` of the newly created record.

**WasSuccessful** `boolean`

`true` if the timepasstimeslot was created successfully.

**Errors** `array`

`null` on success.

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

**Message** `string`

A summary of the validation error(s), in the format `PropertyName: error message`.

**Value** `any`

`null` on validation failure.

**Errors** `object[]`

Array of validation errors.

**AttemptedValue** `any`

The value that was submitted for the field, or `null` if missing.

**Message** `string`

The validation error message.

**PropertyName** `string`

The name of the property that failed validation.

**WasSuccessful** `boolean`

`false` when the request fails validation.

```json Example Response theme={null}
{
  "Message": "FromTime: is a required field",
  "Value": null,
  "Errors": [
    {
      "AttemptedValue": null,
      "Message": "is a required field",
      "PropertyName": "FromTime"
    }
  ],
  "WasSuccessful": false
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.