> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# CreateLocation

# Package: googleBusinessProfile

# Namespace: GbpLocationsService

# Method link: https://dev.wix.com/docs/api-reference/business-management/google-business-profile/gbplocation-v1/create-location.md

## Permission Scopes:
Manage SEO Settings: SCOPE.PROMOTE.MANAGE-SEO

## Introduction

Imports an existing Google Business Profile location.

Specify the Google account ID in `accountId` and the Google location ID in
`location.id`. Both are available from List Unimported Locations.

This doesn't create a listing in Google. It records a location the Google
account already has, so that the site can manage it. To create a new listing,
call Create Google Location.

A Google account must be connected first, or the call fails with
`CONNECTION_NOT_FOUND`. See the
[Connection API](https://dev.wix.com/docs/api-reference/business-management/google-business-profile/connection-v1.md).

---

## REST API

### Schema

```
 Method: createLocation
 Description: Imports an existing Google Business Profile location.  Specify the Google account GUID in `accountId` and the Google location GUID in `location.id`. Both are available from List Unimported Locations.  This doesn't create a listing in Google. It records a location the Google account already has, so that the site can manage it. To create a new listing, call Create Google Location.  A Google account must be connected first, or the call fails with `CONNECTION_NOT_FOUND`. See the [Connection API](https://dev.wix.com/docs/api-reference/business-management/google-business-profile/connection-v1.md).
 URL: https://www.wixapis.com/gbp/v1/locations
 Method: POST
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  location, location.id, location.accountId
 Method parameters: 
   param name: location | type: GBPLocation | description: A GBP location is a site's stable record of one Google Business Profile location.  It holds the identifiers and operational metadata needed to work with that location on Google's behalf. It doesn't store the Google-owned profile data itself: name, address, opening hours, photos, reviews, attributes and insights are all retrieved live from Google on each call, so they're never stale here and never edited here.  `id` is Google's own location identifier, so you can use it to correlate a location with data you retrieve from Google directly.  The only personal data on a GBP location is `serviceAreaPostalAddress`, which is set for service-area businesses. It's often a home address, so it's stored encrypted and is covered by the site's data-deletion requests.  A Google account must be connected before locations can be imported, and before any call that reads or writes a specific location's profile. See the [Connection API](https://dev.wix.com/docs/api-reference/business-management/google-business-profile/connection-v1.md).  Two methods work without a connection, because they read Google's public catalog rather than a site's own profile: Search Google Locations, and List Attribute Metadata when called with `categoryRegion`. Both are useful before a site owner has connected anything. | required: true 
        - name: id | type: string | description: Google's opaque location identifier on the public API. | required: true | validation: minLength 1, maxLength 255, immutable
        - name: accountId | type: string | description: GUID of the Google Business Profile account that holds this location, what Google calls a location group.  One site can have locations in more than one account, because a single Google login can own several. | required: true | validation: maxLength 255, immutable
        - name: serviceAreaPostalAddress | type: PostalAddress | description: Saved postal address for service-area businesses. Used as the `context` parameter in Google's FetchVerificationOptions call for service-area verification flows. Null for storefront businesses.  
           - name: countryCode | type: string | description: ISO 3166-1 alpha-2 country code (e.g. "US", "GB").  | validation: format COUNTRY
           - name: postalCode | type: string | description: Postal/ZIP code.  | validation: maxLength 20
           - name: administrativeArea | type: string | description: Administrative area (state, province, region).  | validation: maxLength 100
           - name: locality | type: string | description: City or locality.  | validation: maxLength 100
           - name: addressLines | type: array<string> | description: Street address lines. Up to 5 lines.  | validation: maxItems 5, maxLength 255
        - name: feedEntityId | type: string | description: Identity this location is published under in Google partner feeds, used as the entity GUID, merchant GUID or parent entity GUID across Reserve with Google, Order with Google and Dine with Google.  Can be set once. A location that already has a value keeps it, and a request that tries to change it is rejected: Google has already ingested the value as the merchant's identity, so changing it withdraws the business from those feeds and can remove its booking and ordering buttons. Setting it on a location that doesn't have one yet is allowed.  Locations created through this API are given a value automatically, so you usually don't need to set it. Specify it only when migrating a location whose identity Google already knows.  | validation: maxLength 288
 Return type: CreateLocationResponse
  - name: location | type: GBPLocation | description: The created location.  
     - name: id | type: string | description: Google's opaque location identifier on the public API.  | validation: minLength 1, maxLength 255, immutable
     - name: accountId | type: string | description: GUID of the Google Business Profile account that holds this location, what Google calls a location group.  One site can have locations in more than one account, because a single Google login can own several.  | validation: maxLength 255, immutable
     - name: serviceAreaPostalAddress | type: PostalAddress | description: Saved postal address for service-area businesses. Used as the `context` parameter in Google's FetchVerificationOptions call for service-area verification flows. Null for storefront businesses.  
        - name: countryCode | type: string | description: ISO 3166-1 alpha-2 country code (e.g. "US", "GB").  | validation: format COUNTRY
        - name: postalCode | type: string | description: Postal/ZIP code.  | validation: maxLength 20
        - name: administrativeArea | type: string | description: Administrative area (state, province, region).  | validation: maxLength 100
        - name: locality | type: string | description: City or locality.  | validation: maxLength 100
        - name: addressLines | type: array<string> | description: Street address lines. Up to 5 lines.  | validation: maxItems 5, maxLength 255
     - name: createdDate | type: string | description: Date and time the location was imported into Wix.  | read-only: true | validation: format date-time
     - name: updatedDate | type: string | description: Date and time the location was last updated.  | read-only: true | validation: format date-time
     - name: revision | type: string | description: Revision number, incremented on every update. Used for optimistic locking.  | read-only: true 
     - name: googleLocationId | type: string | description: Google's location identifier for this location, the same value as `id`. Filter and sort on this field in Query GBP Locations.  | read-only: true | validation: maxLength 255, immutable
     - name: feedEntityId | type: string | description: Identity this location is published under in Google partner feeds, used as the entity GUID, merchant GUID or parent entity GUID across Reserve with Google, Order with Google and Dine with Google.  Can be set once. A location that already has a value keeps it, and a request that tries to change it is rejected: Google has already ingested the value as the merchant's identity, so changing it withdraws the business from those feeds and can remove its booking and ordering buttons. Setting it on a location that doesn't have one yet is allowed.  Locations created through this API are given a value automatically, so you usually don't need to set it. Specify it only when migrating a location whose identity Google already knows.  | validation: maxLength 288

 Possible Errors:
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: CONNECTION_ID_REQUIRED | Description: The site holds more than one Google connection and the request named none (`connectionId`), so there is no single account to act through.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: CONNECTION_NOT_FOUND | Description: No Google account is connected to the target Wix site. Follow the authorization flow in [Get Connect URL](https://dev.wix.com/docs/api-reference/business-management/google-business-profile/connection-v1/get-connect-url.md) before retrying.


```

### Examples

### Import an existing Google location
```curl
curl -X POST \
'https://www.wixapis.com/gbp/v1/locations' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json' \
-d '{
  "location": {
    "id": "8034569321457853640",
    "accountId": "104312867792031877552"
  }
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.gbp.locations.createLocation(location)
 Description: Imports an existing Google Business Profile location.  Specify the Google account GUID in `accountId` and the Google location GUID in `location.id`. Both are available from List Unimported Locations.  This doesn't create a listing in Google. It records a location the Google account already has, so that the site can manage it. To create a new listing, call Create Google Location.  A Google account must be connected first, or the call fails with `CONNECTION_NOT_FOUND`. See the [Connection API](https://dev.wix.com/docs/api-reference/business-management/google-business-profile/connection-v1.md).
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  location, location._id, location.accountId
 Method parameters: 
   param name: location | type: GBPLocation | description: A GBP location is a site's stable record of one Google Business Profile location.  It holds the identifiers and operational metadata needed to work with that location on Google's behalf. It doesn't store the Google-owned profile data itself: name, address, opening hours, photos, reviews, attributes and insights are all retrieved live from Google on each call, so they're never stale here and never edited here.  `id` is Google's own location identifier, so you can use it to correlate a location with data you retrieve from Google directly.  The only personal data on a GBP location is `serviceAreaPostalAddress`, which is set for service-area businesses. It's often a home address, so it's stored encrypted and is covered by the site's data-deletion requests.  A Google account must be connected before locations can be imported, and before any call that reads or writes a specific location's profile. See the [Connection API](https://dev.wix.com/docs/api-reference/business-management/google-business-profile/connection-v1.md).  Two methods work without a connection, because they read Google's public catalog rather than a site's own profile: Search Google Locations, and List Attribute Metadata when called with `categoryRegion`. Both are useful before a site owner has connected anything. | required: true 
        - name: _id | type: string | description: Google's opaque location identifier on the public API. | required: true | validation: minLength 1, maxLength 255, immutable
        - name: accountId | type: string | description: GUID of the Google Business Profile account that holds this location, what Google calls a location group.  One site can have locations in more than one account, because a single Google login can own several. | required: true | validation: maxLength 255, immutable
        - name: serviceAreaPostalAddress | type: PostalAddress | description: Saved postal address for service-area businesses. Used as the `context` parameter in Google's FetchVerificationOptions call for service-area verification flows. Null for storefront businesses.  
           - name: countryCode | type: string | description: ISO 3166-1 alpha-2 country code (e.g. "US", "GB").  | validation: format COUNTRY
           - name: postalCode | type: string | description: Postal/ZIP code.  | validation: maxLength 20
           - name: administrativeArea | type: string | description: Administrative area (state, province, region).  | validation: maxLength 100
           - name: locality | type: string | description: City or locality.  | validation: maxLength 100
           - name: addressLines | type: array<string> | description: Street address lines. Up to 5 lines.  | validation: maxItems 5, maxLength 255
        - name: feedEntityId | type: string | description: Identity this location is published under in Google partner feeds, used as the entity GUID, merchant GUID or parent entity GUID across Reserve with Google, Order with Google and Dine with Google.  Can be set once. A location that already has a value keeps it, and a request that tries to change it is rejected: Google has already ingested the value as the merchant's identity, so changing it withdraws the business from those feeds and can remove its booking and ordering buttons. Setting it on a location that doesn't have one yet is allowed.  Locations created through this API are given a value automatically, so you usually don't need to set it. Specify it only when migrating a location whose identity Google already knows.  | validation: maxLength 288
 Return type: PROMISE<GBPLocation>
  - name: _id | type: string | description: Google's opaque location identifier on the public API.  | validation: minLength 1, maxLength 255, immutable
  - name: accountId | type: string | description: GUID of the Google Business Profile account that holds this location, what Google calls a location group.  One site can have locations in more than one account, because a single Google login can own several.  | validation: maxLength 255, immutable
  - name: serviceAreaPostalAddress | type: PostalAddress | description: Saved postal address for service-area businesses. Used as the `context` parameter in Google's FetchVerificationOptions call for service-area verification flows. Null for storefront businesses.  
     - name: countryCode | type: string | description: ISO 3166-1 alpha-2 country code (e.g. "US", "GB").  | validation: format COUNTRY
     - name: postalCode | type: string | description: Postal/ZIP code.  | validation: maxLength 20
     - name: administrativeArea | type: string | description: Administrative area (state, province, region).  | validation: maxLength 100
     - name: locality | type: string | description: City or locality.  | validation: maxLength 100
     - name: addressLines | type: array<string> | description: Street address lines. Up to 5 lines.  | validation: maxItems 5, maxLength 255
  - name: _createdDate | type: Date | description: Date and time the location was imported into Wix.  | read-only: true 
  - name: _updatedDate | type: Date | description: Date and time the location was last updated.  | read-only: true 
  - name: revision | type: string | description: Revision number, incremented on every update. Used for optimistic locking.  | read-only: true 
  - name: googleLocationId | type: string | description: Google's location identifier for this location, the same value as `id`. Filter and sort on this field in Query GBP Locations.  | read-only: true | validation: maxLength 255, immutable
  - name: feedEntityId | type: string | description: Identity this location is published under in Google partner feeds, used as the entity GUID, merchant GUID or parent entity GUID across Reserve with Google, Order with Google and Dine with Google.  Can be set once. A location that already has a value keeps it, and a request that tries to change it is rejected: Google has already ingested the value as the merchant's identity, so changing it withdraws the business from those feeds and can remove its booking and ordering buttons. Setting it on a location that doesn't have one yet is allowed.  Locations created through this API are given a value automatically, so you usually don't need to set it. Specify it only when migrating a location whose identity Google already knows.  | validation: maxLength 288

 Possible Errors:
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: CONNECTION_ID_REQUIRED | Description: The site holds more than one Google connection and the request named none (`connectionId`), so there is no single account to act through.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: CONNECTION_NOT_FOUND | Description: No Google account is connected to the target Wix site. Follow the authorization flow in [Get Connect URL](https://dev.wix.com/docs/api-reference/business-management/google-business-profile/connection-v1/get-connect-url.md) before retrying.


```

### Examples

### Import an existing Google location
Record a Google Business Profile location for the site by its Google identifiers.

```javascript
import { locations } from "@wix/gbp";

async function createLocation() {
  const location = await locations.createLocation({
    _id: "8034569321457853640",
    accountId: "104312867792031877552",
  });

  console.log(location._id);
}

```

### createLocation (self-managed)
Self-managed SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { locations } from '@wix/gbp';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { locations },
  // Include the auth strategy and host as relevant
});


async function createLocation(location) {
  const response = await myWixClient.locations.createLocation(location);
};
```

---