> For the complete documentation index, see [llms.txt](https://developer.gospace.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.gospace.com/start-building/create-a-location.md).

# Create a location

Add a new location in gospace to represent a physical site or office, providing the foundation for layers, spaces, and allocations.

{% tabs %}
{% tab title="Node.js" %}

### Prerequisites

* Completed **Setup Your Development Environment** and **Send Your First API Request**
* Node.js v18+ and npm v9+
* A valid gospace API key in your `.env` file

### 1. Create the script

Create `create-location.ts`:

```ts
import "dotenv/config";
import GospaceAI from "@gospace-ai/api";

async function main() {
  const gospace = new GospaceAI(process.env.GOSPACE_API_KEY!);

  const res = await gospace.spatial.createLocations({
    locations: [
      {
        name: "New Office",
        country: {
          country_id: "GB_ID",
          name: "United Kingdom",
          iso2: "GB",
          selected_timezone: "Europe/London",
          timezones: ["Europe/London"],
        },
        address: {
          postal_code: "EC2V 6DN",
          country_name: "UK",
          line1: "1 Example St",
          line2: "Suite 100",
        },
        coords: { latitude: 51.514, longitude: -0.093 },
        external_id: "new-office-1",
      },
    ],
  });

  console.log(JSON.stringify(res.data, null, 2));
}

main().catch((err) => {
  console.error("Request failed:", err);
  process.exit(1);
});
```

### 2. Run the script

With TypeScript:

```bash
npx tsx create-location.ts
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.gospace.com/start-building/create-a-location.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
