---
title: Get API Metrics
slug: fourkites-api-reference/get-api-metrics
icon: {"apiMethod":"GET"}
createdAt: 2025-07-24T05:17:21.000Z
---

This API will help retreive a summary of API usage volume made by user, including a total count and a daily breakdown, for a specific API path within the last 30 days. The data is filtered based on the API keys associated with the current user's company.

:::hint{type="info"}
### Rate Limit

**1 request per second**
:::

:::hint{type="info"}
### Format Supported

**JSON**
:::

:::hint{type="info"}
### Authenticated Resource

**API Key**
:::

:::ApiMethodV2
```json
{
  "name": "Production",
  "method": "GET",
  "url": "https://api.fourkites.com/api-usage-metrics?startDate=16/06/25&apiPath=/shipments",
  "description": "",
  "tab": "examples",
  "examples": {
    "languages": [
      {
        "id": "ng6eRKo47ZuOVMp85jLBj",
        "language": "curl",
        "code": "curl --location 'https://api.fourkites.com/api-usage-metrics?startDate=16/06/25&apiPath=/shipments' \\\n--header 'apikey: REPLACE_KEY_VALUE'",
        "customLabel": ""
      },
      {
        "id": "x6DEqXmhvKusxxGImoiE7",
        "language": "java",
        "code": "OkHttpClient client = new OkHttpClient().newBuilder()\n  .build();\nMediaType mediaType = MediaType.parse(\"text/plain\");\nRequestBody body = RequestBody.create(mediaType, \"\");\nRequest request = new Request.Builder()\n  .url(\"https://api.fourkites.com/api-usage-metrics?startDate=16/06/25&apiPath=/shipments\")\n  .method(\"GET\", body)\n  .addHeader(\"apikey\", \"REPLACE_KEY_VALUE\")\n  .build();\nResponse response = client.newCall(request).execute();",
        "customLabel": ""
      },
      {
        "id": "IvMrc_hnopFuyFEvtuUgg",
        "language": "javascript",
        "code": "var settings = {\n  \"url\": \"https://api.fourkites.com/api-usage-metrics?startDate=16/06/25&apiPath=/shipments\",\n  \"method\": \"GET\",\n  \"timeout\": 0,\n  \"headers\": {\n    \"apikey\": \"REPLACE_KEY_VALUE\"\n  },\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});",
        "customLabel": ""
      },
      {
        "id": "iTG4A0dsw-G2p3PHx58OY",
        "language": "swift",
        "code": "var request = URLRequest(url: URL(string: \"https://api.fourkites.com/api-usage-metrics?startDate=16%2F06%2F25&apiPath=%2Fshipments\")!,timeoutInterval: Double.infinity)\nrequest.addValue(\"REPLACE_KEY_VALUE\", forHTTPHeaderField: \"apikey\")\n\nrequest.httpMethod = \"GET\"\n\nlet task = URLSession.shared.dataTask(with: request) { data, response, error in \n  guard let data = data else {\n    print(String(describing: error))\n    return\n  }\n  print(String(data: data, encoding: .utf8)!)\n}\n\ntask.resume()\n",
        "customLabel": ""
      },
      {
        "id": "jI6uuYbOiVTb-lZUGje0E",
        "language": "csharp",
        "code": "var client = new HttpClient();\nvar request = new HttpRequestMessage(HttpMethod.Get, \"https://api.fourkites.com/api-usage-metrics?startDate=16/06/25&apiPath=/shipments\");\nrequest.Headers.Add(\"apikey\", \"REPLACE_KEY_VALUE\");\nvar response = await client.SendAsync(request);\nresponse.EnsureSuccessStatusCode();\nConsole.WriteLine(await response.Content.ReadAsStringAsync());\n",
        "customLabel": ""
      },
      {
        "id": "-byM6_bRT-dKOYcgV03SQ",
        "language": "go",
        "code": "package main\n\nimport (\n  \"fmt\"\n  \"net/http\"\n  \"io/ioutil\"\n)\n\nfunc main() {\n\n  url := \"https://api.fourkites.com/api-usage-metrics?startDate=16%2F06%2F25&apiPath=%2Fshipments\"\n  method := \"GET\"\n\n  client := &http.Client {\n  }\n  req, err := http.NewRequest(method, url, nil)\n\n  if err != nil {\n    fmt.Println(err)\n    return\n  }\n  req.Header.Add(\"apikey\", \"REPLACE_KEY_VALUE\")\n\n  res, err := client.Do(req)\n  if err != nil {\n    fmt.Println(err)\n    return\n  }\n  defer res.Body.Close()\n\n  body, err := ioutil.ReadAll(res.Body)\n  if err != nil {\n    fmt.Println(err)\n    return\n  }\n  fmt.Println(string(body))\n}",
        "customLabel": ""
      },
      {
        "id": "GUbipZgyriLCXw5DYWR0h",
        "language": "ruby",
        "code": "require \"uri\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.fourkites.com/api-usage-metrics?startDate=16/06/25&apiPath=/shipments\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"apikey\"] = \"REPLACE_KEY_VALUE\"\n\nresponse = https.request(request)\nputs response.read_body\n",
        "customLabel": ""
      },
      {
        "id": "Jz_3pwB_CyUXNY4JT2xpc",
        "language": "python",
        "code": "import http.client\n\nconn = http.client.HTTPSConnection(\"api.fourkites.com\")\npayload = ''\nheaders = {\n  'apikey': 'REPLACE_KEY_VALUE'\n}\nconn.request(\"GET\", \"/api-usage-metrics?startDate=16/06/25&apiPath=/shipments\", payload, headers)\nres = conn.getresponse()\ndata = res.read()\nprint(data.decode(\"utf-8\"))",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "ng6eRKo47ZuOVMp85jLBj"
  },
  "results": {
    "languages": [
      {
        "id": "zuYrKA0Y8KQs631iIGFh8",
        "language": "200",
        "customLabel": "",
        "code": "{\n    \"total_requests\": 600,\n    \"daily_counts\": {\n        \"2025-06-23\": 1,\n        \"2025-06-25\": 37,\n        \"2025-06-26\": 21,\n        \"2025-06-30\": 2,\n        \"2025-07-01\": 11,\n        \"2025-07-02\": 1,\n        \"2025-07-07\": 259,\n        \"2025-07-08\": 197,\n        \"2025-07-09\": 19,\n        \"2025-07-13\": 27,\n        \"2025-07-14\": 25\n    }\n}"
      },
      {
        "id": "0hxE1mVCL70WcRQsqt0Rz",
        "language": "400",
        "customLabel": "",
        "code": "{\n    \"timestamp\": 1752569656524,\n    \"message\": \"The provided date must be within the last 30 days.\",\n    \"details\": \"uri=/api-usage-metrics\"\n}"
      }
    ],
    "selectedLanguageId": "zuYrKA0Y8KQs631iIGFh8"
  },
  "request": {
    "pathParameters": [],
    "queryParameters": [
      {
        "name": "startDate",
        "kind": "optional",
        "type": "string",
        "description": "The start date for the metrics query, in dd/mm/yy format. The date must be within the last 30 days.",
        "": "The start date for the metrics query, in dd/mm/yy format. The date must be within the last 30 days."
      },
      {
        "name": "apiPath",
        "kind": "optional",
        "type": "string",
        "description": "The specific API path to fetch metrics for (e.g., /shipments, /api/v1/tracking).",
        "": "The specific API path to fetch metrics for (e.g., /shipments, /api/v1/tracking)."
      }
    ],
    "headerParameters": [],
    "bodyDataParameters": [],
    "formDataParameters": []
  },
  "currentNewParameter": {
    "label": "Query Parameter",
    "value": "queryParameters"
  },
  "hasTryItOut": false,
  "autoGeneratedAnchorSlug": "production",
  "legacyHash": "wkzca1X20AYlx5naW0MOd"
}
```
:::

:::ApiMethodV2
```json
{
  "name": "Staging",
  "method": "GET",
  "url": "https://api-staging.fourkites.com/api-usage-metrics?startDate=16/06/25&apiPath=/shipments",
  "description": "",
  "tab": "examples",
  "examples": {
    "languages": [
      {
        "id": "ng6eRKo47ZuOVMp85jLBj",
        "language": "curl",
        "code": "curl --location 'https://api.fourkites.com/api-usage-metrics?startDate=16/06/25&apiPath=/shipments' \\\n--header 'apikey: REPLACE_KEY_VALUE'",
        "customLabel": ""
      },
      {
        "id": "x6DEqXmhvKusxxGImoiE7",
        "language": "java",
        "code": "OkHttpClient client = new OkHttpClient().newBuilder()\n  .build();\nMediaType mediaType = MediaType.parse(\"text/plain\");\nRequestBody body = RequestBody.create(mediaType, \"\");\nRequest request = new Request.Builder()\n  .url(\"https://api-staging.fourkites.com/api-usage-metrics?startDate=16/06/25&apiPath=/shipments\")\n  .method(\"GET\", body)\n  .addHeader(\"apikey\", \"REPLACE_KEY_VALUE\")\n  .build();\nResponse response = client.newCall(request).execute();",
        "customLabel": ""
      },
      {
        "id": "IvMrc_hnopFuyFEvtuUgg",
        "language": "javascript",
        "code": "var settings = {\n  \"url\": \"https://api-staging.fourkites.com/api-usage-metrics?startDate=16/06/25&apiPath=/shipments\",\n  \"method\": \"GET\",\n  \"timeout\": 0,\n  \"headers\": {\n    \"apikey\": \"REPLACE_KEY_VALUE\"\n  },\n};\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});",
        "customLabel": ""
      },
      {
        "id": "iTG4A0dsw-G2p3PHx58OY",
        "language": "swift",
        "code": "var request = URLRequest(url: URL(string: \"https://api-staging.fourkites.com/api-usage-metrics?startDate=16%2F06%2F25&apiPath=%2Fshipments\")!,timeoutInterval: Double.infinity)\nrequest.addValue(\"REPLACE_KEY_VALUE\", forHTTPHeaderField: \"apikey\")\n\nrequest.httpMethod = \"GET\"\n\nlet task = URLSession.shared.dataTask(with: request) { data, response, error in \n  guard let data = data else {\n    print(String(describing: error))\n    return\n  }\n  print(String(data: data, encoding: .utf8)!)\n}\n\ntask.resume()\n",
        "customLabel": ""
      },
      {
        "id": "jI6uuYbOiVTb-lZUGje0E",
        "language": "csharp",
        "code": "var client = new HttpClient();\nvar request = new HttpRequestMessage(HttpMethod.Get, \"https://api-staging.fourkites.com/api-usage-metrics?startDate=16/06/25&apiPath=/shipments\");\nrequest.Headers.Add(\"apikey\", \"REPLACE_KEY_VALUE\");\nvar response = await client.SendAsync(request);\nresponse.EnsureSuccessStatusCode();\nConsole.WriteLine(await response.Content.ReadAsStringAsync());\n",
        "customLabel": ""
      },
      {
        "id": "-byM6_bRT-dKOYcgV03SQ",
        "language": "go",
        "code": "package main\n\nimport (\n  \"fmt\"\n  \"net/http\"\n  \"io/ioutil\"\n)\n\nfunc main() {\n\n  url := \"https://api-staging.fourkites.com/api-usage-metrics?startDate=16%2F06%2F25&apiPath=%2Fshipments\"\n  method := \"GET\"\n\n  client := &http.Client {\n  }\n  req, err := http.NewRequest(method, url, nil)\n\n  if err != nil {\n    fmt.Println(err)\n    return\n  }\n  req.Header.Add(\"apikey\", \"REPLACE_KEY_VALUE\")\n\n  res, err := client.Do(req)\n  if err != nil {\n    fmt.Println(err)\n    return\n  }\n  defer res.Body.Close()\n\n  body, err := ioutil.ReadAll(res.Body)\n  if err != nil {\n    fmt.Println(err)\n    return\n  }\n  fmt.Println(string(body))\n}",
        "customLabel": ""
      },
      {
        "id": "GUbipZgyriLCXw5DYWR0h",
        "language": "ruby",
        "code": "require \"uri\"\nrequire \"net/http\"\n\nurl = URI(\"https://api-staging.fourkites.com/api-usage-metrics?startDate=16/06/25&apiPath=/shipments\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"apikey\"] = \"REPLACE_KEY_VALUE\"\n\nresponse = https.request(request)\nputs response.read_body\n",
        "customLabel": ""
      },
      {
        "id": "Jz_3pwB_CyUXNY4JT2xpc",
        "language": "python",
        "code": "import http.client\n\nconn = http.client.HTTPSConnection(\"api-staging.fourkites.com\")\npayload = ''\nheaders = {\n  'apikey': 'REPLACE_KEY_VALUE'\n}\nconn.request(\"GET\", \"/api-usage-metrics?startDate=16/06/25&apiPath=/shipments\", payload, headers)\nres = conn.getresponse()\ndata = res.read()\nprint(data.decode(\"utf-8\"))",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "ng6eRKo47ZuOVMp85jLBj"
  },
  "results": {
    "languages": [
      {
        "id": "zuYrKA0Y8KQs631iIGFh8",
        "language": "200",
        "customLabel": "",
        "code": "{\n    \"total_requests\": 600,\n    \"daily_counts\": {\n        \"2025-06-23\": 1,\n        \"2025-06-25\": 37,\n        \"2025-06-26\": 21,\n        \"2025-06-30\": 2,\n        \"2025-07-01\": 11,\n        \"2025-07-02\": 1,\n        \"2025-07-07\": 259,\n        \"2025-07-08\": 197,\n        \"2025-07-09\": 19,\n        \"2025-07-13\": 27,\n        \"2025-07-14\": 25\n    }\n}"
      },
      {
        "id": "0hxE1mVCL70WcRQsqt0Rz",
        "language": "400",
        "customLabel": "",
        "code": "{\n    \"timestamp\": 1752569656524,\n    \"message\": \"The provided date must be within the last 30 days.\",\n    \"details\": \"uri=/api-usage-metrics\"\n}"
      }
    ],
    "selectedLanguageId": "zuYrKA0Y8KQs631iIGFh8"
  },
  "request": {
    "pathParameters": [],
    "queryParameters": [
      {
        "name": "startDate",
        "kind": "optional",
        "type": "string",
        "description": "The start date for the metrics query, in dd/mm/yy format. The date must be within the last 30 days.",
        "": "The start date for the metrics query, in dd/mm/yy format. The date must be within the last 30 days."
      },
      {
        "name": "apiPath",
        "kind": "optional",
        "type": "string",
        "description": "The specific API path to fetch metrics for (e.g., /shipments, /api/v1/tracking).",
        "": "The specific API path to fetch metrics for (e.g., /shipments, /api/v1/tracking)."
      }
    ],
    "headerParameters": [],
    "bodyDataParameters": [],
    "formDataParameters": []
  },
  "currentNewParameter": {
    "label": "Query Parameter",
    "value": "queryParameters"
  },
  "hasTryItOut": false,
  "autoGeneratedAnchorSlug": "staging",
  "legacyHash": "umpCWAciC4f9qmVLUiUF4"
}
```
:::

## Request Attribute

| **Parameter** | **Param Type** | **Format** | **Required** | **Default**                                          | **Description**                                                                                       |
| ------------- | -------------- | ---------- | ------------ | ---------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| `startDate`   | Query          | String     | No           | The default value is -30 days from the current date. | The start date for the metrics query, in `dd/mm/yy `format. The date must be within the last 30 days. |
| `apiPath`     | Query          | String     | No           | `/shipments`                                         | The specific API path to fetch metrics for (e.g., `/shipments, /api/v1/tracking`).                    |

## Response Attributes

The endpoint returns a JSON object containing the total request count and a map of daily counts.

| **Name**        | **Format** | **Default** | **Description**                                                                                                |
| --------------- | ---------- | ----------- | -------------------------------------------------------------------------------------------------------------- |
| `totalRequests` | Long       | NA          | The total number of API requests made within the specified date range and for the given apiPath.               |
| `dailyCounts`   | Map        | NA          | A map where each key is a date string (`YYYY-MM-DD`) and the value is the number of requests made on that day. |
