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

> Create a new FloorPlan record.

A **FloorPlan** is a visual diagram representing a single floor of a location. Floor plans are used by admins and customers to get an overview of the space layout, including rooms, desks, and other areas.

Each floor plan belongs to a location (`Business`) and can optionally reference a `FloorPlanLayout` template. A background/tracing image can be uploaded to overlay the drawn areas, and its position and scale can be adjusted independently from the floor plan's own scale.

Once created, floor plan units (FloorPlanDesks) are added to the floor plan to represent individual bookable or non-bookable areas such as offices, dedicated desks, hot desks, and meeting rooms.

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

## Request Body

### Required Fields

<ParamField body="BusinessId" type="integer" required>
  ID of the location this floor plan belongs to.
</ParamField>

<ParamField body="Name" type="string" required>
  Display name of the floor plan (e.g. 'Ground Floor', 'Level 2').
</ParamField>

<ParamField body="BackgroundScale" type="integer" required>
  Zoom/scale factor applied to the background/tracing image, expressed as a percentage (e.g. 100 = original size).
</ParamField>

<ParamField body="PositionX" type="integer" required>
  Horizontal offset (in pixels) of the background image within the floor plan canvas.
</ParamField>

<ParamField body="PositionY" type="integer" required>
  Vertical offset (in pixels) of the background image within the floor plan canvas.
</ParamField>

<ParamField body="FloorLevel" type="integer" required>
  Floor number used to order floor plans (e.g. 0 = ground floor, 1 = first floor, -1 = basement).
</ParamField>

<ParamField body="Scale" type="number" required>
  Real-world scale of the floor plan, representing how many real-world units correspond to one canvas unit.
</ParamField>

### Optional Fields

<ParamField body="FloorPlanLayoutId" type="integer">
  ID of the floor plan layout template to apply to this floor plan.
</ParamField>

<ParamField body="NewBackgroundImageUrl" type="string">
  URL of a new background/tracing image to upload. The image will be fetched and stored when the floor plan is saved.
</ParamField>

<ParamField body="ClearBackgroundImageFile" type="boolean">
  Set to true to remove the current background/tracing image from this floor plan.
</ParamField>

<ParamField body="DisplayBackground" type="boolean">
  Whether the background/tracing image is visible when the floor plan is rendered.
</ParamField>

<ParamField body="Capacity" type="integer">
  Maximum number of people this floor can accommodate at the same time.
</ParamField>

<ParamField body="ArchilogicUniqueId" type="string">
  Unique identifier used to link this floor plan to a corresponding Archilogic 3D model.
</ParamField>

## Code Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST \
    "https://spaces.nexudus.com/api/sys/floorplans" \
    -H "Authorization: Bearer YOUR_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "BusinessId": 0,
      "Name": "",
      "BackgroundScale": 0,
      "PositionX": 0,
      "PositionY": 0,
      "FloorLevel": 0,
      "Scale": 0
  }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://spaces.nexudus.com/api/sys/floorplans',
    {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        BusinessId: 0,
        Name: '',
        BackgroundScale: 0,
        PositionX: 0,
        PositionY: 0,
        FloorLevel: 0,
        Scale: 0
      })
    }
  );

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

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

  response = requests.post(
      'https://spaces.nexudus.com/api/sys/floorplans',
      headers={
          'Authorization': 'Bearer YOUR_TOKEN',
          'Content-Type': 'application/json'
      },
      json={
          'BusinessId': 0,
          'Name': '',
          'BackgroundScale': 0,
          'PositionX': 0,
          'PositionY': 0,
          'FloorLevel': 0,
          'Scale': 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 floorplan was created successfully.
</ResponseField>

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

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