Monitor API Usage

With the Einstein Vision API, you can make as many calls as needed to create datasets, add images, and create models. However, the number of predictions—any call to the predict resource—is limited. To proactively manage your API prediction limits, you can get your API usage.
You can get prediction usage information from the Einstein Vision API in two ways.
  • Response headers—A call to the predict resource returns headers that contain basic rate limit information. You can use the headers to monitor your prediction usage as prediction calls are made and avoid making an explicit API call.
    X-RateLimit-Limit 1000
    X-RateLimit-Remaining 997
    X-RateLimit-Reset 2017-05-01 00:00:00.0
    • X-RateLimit-Limit—Maximum number of prediction calls available for the current plan month.
    • X-RateLimit-Remaining—Total number of prediction calls you have left for the current plan month.
    • X-RateLimit-Reset—Date on which your predictions are next provisioned. Always the first of the month.
  • apiusage resource—This resource contains detailed information about your plans and prediction usage. This cURL call gets your prediction usage and plan information.
    curl -X GET -H "Authorization: Bearer <TOKEN>" -H "Cache-Control: no-cache" https://api.metamind.io/v1/apiusage
    {
      "object": "list",
      "data": [
        {
          "id": "108",
          "organizationId": "2",
          "startsAt": "2017-04-01T00:00:00.000Z",
          "endsAt": "2017-05-01T00:00:00.000Z",
          "planData": [
            {
              "plan": "FREE",
              "amount": 1,
              "source": "SALESFORCE"
            }
          ],
          "licenseId": "oxDXJPi7z",
          "object": "apiusage",
          "predictionsRemaining": 997,
          "predictionsUsed": 3,
          "predictionsMax": 1000
        }
      ]
    }