> This page is for version 3.3.0 (default).
> For other versions, use one of these documentation indexes:
> - 3.3.0 (default): https://docs.nvidia.com/vss/3.3.0/llms.txt
> - Dev: https://docs.nvidia.com/vss/dev/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/vss/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/vss/_mcp/server.

# Get tripwire counts

GET https://ai.nvidia.com/api/v3.3/analytics/metrics/tripwire/counts

Get effective and actual tripwire crossing counts for a sensor over a time range, optionally filtered by tripwire and object type.

Reference: https://docs.nvidia.com/vss/system-components/middleware/api-gateway-mcp/video-analytics-api/video-analytics-api-reference/metrics/controller-metrics-get-tripwire-counts

## Request

### Query parameters

- `fromTimestamp` (datetime, required)
- `toTimestamp` (datetime, required)
- `sensorId` (string, required)
- `tripwireId` (string, optional)
- `objectType` (string, optional, default: Person)

## Response

### 200

Successful Operation.

- `tripwireMetrics` (list of TripwireCountsTripwireMetricsItems, required)
- `aggregatedMetrics` (TripwireCountsAggregatedMetrics, required)

## Errors

### 400 Bad Request Error

Bad Request. This response will be sent if any of the required params are not present or if extra params are passed.

- `error` (string, required)

### 404 Not Found Error

Resource Not Found

- `error` (string, required)

### 422 Unprocessable Entity Error

Unprocessable Entity

- `error` (string, required)

### 500 Internal Server Error

Internal Server Error

- `error` (string, required)

## Types

### TripwireCountsTripwireMetricsItems

- `id` (string, required)
- `events` (list of TripwireCountsTripwireMetricsItemsEventsItems, required)

### TripwireCountsAggregatedMetrics

- `events` (list of TripwireCountsAggregatedMetricsEventsItems, required)

### TripwireCountsTripwireMetricsItemsEventsItems

- `type` (string, required)
- `count` (long, required) — Effective counts are used to count only the effective event generated by an object. An effective tripwire event can be defined with the following example: Suppose an object generates tripwire events in the following sequence: IN, OUT and IN again, then the effective count in this case considers only the final IN event. This is helpful to handle loitering behavior of an object.
- `actualCount` (long, required) — Actual tripwire count is the count of all the events that have occurred.
- `objectType` (string, required)

### TripwireCountsAggregatedMetricsEventsItems

- `type` (string, required)
- `count` (long, required) — Effective counts are used to count only the effective event generated by an object. An effective tripwire event can be defined with the following example: Suppose an object generates tripwire events in the following sequence: IN, OUT and IN again, then the effective count in this case considers only the final IN event. This is helpful to handle loitering behavior of an object.
- `actualCount` (long, required) — Actual tripwire count is the count of all the events that have occurred.
- `objectType` (string, required)

## Examples

**Response**

```json
{
  "tripwireMetrics": [
    {
      "id": "tripwire-id-1",
      "events": [
        {
          "type": "IN",
          "count": 0,
          "actualCount": 18,
          "objectType": "Forklift"
        },
        {
          "type": "OUT",
          "count": 0,
          "actualCount": 18,
          "objectType": "Forklift"
        },
        {
          "type": "IN",
          "count": 18,
          "actualCount": 18,
          "objectType": "Person"
        },
        {
          "type": "OUT",
          "count": 18,
          "actualCount": 18,
          "objectType": "Person"
        }
      ]
    }
  ],
  "aggregatedMetrics": {
    "events": [
      {
        "type": "IN",
        "count": 0,
        "actualCount": 18,
        "objectType": "Forklift"
      },
      {
        "type": "OUT",
        "count": 0,
        "actualCount": 18,
        "objectType": "Forklift"
      },
      {
        "type": "IN",
        "count": 18,
        "actualCount": 18,
        "objectType": "Person"
      },
      {
        "type": "OUT",
        "count": 18,
        "actualCount": 18,
        "objectType": "Person"
      }
    ]
  }
}
```

**SDK Code**

```python
import requests

url = "https://ai.nvidia.com/api/v3.3/analytics/metrics/tripwire/counts"

querystring = {"fromTimestamp":"2022-08-25T00:00:00.000Z","sensorId":"sensorId","toTimestamp":"2022-08-25T00:00:10.000Z"}

response = requests.get(url, params=querystring)

print(response.json())
```

```javascript
const url = 'https://ai.nvidia.com/api/v3.3/analytics/metrics/tripwire/counts?fromTimestamp=2022-08-25T00%3A00%3A00.000Z&sensorId=sensorId&toTimestamp=2022-08-25T00%3A00%3A10.000Z';
const options = {method: 'GET'};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://ai.nvidia.com/api/v3.3/analytics/metrics/tripwire/counts?fromTimestamp=2022-08-25T00%3A00%3A00.000Z&sensorId=sensorId&toTimestamp=2022-08-25T00%3A00%3A10.000Z"

	req, _ := http.NewRequest("GET", url, nil)

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://ai.nvidia.com/api/v3.3/analytics/metrics/tripwire/counts?fromTimestamp=2022-08-25T00%3A00%3A00.000Z&sensorId=sensorId&toTimestamp=2022-08-25T00%3A00%3A10.000Z")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://ai.nvidia.com/api/v3.3/analytics/metrics/tripwire/counts?fromTimestamp=2022-08-25T00%3A00%3A00.000Z&sensorId=sensorId&toTimestamp=2022-08-25T00%3A00%3A10.000Z")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://ai.nvidia.com/api/v3.3/analytics/metrics/tripwire/counts?fromTimestamp=2022-08-25T00%3A00%3A00.000Z&sensorId=sensorId&toTimestamp=2022-08-25T00%3A00%3A10.000Z');

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://ai.nvidia.com/api/v3.3/analytics/metrics/tripwire/counts?fromTimestamp=2022-08-25T00%3A00%3A00.000Z&sensorId=sensorId&toTimestamp=2022-08-25T00%3A00%3A10.000Z");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "https://ai.nvidia.com/api/v3.3/analytics/metrics/tripwire/counts?fromTimestamp=2022-08-25T00%3A00%3A00.000Z&sensorId=sensorId&toTimestamp=2022-08-25T00%3A00%3A10.000Z")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```