Skip to main content
POST
/
brain
/
search
cURL
curl 'https://api.gumloop.com/api/v1/brain/search' \
  -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "query": "what is our refund policy?",
    "limit": 8,
    "source_type": ["notion", "google_drive"]
  }'
from gumloop import Gumloop

client = Gumloop(access_token="YOUR_ACCESS_TOKEN")

response = client.brain.search(
"what is our refund policy?",
limit=8,
source_type=["notion", "google_drive"],
)
for result in response.results:
print(result.score, result.source, result.title, result.url)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
query: 'what is our refund policy?',
limit: 8,
source_type: ['notion', 'google_drive']
})
};

fetch('https://api.gumloop.com/api/v1/brain/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gumloop.com/api/v1/brain/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'query' => 'what is our refund policy?',
'limit' => 8,
'source_type' => [
'notion',
'google_drive'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

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

func main() {

url := "https://api.gumloop.com/api/v1/brain/search"

payload := strings.NewReader("{\n \"query\": \"what is our refund policy?\",\n \"limit\": 8,\n \"source_type\": [\n \"notion\",\n \"google_drive\"\n ]\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

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

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

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.gumloop.com/api/v1/brain/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"what is our refund policy?\",\n \"limit\": 8,\n \"source_type\": [\n \"notion\",\n \"google_drive\"\n ]\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.gumloop.com/api/v1/brain/search")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"what is our refund policy?\",\n \"limit\": 8,\n \"source_type\": [\n \"notion\",\n \"google_drive\"\n ]\n}"

response = http.request(request)
puts response.read_body
{
  "results": [
    {
      "document_id": "notion:2f1a9c7e",
      "source": "notion",
      "title": "Refund Policy",
      "content": "Customers may request a full refund within 30 days of purchase...",
      "url": "https://www.notion.so/Refund-Policy-2f1a9c7e",
      "score": 0.87,
      "updated_at": "2024-01-15T10:30:00Z",
      "owner_name": "Jordan Lee",
      "owner_email": "jordan@example.com",
      "parent_title": "Policies",
      "metadata": {}
    }
  ]
}

Authorizations

Authorization
string
header
required

A personal API key or an OAuth 2.0 access token. Personal API keys also require the x-auth-key header with your user ID.

Body

application/json
query
string
required

The natural-language search query.

Example:

"what is our refund policy?"

limit
integer
default:8

Maximum number of results to return.

Required range: 1 <= x <= 50
Example:

8

source_type
enum<string>[] | null

Restrict results to specific source types. Omit to search every source you can access. Valid values: notion, google_drive, slack, github, confluence, direct_file_uploads, gumloop_artifacts.

Minimum array length: 1
Available options:
notion,
google_drive,
slack,
github,
confluence,
direct_file_uploads,
gumloop_artifacts
Example:
["notion", "google_drive"]

Response

Ranked search results.

results
object[]
required

Ranked matches, most relevant first.