How do I create a new site via the API?

Creating new sites with the Expansive API couldn't be more straightforward, learn how!

The following demonstrates the bare minimum request body in order to create a new site on Expansive FM

Resource

/v2/sites

Method

POST

Headers

Key Value
Authorization Bearer <TOKEN> (find out more)
Content-Type application/vnd.api+json

Body

{
  "data": {
    "type": "sites",
    "attributes": {
    "name": "New Site Name",
      "timezone": "Europe/London"
    },
    "relationships": {
      "Currency": {
        "data": {
          "type": "currencies",
          "id": "67"
        }
      },
      "Organisation": {
        "data": {
          "type": "organisations",
          "id": "1"
        }
      },
      "Country": {
        "data": {
          "type": "countries",
          "id": "1"
        }
      },
      "SiteType": {
        "data": {
          "type": "site-types",
          "id": "1"
        }
      }
    }
  }
}
  • 67 is the currency ID for GBP, 5 is the currency ID for USD, 2 is the currency ID for EUR. 
    Alternatively, see this article to get a full list of currencies via the API.
  • For single organisation accounts the organisation ID should be 1, for multiple organisation accounts please contact our helpdesk to confirm the correct organisation IDs. Alternatively, see this article to get a full list of organisations via the API.
  • For operations occurring within a single country, the country ID should be 1, for operations spanning multiple countries please contact our helpdesk to confirm the correct country IDs.
    Alternatively, see this article to get a full list of countries via the API.
  • See this article to get a full list of site types via the API.

Expected Response

201 CREATED
{
  "jsonapi": {
    "version": "1.0"
  },
  "links": {
    "self": "http://localhost:8080/api/v2/sites/187"
  },
  "data": {
    "type": "sites",
    "id": "187",
    "attributes": {
      "access_times": [
        {
          "to": "23:59",
          "from": "00:00"
        },
        {
          "to": "23:59",
          "from": "00:00"
        },
        {
          "to": "23:59",
          "from": "00:00"
        },
        {
          "to": "23:59",
          "from": "00:00"
        },
        {
          "to": "23:59",
          "from": "00:00"
        },
        {
          "to": "23:59",
          "from": "00:00"
        },
        {
          "to": "23:59",
          "from": "00:00"
        }
      ],
      "address": null,
      "built_date": null,
      "capacity": null,
      "city": null,
      "country_id": 1,
      "county": null,
      "created_at": "2024-02-14T12:03:41.000000Z",
      "currency_id": 67,
      "disabled_access": true,
      "emergency_contact_details": null,
      "emergency_procedure": null,
      "excluded_dates": [],
      "geofence": null,
      "geofence_area": null,
      "hazards": null,
      "landlord_id": null,
      "latitude": null,
      "lease_end_date": null,
      "longitude": null,
    "name": "New Site Name",
      "number_of_employees": null,
      "number_of_floors": null,
      "number_of_lifts": null,
      "number_of_meeting_rooms": null,
      "number_of_parking_spaces": null,
      "opening_times": null,
      "organisation_id": 1,
      "permit_instructions": null,
      "postcode": null,
      "reference": null,
      "site_type_id": 1,
      "telephone": null,
      "test": false,
      "timezone": "Europe/London",
      "total_space": null,
      "updated_at": "2024-02-14T12:03:41.000000Z",
      "usable_space": null,
      "enabled": true
    },
    "relationships": {
      "Country": {
        "links": {
          "related": "http://localhost:8080/api/v2/sites/187/country",
          "self": "http://localhost:8080/api/v2/sites/187/relationships/country"
        }
      },
      "Landlord": {
        "links": {
          "related": "http://localhost:8080/api/v2/sites/187/landlord",
          "self": "http://localhost:8080/api/v2/sites/187/relationships/landlord"
        }
      },
      "Organisation": {
        "links": {
          "related": "http://localhost:8080/api/v2/sites/187/organisation",
          "self": "http://localhost:8080/api/v2/sites/187/relationships/organisation"
        }
      },
      "SiteType": {
        "links": {
          "related": "http://localhost:8080/api/v2/sites/187/site-type",
          "self": "http://localhost:8080/api/v2/sites/187/relationships/site-type"
        }
      },
      "Users": {
        "links": {
          "related": "http://localhost:8080/api/v2/sites/187/users",
          "self": "http://localhost:8080/api/v2/sites/187/relationships/users"
        }
      },
      "WorkOrders": {
        "links": {
          "related": "http://localhost:8080/api/v2/sites/187/work-orders",
          "self": "http://localhost:8080/api/v2/sites/187/relationships/work-orders"
        }
      },
      "RecurringWorkOrders": {
        "links": {
          "related": "http://localhost:8080/api/v2/sites/187/recurring-work-orders",
          "self": "http://localhost:8080/api/v2/sites/187/relationships/recurring-work-orders"
        }
      },
      "Tags": {
        "links": {
          "related": "http://localhost:8080/api/v2/sites/187/tags",
          "self": "http://localhost:8080/api/v2/sites/187/relationships/tags"
        }
      },
      "Currency": {
        "links": {
          "related": "http://localhost:8080/api/v2/sites/187/currency",
          "self": "http://localhost:8080/api/v2/sites/187/relationships/currency"
        }
      },
      "MaintainableEntity": {
        "links": {
          "related": "http://localhost:8080/api/v2/sites/187/maintainable-entity",
          "self": "http://localhost:8080/api/v2/sites/187/relationships/maintainable-entity"
        }
      }
    },
    "links": {
      "self": "http://localhost:8080/api/v2/sites/187"
    }
  }
}