Create a location
Prerequisites
1. Create the script
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
Last updated
Was this helpful?