cURL
curl 'https://api.gumloop.com/api/v1/brain/sources/jVustMhHWG43CFQBFMckcn/estimate' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN'from gumloop import Gumloop
client = Gumloop(access_token="YOUR_ACCESS_TOKEN")
estimate = client.brain.get_estimate("jVustMhHWG43CFQBFMckcn").estimate
print(estimate and estimate.estimated_credits)
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.gumloop.com/api/v1/brain/sources/{source_id}/estimate', 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/sources/{source_id}/estimate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.gumloop.com/api/v1/brain/sources/{source_id}/estimate"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.gumloop.com/api/v1/brain/sources/{source_id}/estimate")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gumloop.com/api/v1/brain/sources/{source_id}/estimate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"source_id": "jVustMhHWG43CFQBFMckcn",
"status": "draft",
"estimate": {
"sync_run_id": "EEGmBWjtbRzJdixVeSsetY",
"status": "paused_for_approval",
"estimated_tokens": 75,
"estimated_credits": 5,
"document_count": 2
}
}Retrieve estimate
The latest credit estimate for a source created with require_approval. estimate is null until the first upload has produced a run; poll until estimate.status is paused_for_approval, then call Approve source. estimated_credits is rounded up to the nearest 5 and is an estimate, not a quote.
GET
/
brain
/
sources
/
{source_id}
/
estimate
cURL
curl 'https://api.gumloop.com/api/v1/brain/sources/jVustMhHWG43CFQBFMckcn/estimate' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN'from gumloop import Gumloop
client = Gumloop(access_token="YOUR_ACCESS_TOKEN")
estimate = client.brain.get_estimate("jVustMhHWG43CFQBFMckcn").estimate
print(estimate and estimate.estimated_credits)
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.gumloop.com/api/v1/brain/sources/{source_id}/estimate', 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/sources/{source_id}/estimate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.gumloop.com/api/v1/brain/sources/{source_id}/estimate"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.gumloop.com/api/v1/brain/sources/{source_id}/estimate")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gumloop.com/api/v1/brain/sources/{source_id}/estimate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"source_id": "jVustMhHWG43CFQBFMckcn",
"status": "draft",
"estimate": {
"sync_run_id": "EEGmBWjtbRzJdixVeSsetY",
"status": "paused_for_approval",
"estimated_tokens": 75,
"estimated_credits": 5,
"document_count": 2
}
}Authorizations
Path Parameters
The source id.
Was this page helpful?
