Monitoring APIs and capping usage

You can view traffic reports and billing information for a project or API on your project home page. To navigate to your project home page, select the project name from the list at the top of the page.

Traffic reports are available only if there is recent usage. If available, there will be a graph on the project home page labeled API that shows the traffic. If there is no recent usage, then the traffic report is not displayed.

To view traffic summaries for a specific API, do the following:

  1. Go to the console.
  2. From the projects list, select a project or create a new one.
  3. Open the console menu  Gallery Menu  and select API Manager.
  4. Click Enabled APIs.
  5. Click the name of the API.
  6. Click Quotas or Usage.

To view billing details if you have billing enabled, click Estimated charges this month under Billing.

If you don't have billing enabled, you first need to enable it. For information about enabling billing for your project, see Activating and deactivating APIs.

For information about monitoring your account by capping usage, see the following topic.

Capping usage

You can explicitly cap requests in two ways: requests per second per user and requests per day.

Requests per second per user

You can limit the number of requests per second per user for an API in order to prevent individual users from using up your API quota. Each API includes a default per-user limit, but you can modify that value.

Individual users are identified either by their IP address or by a unique string; if you're creating a server-side application (where the calling code is hosted on a server that you own) that makes requests on behalf of users, your requests must include the userIp parameter or the quotaUserparameter, as described below.

Note that although per-user limits are specified in queries per second, we permit short-term usage spikes. Therefore, you should set your limits based on sustained average traffic levels. If anyone tries to use an API in excess of these settings, the requests will trigger a "limit exceeded" error.

There are two ways to identify a user:

  • To identify a user by IP address, include the userIp=x.x.x.x parameter in your requests, where x.x.x.x is the IP address of the user for whom the server-side application is making the call.
  • If your application doesn't know the user's IP address (for example, if your application runs cron jobs on App Engine on a user's behalf), then use the quotaUser=userID parameter. You can choose any arbitrary string under forty characters long that uniquely identifies a user. If you provide both parameters, quotaUser overrides userIp.

These parameters are used for capping requests per user per second; you can't use them for whitelisting. If you don't send the userIp or quotaUserparameters, then all calls are listed as coming directly from the server-side machine itself, in which case calls can't be capped by user.

When sending the user's IP address or other identifier, please be sure that you comply with any local laws, including any laws relating to the disclosure of any personal information you send with each request.

Requests per day (available only when billing is enabled)

You can set daily limits to all requests to any billable API. Most APIs set a default daily limit, but you can change that limit, up to a maximum specified by Google. This will cap requests from all users.

To view or change daily billable limits for your API, do the following:

  1. Go to the console.
  2. From the projects list, select a project or create a new one.
  3. Open the console menu  Gallery Menu  and select API Manager.
  4. Click Enabled APIs.
  5. Click the name of an activated API you're interested in.
  6. Near the top of the page, click Quotas.
  7. On the Total quota line, click the edit icon, then enter the preferred total billable daily quota, up to the limit specified by Google.

 

Note: You can set daily billable limits only on billable APIs. If your project doesn't use any billable APIs, you can't set daily limits.

Was this article helpful?