1 // Copyright 2019 Google LLC.
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
18 package google.ads.googleads.v1.services;
20 import "google/ads/googleads/v1/common/keyword_plan_common.proto";
21 import "google/ads/googleads/v1/resources/keyword_plan.proto";
22 import "google/api/annotations.proto";
23 import "google/protobuf/field_mask.proto";
24 import "google/protobuf/wrappers.proto";
25 import "google/rpc/status.proto";
27 option csharp_namespace = "Google.Ads.GoogleAds.V1.Services";
28 option go_package = "google.golang.org/genproto/googleapis/ads/googleads/v1/services;services";
29 option java_multiple_files = true;
30 option java_outer_classname = "KeywordPlanServiceProto";
31 option java_package = "com.google.ads.googleads.v1.services";
32 option objc_class_prefix = "GAA";
33 option php_namespace = "Google\\Ads\\GoogleAds\\V1\\Services";
34 option ruby_package = "Google::Ads::GoogleAds::V1::Services";
35 // Proto file describing the keyword plan service.
37 // Service to manage keyword plans.
38 service KeywordPlanService {
39 // Returns the requested plan in full detail.
40 rpc GetKeywordPlan(GetKeywordPlanRequest) returns (google.ads.googleads.v1.resources.KeywordPlan) {
41 option (google.api.http) = {
42 get: "/v1/{resource_name=customers/*/keywordPlans/*}"
46 // Creates, updates, or removes keyword plans. Operation statuses are
48 rpc MutateKeywordPlans(MutateKeywordPlansRequest) returns (MutateKeywordPlansResponse) {
49 option (google.api.http) = {
50 post: "/v1/customers/{customer_id=*}/keywordPlans:mutate"
55 // Returns the requested Keyword Plan forecasts.
56 rpc GenerateForecastMetrics(GenerateForecastMetricsRequest) returns (GenerateForecastMetricsResponse) {
57 option (google.api.http) = {
58 post: "/v1/{keyword_plan=customers/*/keywordPlans/*}:generateForecastMetrics"
63 // Returns the requested Keyword Plan historical metrics.
64 rpc GenerateHistoricalMetrics(GenerateHistoricalMetricsRequest) returns (GenerateHistoricalMetricsResponse) {
65 option (google.api.http) = {
66 post: "/v1/{keyword_plan=customers/*/keywordPlans/*}:generateHistoricalMetrics"
72 // Request message for [KeywordPlanService.GetKeywordPlan][google.ads.googleads.v1.services.KeywordPlanService.GetKeywordPlan].
73 message GetKeywordPlanRequest {
74 // The resource name of the plan to fetch.
75 string resource_name = 1;
78 // Request message for [KeywordPlanService.MutateKeywordPlans][google.ads.googleads.v1.services.KeywordPlanService.MutateKeywordPlans].
79 message MutateKeywordPlansRequest {
80 // The ID of the customer whose keyword plans are being modified.
81 string customer_id = 1;
83 // The list of operations to perform on individual keyword plans.
84 repeated KeywordPlanOperation operations = 2;
86 // If true, successful operations will be carried out and invalid
87 // operations will return errors. If false, all operations will be carried
88 // out in one transaction if and only if they are all valid.
90 bool partial_failure = 3;
92 // If true, the request is validated but not executed. Only errors are
93 // returned, not results.
94 bool validate_only = 4;
97 // A single operation (create, update, remove) on a keyword plan.
98 message KeywordPlanOperation {
99 // The FieldMask that determines which resource fields are modified in an
101 google.protobuf.FieldMask update_mask = 4;
103 // The mutate operation.
105 // Create operation: No resource name is expected for the new keyword plan.
106 google.ads.googleads.v1.resources.KeywordPlan create = 1;
108 // Update operation: The keyword plan is expected to have a valid resource
110 google.ads.googleads.v1.resources.KeywordPlan update = 2;
112 // Remove operation: A resource name for the removed keyword plan is
113 // expected in this format:
115 // `customers/{customer_id}/keywordPlans/{keyword_plan_id}`
120 // Response message for a keyword plan mutate.
121 message MutateKeywordPlansResponse {
122 // Errors that pertain to operation failures in the partial failure mode.
123 // Returned only when partial_failure = true and all errors occur inside the
124 // operations. If any errors occur outside the operations (e.g. auth errors),
125 // we return an RPC level error.
126 google.rpc.Status partial_failure_error = 3;
128 // All results for the mutate.
129 repeated MutateKeywordPlansResult results = 2;
132 // The result for the keyword plan mutate.
133 message MutateKeywordPlansResult {
134 // Returned for successful operations.
135 string resource_name = 1;
138 // Request message for [KeywordPlanService.GenerateForecastMetrics][google.ads.googleads.v1.services.KeywordPlanService.GenerateForecastMetrics].
139 message GenerateForecastMetricsRequest {
140 // The resource name of the keyword plan to be forecasted.
141 string keyword_plan = 1;
144 // Response message for [KeywordPlanService.GenerateForecastMetrics][google.ads.googleads.v1.services.KeywordPlanService.GenerateForecastMetrics].
145 message GenerateForecastMetricsResponse {
146 // List of campaign forecasts.
148 repeated KeywordPlanCampaignForecast campaign_forecasts = 1;
150 // List of ad group forecasts.
151 repeated KeywordPlanAdGroupForecast ad_group_forecasts = 2;
153 // List of keyword forecasts.
154 repeated KeywordPlanKeywordForecast keyword_forecasts = 3;
157 // A campaign forecast.
158 message KeywordPlanCampaignForecast {
159 // The resource name of the Keyword Plan campaign related to the forecast.
161 // `customers/{customer_id}/keywordPlanCampaigns/{keyword+plan_campaign_id}`
162 google.protobuf.StringValue keyword_plan_campaign = 1;
164 // The forecast for the Keyword Plan campaign.
165 ForecastMetrics campaign_forecast = 2;
168 // An ad group forecast.
169 message KeywordPlanAdGroupForecast {
170 // The resource name of the Keyword Plan ad group related to the forecast.
172 // `customers/{customer_id}/keywordPlanAdGroups/{keyword_plan_ad_group_id}`
173 google.protobuf.StringValue keyword_plan_ad_group = 1;
175 // The forecast for the Keyword Plan ad group.
176 ForecastMetrics ad_group_forecast = 2;
179 // A keyword forecast.
180 message KeywordPlanKeywordForecast {
181 // The resource name of the Keyword Plan keyword related to the forecast.
184 // `customers/{customer_id}/keywordPlanAdGroupKeywords/{keyword_plan_ad_group_keyword_id}`
185 google.protobuf.StringValue keyword_plan_ad_group_keyword = 1;
187 // The forecast for the Keyword Plan keyword.
188 ForecastMetrics keyword_forecast = 2;
192 message ForecastMetrics {
194 google.protobuf.DoubleValue impressions = 1;
197 google.protobuf.DoubleValue ctr = 2;
200 google.protobuf.Int64Value average_cpc = 3;
203 google.protobuf.DoubleValue clicks = 5;
206 google.protobuf.Int64Value cost_micros = 6;
209 // Request message for [KeywordPlanService.GenerateHistoricalMetrics][google.ads.googleads.v1.services.KeywordPlanService.GenerateHistoricalMetrics].
210 message GenerateHistoricalMetricsRequest {
211 // The resource name of the keyword plan of which historical metrics are
213 string keyword_plan = 1;
216 // Response message for [KeywordPlanService.GenerateHistoricalMetrics][google.ads.googleads.v1.services.KeywordPlanService.GenerateHistoricalMetrics].
217 message GenerateHistoricalMetricsResponse {
218 // List of keyword historical metrics.
219 repeated KeywordPlanKeywordHistoricalMetrics metrics = 1;
222 // A keyword historical metrics.
223 message KeywordPlanKeywordHistoricalMetrics {
224 // The text of the query associated with one or more ad_group_keywords in the
227 // Note that we de-dupe your keywords list, eliminating close variants before
228 // returning the plan's keywords as text. For example, if your plan originally
229 // contained the keywords 'car' and 'cars', the returned search query will
230 // only contain 'car'.
231 google.protobuf.StringValue search_query = 1;
233 // The historical metrics for the query associated with one or more
234 // ad_group_keywords in the plan.
235 google.ads.googleads.v1.common.KeywordPlanHistoricalMetrics keyword_metrics = 2;