Embedbase
The hosted Embedbase API requires you to create an API key (opens in a new tab).
This is the REST API documentation for Embedbase.
Note: You can also use our JavaScript/Python client.
Getting Started
There's two main operations you can do with Embedbase: search and insert.
Retrieving Data
You can search unstructured data with Embedbase.
const URL = 'https://api.embedbase.xyz'
const DATASET_ID = 'people'
const API_KEY = '<https://app.embedbase.xyz/signup>'
fetch(`${URL}/v1/${DATASET_ID}/search`, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    Authorization: 'Bearer ' + API_KEY
  },
  body: JSON.stringify({
    query: 'Something about a red planet'
  })
})Using Bing Search
const response = await fetch('https://api.embedbase.xyz/v1/internet-search', {
    method: 'POST',
    body: JSON.stringify({
        query: question,
        engine: 'bing'
    }),
    headers: {
        'Content-Type': 'application/json'
    }
})
const responseJson = await response.json()
// interesting data is here:
const results = responseJson.webPages.valueInserting Data
You can insert unstructured data into Embedbase to be indexed and searched.
const URL = 'https://api.embedbase.xyz'
const DATASET_ID = 'people'
const API_KEY = '<https://app.embedbase.xyz/signup>'
fetch(`${URL}/v1/${DATASET_ID}`, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    Authorization: 'Bearer ' + API_KEY
  },
  body: JSON.stringify({
    documents: [
      {
        data: 'Elon is sipping a tea on Mars',
        // you can also add metadata
        metadata: {
          path: "https://spacex.com/mars",
          title: "Elon Musk"
        }
      }
    ]
  })
})Updating Data
You can update your data like this:
const URL = 'https://api.embedbase.xyz'
const DATASET_ID = 'people'
const API_KEY = '<https://app.embedbase.xyz/signup>'
fetch(`${URL}/v1/${DATASET_ID}`, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    Authorization: 'Bearer ' + API_KEY
  },
  body: JSON.stringify({
    documents: [
      {
        id: '<some id>',
        data: 'Elon is sipping a tea on Neptune'
      }
    ]
  })
})Delete data
You can delete documents from a dataset like this:
const URL = 'https://api.embedbase.xyz'
const DATASET_ID = 'people'
const API_KEY = '<https://app.embedbase.xyz/signup>'
fetch(`${URL}/v1/${DATASET_ID}`, {
  method: 'DELETE',
  headers: {
    'Content-Type': 'application/json',
    Authorization: 'Bearer ' + API_KEY
  },
  body: JSON.stringify({
    ids: ["<some id>",]
  })
})Delete dataset
You can delete a dataset like this:
const URL = 'https://api.embedbase.xyz'
const DATASET_ID = 'people'
const API_KEY = '<https://app.embedbase.xyz/signup>'
fetch(`${URL}/v1/${DATASET_ID}/clear`, {
  headers: {
    'Content-Type': 'application/json',
    Authorization: 'Bearer ' + API_KEY
  },
})