Getting Started

We’ll be using the requests library.

import os
import requests

api_key = "YOUR_API_KEY"

headers = {
  'Authorization': f'Bearer {api_key}',
  'Content-Type': 'application/json'
}

Indexing Content

You can index various types of content including images, videos, and text:

Image Indexing

# Index an image from URL
import requests
import json

url = "https://api.mixpeek.com/v1/ingest/images/url"

payload = json.dumps({
  "url": "https://mixpeek-public-demo.s3.us-east-2.amazonaws.com/starter/aussie_jumping.jpg",
  "collection": "test",
  "feature_extractors": {
    "embed": [
      {
        "embedding_model": "multimodal",
        "type": "url"
      }
    ]
  }
})
response = requests.request("POST", url, headers=headers, data=payload)

Ingest Image API

Video Indexing

# Index a video from URL
url = "https://api.mixpeek.com/v1/ingest/videos/url"

payload = json.dumps({
  "url": "https://mixpeek-public-demo.s3.us-east-2.amazonaws.com/starter/jurassic_bunny.mp4",
  "collection": "test",
  "feature_extractors": [
    {
      "interval_sec": 30,
      "transcribe": {
        "enabled": True,
        "embedding_model": "text"
      },
      "embed": [
        {
          "type": "url",
          "embedding_model": "multimodal"
        }
      ]
    }
  ]
})

response = requests.request("POST", url, headers=headers, data=payload)

Ingest Video API

Text Indexing

url = "https://api.mixpeek.com/v1/ingest/text"

payload = json.dumps({
  "collection": "test",
  "feature_extractors": {
    "embed": [
      {
        "type": "text",
        "value": "Lorem ipsum ... ",
        "embedding_model": "text"
      }
    ]
  }
})

response = requests.request("POST", url, headers=headers, data=payload)

Ingest Text API

Searching Content

Now you can perform both text and vector searches across your collections:

url = "https://api.mixpeek.com/v1/features/search"

payload = json.dumps({
  "collections": [
    "test"
  ],
  "queries": [
    {
      "embedding_model": "multimodal",
      "value": "dog outside",
      "type": "text"
    }
  ]
})

response = requests.request("POST", url, headers=headers, data=payload)

Feature Search

Next Steps