/api/v4/locations创建地点
在您的账户中创建一个新的商家地点,并将其加入商家信息提交队列。
参数
请求体
标记为必填的嵌套字段仅在您发送其父字段时适用。如果父字段为可选且您省略了它,其必填子字段不适用。
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
| input.name | string | 必填 | Name of the business. |
| input.description | string | 必填 | Business description, minimum 200 characters (`SY10005` when missing or shorter). Publishers use it as the primary listing copy. |
| input.storeId | string | 可选 | Unique store code. Must be unique across the account. |
| input.street | string | 必填 | Street address, 5 to 100 characters (`SY10011`). |
| input.city | string | 必填 | City. Required where the country's `hasCity` is `true` (`SY10126`). Where it is `false`, a city you send is dropped. |
| input.stateIso | string | 必填 | State ISO code. Required where the country's `stateRequired` is `true`, and must be one of that country's `states` (`SY10010`). Leave it out where `stateRequired` is `false`. See the countries and states endpoint for valid values. |
| input.postalCode | string | 可选 | Postal code. Optional, but send it wherever the country's `hasPostalCode` is `true`. A value you send must match the country's format (`SY10014`). |
| input.countryIso | string | 必填 | Country ISO code. Must be a supported country (`SY10036`). See the countries and states endpoint for valid values. |
| input.phone | string | 必填 | Primary phone number, validated for the country (`SY10015`). |
| input.subCategoryId | integer | 必填 | Primary subcategory ID. Pick a valid ID from the subcategories list endpoint. |
| input.bizUrl | string | 必填 | Business website URL. Published to directories as the location's website. Some publishers refuse a listing without one. |
| input.primaryGbpSiteCategoryId | string | 可选 | Primary Google Business Profile category, as a GCID (e.g. `gcid:restaurant`). Resolved against `countryIso`, so send the two together. |
| input.additionalGbpSiteCategoryIds | array of strings | 可选 | Additional Google Business Profile categories, as GCIDs. Also resolved against `countryIso`. |
| input.offeringsUrl | string | 可选 | URL of the menu, catalogue, or service list. |
| input.bookingUrl | string | 可选 | URL customers use to book an appointment. |
| input.reservationUrl | string | 可选 | URL customers use to make a reservation. |
| input.street1 | string | 可选 | Second address line (suite, unit, floor). |
| input.latitude | string | 可选 | Latitude of the location, as a string. Send with `longitude`; publishers use it when the address alone is ambiguous. |
| input.longitude | string | 可选 | Longitude of the location, as a string. Send with `latitude`. |
| input.ownerEmail | string | 可选 | Email of the location owner. Used for listing claims and verification, not for login. |
| input.ownerName | string | 可选 | Name of the location owner. |
| input.facebookUrl | string | 可选 | URL of the location's Facebook page. |
| input.twitterUrl | string | 可选 | URL of the location's X (Twitter) profile. |
| input.linkedinUrl | string | 可选 | URL of the location's LinkedIn page. |
| input.instagramUrl | string | 可选 | URL of the location's Instagram profile. |
| input.youtubeUrl | string | 可选 | URL of the location's YouTube channel. |
| input.tiktokUrl | string | 可选 | URL of the location's TikTok profile. |
| input.pinterestUrl | string | 可选 | URL of the location's Pinterest profile. |
| input.tagline | string | 可选 | Short tagline for the business. |
| input.yearOfIncorporation | string | 可选 | Year the business was incorporated, e.g. `2014`. |
| input.googleAdsPhone | string | 可选 | Alternate phone shown on Google Ads location extensions instead of `phone`. |
| input.additionalPhones | array of strings | 可选 | Secondary phone numbers submitted to Google Business Profile. |
| input.videos | array of strings | 可选 | Video URLs for the location. |
| input.additionalCategoryIds | array of integers | 可选 | Secondary Listings API subcategory IDs, from the subcategories endpoint. Distinct from `additionalGbpSiteCategoryIds`, which takes Google GCIDs. |
| input.submissionDisabledSiteIds | array of integers | 可选 | Site IDs to exclude from submission. The inverse of `enabledSiteIds`, useful when you want every site in your plan except a few. |
| input.hideAddress | boolean | 可选 | Set `true` for a service-area business. ListingsAPI stores the address you send but does not submit it to publishers. |
| input.temporarilyClosed | boolean | 可选 | Set `true` to stop publishing business hours while the location is temporarily closed. |
| input.serviceItems | array of objects | 可选 | Services offered, published to Google Business Profile. |
| input.customAttributes | array of objects | 可选 | Publisher-specific attributes for the location. |
| input.paymentMethods | array of strings | 可选 | Payment methods accepted. One or more of `VISA`, `MASTERCARD`, `AMEX`, `CASH`, `CHEQUE`, `CRYPTO`, `DINERS_CLUB`, `DISCOVER`, `FINANCING`, `INVOICE`, `TRAVELERS_CHECK`, `APPLE_PAY`, `SAMSUNG_PAY`, `PAYPAL`, `ANDROID_PAY`. |
| input.businessHours | array of objects | 可选 | Opening hours. Each entry is `{ day, type, slots }`, plus `specialDate` for a `SPECIAL` entry: `day` is an uppercase weekday enum (MONDAY–SUNDAY) or `SPECIAL`, `type` is `OPEN` or `CLOSED`, and `slots` is an array of `{ start, end }` time strings (e.g. `09:00am`, `05:00pm`). For a closed day use `type: "CLOSED"` with an empty `slots` array. |
| input.businessHours[].day | string | 必填 | MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY, or SPECIAL (a one-off override for the date in `specialDate`). |
| input.businessHours[].type | string | 必填 | `OPEN` or `CLOSED`. |
| input.businessHours[].specialDate | string | 可选 | Date of a one-off override, as `YYYY-MM-DD`. Set this only when `day` is `SPECIAL`. |
| input.businessHours[].slots | array of objects | 可选 | Open intervals for the day, each `{ start, end }`. Omit or leave empty when `type` is `CLOSED`. |
| input.businessHours[].slots[].start | string | 必填 | Opening time, e.g. `09:00am`. |
| input.businessHours[].slots[].end | string | 必填 | Closing time, e.g. `05:00pm`. |
| input.serviceArea | object | 可选 | Service-area definition for service-area businesses: `{ businessType, regionCode, placeInfos: [{ placeId, placeName }] }`. |
| input.placeActionLinks | array of objects | 可选 | Google action links (ordering, delivery, takeout, reservation, appointment). Each item: `placeActionType` (enum), `uri` (string), optional `isPreferred` (boolean). On create every link is new, so no `action` is needed. See the Place Action Links guide. |
| input.enabledSiteIds | array of integers | 可选 | Site IDs to publish this location to, when you want a subset of your plan's sites. See the plan-sites endpoint for valid IDs. Omit to publish to every site in your plan. |
| input.clientMutationId | string | 可选 | Optional correlation token returned unchanged in the response. It does not prevent duplicate writes: the server does not detect repeated calls that reuse the same value. |
请求示例
可直接粘贴的请求体。请将占位 ID 和值替换为您自己的。
{ "input": { "name": "Acme Kitchen", "description": "Acme Kitchen is a family-owned neighborhood restaurant in downtown New York serving wood-fired pizza, hand-rolled pasta, and a short seasonal menu built around produce from nearby growers. Our dining room seats forty, takeout and delivery run until close, and the bar pours regional wine and beer on tap.", "storeId": "ACME01", "street": "123 Jump Street", "city": "New York", "stateIso": "NY", "postalCode": "10013", "countryIso": "US", "phone": "6443859313", "bizUrl": "https://acmekitchen.example.com", "subCategoryId": 1432, "primaryGbpSiteCategoryId": "gcid:restaurant", "additionalGbpSiteCategoryIds": ["gcid:pizza_restaurant"], "businessHours": [ { "day": "MONDAY", "type": "OPEN", "slots": [{ "start": "09:00am", "end": "05:00pm" }] }, { "day": "TUESDAY", "type": "OPEN", "slots": [{ "start": "09:00am", "end": "05:00pm" }] }, { "day": "WEDNESDAY", "type": "OPEN", "slots": [{ "start": "09:00am", "end": "05:00pm" }] }, { "day": "THURSDAY", "type": "OPEN", "slots": [{ "start": "09:00am", "end": "05:00pm" }] }, { "day": "FRIDAY", "type": "OPEN", "slots": [{ "start": "09:00am", "end": "05:00pm" }] }, { "day": "SATURDAY", "type": "OPEN", "slots": [{ "start": "10:00am", "end": "02:00pm" }] }, { "day": "SUNDAY", "type": "CLOSED", "slots": [] } ], "placeActionLinks": [ { "placeActionType": "FOOD_ORDERING", "uri": "https://order.acmekitchen.example.com", "isPreferred": true }, { "placeActionType": "FOOD_TAKEOUT", "uri": "https://takeout.acmekitchen.example.com" } ] }}响应
200Location created successfully. Returns the new location as a summary object.
{ "data": { "createLocation": { "clientMutationId": null, "success": true, "errors": null, "location": { "id": "TG9jYXRpb246MTgwMDI5MA==", "databaseId": 1800290, "storeId": "ACME01", "name": "Acme Kitchen", "street": "123 Jump Street", "city": "New York", "stateIso": "NY", "postalCode": "10013", "countryIso": "US", "phone": "6443859313", "status": "PENDING", "primaryGbpSiteCategoryId": null, "placeActionLinks": [ { "placeActionType": "FOOD_ORDERING", "uri": "https://order.acmekitchen.example.com", "isPreferred": true, "name": null, "submissionStatus": null }, { "placeActionType": "FOOD_TAKEOUT", "uri": "https://takeout.acmekitchen.example.com", "isPreferred": false, "name": null, "submissionStatus": null } ], "discoveredPlaceActionLinks": [] } } }}400Bad request, validation failure (see `errors[]`).
401Unauthenticated, missing or invalid API key.
429Rate limit exceeded. Retry after the `Retry-After` header value.
创建一个新的商家地点。创建成功后,该地点将加入提交队列,提交至其套餐中的每个发布平台(如果提供了 enabledSiteIds,则仅提交至指定站点)。必填字段:name、至少包含 200 个字符的 description、subCategoryId、countryIso,以及在采用城市级地址的国家/地区必填的 city。地点还需要有效的街道地址和电话号码才能实际发布,请在创建时提供这些信息,以免后续还需要更新。
返回的 id 经过 base64 编码(例如 TG9jYXRpb246MTgwMDI5MA==);解码后即可查看内部的 Location:<databaseId> 格式。后续每次调用都引用此 base64 编码的 id。
使用场景:录入单个门店及其营业时间。 发送地址、phone、subCategoryId 和一个 businessHours 数组,其中一周中的每一天对应一个条目,包含 type: "OPEN" 和 { start, end } 时段;对于不营业的日期,则使用 type: "CLOSED" 并提供空的 slots 数组。将您自己的键存储在 storeId 中,以便稍后通过按门店代码获取来查找该地点,而无需跟踪 Listings API 的 ID。
设置特殊营业时间需要提供常规营业时间。 特殊营业时间(用于覆盖节假日或活动期间的营业时间,以 businessHours 条目发送,包含 day: "SPECIAL"、type: "OPEN" 或 "CLOSED",以及采用 YYYY-MM-DD 格式的 specialDate)只有在地点同时包含常规的 MONDAY–SUNDAY 营业时间表时才会发布,Google 会拒绝仅提交特殊营业时间而未提供常规营业时间的地点。每当您设置 SPECIAL 条目时,请务必在 businessHours 中包含完整的一周 7 天营业时间;完整模型请参阅更新端点的营业时间规则。
使用场景:发布至部分站点。 传入 enabledSiteIds(来自 plan-sites 端点的站点 ID),即可将地点发布至选定的部分目录,而非套餐中的全部目录,这是代理机构销售分层站点覆盖服务时采用的方式。
在创建时设置 Google 操作按钮。 传入 placeActionLinks,即可在同一次调用中设置地点的 Google 操作按钮(预约、在线订购等)。有效的 placeActionType 值包括 APPOINTMENT、ONLINE_APPOINTMENT、DINING_RESERVATION、FOOD_ORDERING、FOOD_DELIVERY、FOOD_TAKEOUT 和 SHOP_ONLINE,每种类型最多只能有一个首选链接。创建完成后,每个链接的 name 和 submissionStatus 均为 null,直到该链接同步至 Google。若要稍后添加、编辑或移除链接,请使用更新地点;完整模型请参阅地点操作链接指南。
常见错误(返回 400,详情在 errors[] 中):description 必须至少包含 200 个字符(SY10005),countryIso 必须是受支持的国家/地区(SY10036),对于采用城市级地址的国家/地区,city 为必填项(SY10126),state 必须是有效的 ISO 代码,邮政编码和电话号码必须在该国家/地区有效,subCategoryId 必须存在,且 storeId 必须在整个账户内唯一。无论使用哪个端点,每个请求都会消耗相同的速率限制配额,因此批量录入仅凭请求数量就会触发 429,请遵循 Retry-After 响应头,逐个创建,不要集中突发请求。
curl -X POST 'https://listingsapi.com/api/v4/locations' \ -H "Authorization: API $LISTINGSAPI_KEY" \ -H 'Content-Type: application/json' \ -d '{ "input": { "name": "Acme Kitchen", "description": "Acme Kitchen is a family-owned neighborhood restaurant in downtown New York serving wood-fired pizza, hand-rolled pasta, and a short seasonal menu built around produce from nearby growers. Our dining room seats forty, takeout and delivery run until close, and the bar pours regional wine and beer on tap.", "storeId": "ACME01", "street": "123 Jump Street", "city": "New York", "stateIso": "NY", "postalCode": "10013", "countryIso": "US", "phone": "6443859313", "bizUrl": "https://acmekitchen.example.com", "subCategoryId": 1432, "primaryGbpSiteCategoryId": "gcid:restaurant", "additionalGbpSiteCategoryIds": [ "gcid:pizza_restaurant" ], "businessHours": [ { "day": "MONDAY", "type": "OPEN", "slots": [ { "start": "09:00am", "end": "05:00pm" } ] }, { "day": "TUESDAY", "type": "OPEN", "slots": [ { "start": "09:00am", "end": "05:00pm" } ] }, { "day": "WEDNESDAY", "type": "OPEN", "slots": [ { "start": "09:00am", "end": "05:00pm" } ] }, { "day": "THURSDAY", "type": "OPEN", "slots": [ { "start": "09:00am", "end": "05:00pm" } ] }, { "day": "FRIDAY", "type": "OPEN", "slots": [ { "start": "09:00am", "end": "05:00pm" } ] }, { "day": "SATURDAY", "type": "OPEN", "slots": [ { "start": "10:00am", "end": "02:00pm" } ] }, { "day": "SUNDAY", "type": "CLOSED", "slots": [] } ], "placeActionLinks": [ { "placeActionType": "FOOD_ORDERING", "uri": "https://order.acmekitchen.example.com", "isPreferred": true }, { "placeActionType": "FOOD_TAKEOUT", "uri": "https://takeout.acmekitchen.example.com" } ] } }'