Skip to content

Getting Started

This tutorial walks you through sending your first video to the Gaard Vision API and retrieving the classification result. By the end, you will have a working API call you can adapt for your integration.

  • A Gaard account with API access
  • curl installed on your machine
  • A video file to classify (MP4 or MOV)
  1. Create an API token in the Gaard app at Settings > Platform > Integrations.

    Once you have the token, export it as an environment variable so the commands in this tutorial can reference it:

    terminal
    export API_KEY="your-api-token"
  2. If you do not have a video file ready, download our sample clip or grab one from the VIRAT dataset.

    Save the video file to your working directory. The examples below assume the file is named video.mp4.

  3. The classification endpoint accepts a multipart/form-data POST request. You upload the video file as a form field using -F, not as a JSON payload.

By default, classification runs asynchronously. The API accepts the video and returns an ID you use to poll for the result.

terminal
curl -X POST https://vision.gaard.ai/api/classify \
-H "Authorization: Bearer $API_KEY" \
-F "video=@video.mp4"

The response contains the classification ID and a timestamp:

{
"id": "66436fc66d24ab9cf81140eb",
"accepted_at": "2024-05-14T16:05:58.444Z"
}

Use the id value to retrieve the result:

terminal
curl https://vision.gaard.ai/api/result/66436fc66d24ab9cf81140eb \
-H "Authorization: Bearer $API_KEY"

If the classification is still processing, poll this endpoint again after a few seconds until the result is available.

If you prefer to wait for the result in a single request, add ?sync=true. The API blocks until classification is complete and returns the full result directly.

terminal
curl -X POST "https://vision.gaard.ai/api/classify?sync=true" \
-H "Authorization: Bearer $API_KEY" \
-F "video=@video.mp4"

With metadata, Gaard:

  • links each result to a site and a camera, and creates them on first sight;
  • applies that camera’s settings, such as exclusion zones;
  • lets your team review, filter and report results by site and camera.

Give each site and camera a stable, unique match id and a readable name. Create a file named metadata.json:

{
"site": {
"site_match_id": "acme-paris-warehouse",
"name": "Paris warehouse"
},
"camera": {
"camera_match_id": "acme-paris-warehouse/dock-north",
"name": "Dock north"
}
}

Use the same match ids for the same camera on every request. If an id changes, Gaard creates a new site or camera, and the history of the old one is not moved.

Then include it in the request as a second form field:

terminal
curl -X POST https://vision.gaard.ai/api/classify \
-H "Authorization: Bearer $API_KEY" \
-F "video=@video.mp4" \
-F "metadata=@metadata.json"

Now that you have successfully classified a video, make sure your integration sends metadata with every request, then explore the rest of the API:

  • Endpoints: full endpoint reference for classify, result, annotate, and delete
  • Response structure: understand the fields in a classification response
  • Classification result: result types, statuses, and detailed examples
  • Metadata: all fields, how match ids link videos to sites and cameras, and how to move from site_id/camera_id
  • Webhooks: receive async results via webhook instead of polling