Get API key and account usage details
curl --request GET \
--url https://api.tavily.com/usage \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.tavily.com/usage"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.tavily.com/usage', 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.tavily.com/usage",
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.tavily.com/usage"
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.tavily.com/usage")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tavily.com/usage")
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{
"key": {
"usage": 150,
"limit": 1000,
"search_usage": 100,
"extract_usage": 25,
"crawl_usage": 15,
"map_usage": 7,
"research_usage": 3
},
"account": {
"current_plan": "Bootstrap",
"plan_usage": 500,
"plan_limit": 15000,
"paygo_usage": 25,
"paygo_limit": 100,
"search_usage": 350,
"extract_usage": 75,
"crawl_usage": 50,
"map_usage": 15,
"research_usage": 10
}
}{
"detail": {
"error": "Unauthorized: missing or invalid API key."
}
}{
"detail": {
"error": "Your request has been blocked due to excessive requests. Please reduce the rate of requests"
}
}Account
Usage
Get API key and account usage details
GET
/
usage
Get API key and account usage details
curl --request GET \
--url https://api.tavily.com/usage \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.tavily.com/usage"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.tavily.com/usage', 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.tavily.com/usage",
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.tavily.com/usage"
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.tavily.com/usage")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tavily.com/usage")
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{
"key": {
"usage": 150,
"limit": 1000,
"search_usage": 100,
"extract_usage": 25,
"crawl_usage": 15,
"map_usage": 7,
"research_usage": 3
},
"account": {
"current_plan": "Bootstrap",
"plan_usage": 500,
"plan_limit": 15000,
"paygo_usage": 25,
"paygo_limit": 100,
"search_usage": 350,
"extract_usage": 75,
"crawl_usage": 50,
"map_usage": 15,
"research_usage": 10
}
}{
"detail": {
"error": "Unauthorized: missing or invalid API key."
}
}{
"detail": {
"error": "Your request has been blocked due to excessive requests. Please reduce the rate of requests"
}
}Authorizations
Bearer authentication header in the form Bearer , where is your Tavily API key (e.g., Bearer tvly-YOUR_API_KEY).
Headers
Optional project ID to scope the usage query to a specific project
⌘I