Skip to content

API Capabilities

The Matroid API allows you to build, test and deploy your computer vision detectors programmatically. Choose one of Matroid’s pre-made detectors, create a custom detector with your own examples, or import your own TensorFlow model into Matroid. Use your detector via the Matroid API to classify images, locate objects in videos, search existing collections of media, and monitor live video streams for objects and events of interest.

Quickstart with Matroid’s API Integration

CLASSIFY

CLASSIFY

MONITOR

UPLOAD

SEARCH

CLASSIFY

MONITOR

UPLOAD

SEARCH

CURL

JAVASCRIPT

PYTHON

 # Classify an image from a URL
 curl -X POST "https://app.matroid.com/api/v1/detectors/detector-id/classify_image" \
    -H Authorization:"Bearer your-token-here" \
    -d "url=https://app.matroid.com/images/logo.png"

 # Classify a local image
 curl -X POST "https://app.matroid.com/api/v1/detectors/detector-id/classify_image" \
    -H Authorization:"Bearer your-token-here" \
    -F "file=@/home/matroid/logo.png"
 const configs = { localizationConfidence: 0.50, numResults: 20 };

 // Classify an image from a URL
 const urlImage = { url: 'https://app.matroid.com/images/logo.png' };
 api.retrieveToken()
   .then(token => api.classifyImage('detector-id', urlImage, configs));

 // Classify a local image
 const localImage = { file: '/home/matroid/logo.png' };
 api.retrieveToken()
   .then((token) => api.classifyImage('detector-id', localImage, configs));
 # Classify an image from a URL
 api.classify_image(detectorId='detector-id', url='https://app.matroid.com/images/logo.png')

 # Classify a local image
 api.classify_image(detectorId='detector-id', file='/home/matroid/logo.png')

CURL

JAVASCRIPT

PYTHON

 # Monitor a live video stream with a detector
 curl -X POST "https://app.matroid.com/api/v1/streams/stream-id/monitor/detector-id" \
    -H Authorization:"Bearer your-token-here" \
    -d 'thresholds={ "cat": 0.5, "dog": 0.6 }'








 // Monitor a live video stream with a detector
 const configs = { thresholds: { cat: 0.5, dog: 0.6 } };
 api.retrieveToken()
   .then((token) => api.monitorStream('stream-id', 'detector-id', configs));
 # Monitor a live video stream with a detector
 api.monitor_stream(
    streamId='stream-id',
    detectorId='detector-id',
    thresholds={ 'cat': 0.5, 'dog': 0.6 })

CURL

JAVASCRIPT

PYTHON

 # Create a detector from COCO format dataset
 curl -X POST "https://app.matroid.com/api/v1/detectors" \
    -H Authorization:"Bearer your-token-here" \
    -F "file=@/home/matroid/catdog.zip" \
    -F "name=cat-dog" \
    -F "detector_type=general" \
    -F "labelsJSON=@/home/matroid/labels.json"
 // Create detector from a COCO format dataset
 api.retrieveToken()
   .then((token) => 
     api.createDetector(
       '/home/matroid/catdog.zip', 
       'cat-dog', 
       'general', 
       '/home/matroid/labels.json'
     )
   );
 # Create a detector from a COCO format dataset
 api.create_detector(
   file='/home/matroid/catdog.zip', 
   name='cat-dog',
   detectorType='general',
   labelsJSON='/home/matroid/labels.json')

CURL

JAVASCRIPT

PYTHON

 # Search for similar images in an S3 bucket
 curl -X POST "https://app.matroid.com/api/v1/collection-tasks/task-id/image-query" \
    -H Authorization:"Bearer your-token-here" \
    -d "url=url-for-your-image" \
    -d 'boundingBox={ "top": 0.1, "left": 0.1, "height": 0.8, "width": 0.8 }' \
    -d "numResults=5" \
    -d "shouldIndicateDuplicates=true"
 // Search for similar images in an S3 bucket
 const configs = {
   boundingBox: { top: 0.8, left: 0.8, height: 0.1, width: 0.1 },
   shouldIndicateDuplicates: true
   numResults: 5,
 };

 api.retrieveToken()
   .then((token) => 
     api.queryCollectionByImage(
       'task-id', 
       { url: 'https://image.jpg' }, 
       configs
     )
   );
 # Search for similar images in an S3 bucket
 api.query_collection_by_image(taskId='task-id',
    url='https://image.jpg',
    boundingBox={ 'top': 0.8, 'left': 0.8, 'height': 0.1, 'width': 0.1 },
    numResults=5,
    shouldIndicateDuplicates=True)

Capabilities

API Support

Matroid API is able to classify images, locate objects in videos, search existing collections of media, and perform real-time detections in live video streams.

A Detector is a trained computer vision model that is compatible with the Matroid platform. Matroid detectors are the center of the Matroid Universe: they can be used to search through images, videos, and streams to find objects or people of interest. Detectors can be created, trained, deleted, and retrained. Detectors can be imported into Matroid from existing models or exported to other Matroid users from the API.

Request A Demo Today

Let us show you how the power of computer vision can transform your organization