Resources
Credits
Check the remaining credit balance and usage for your account.
GET
/
api
/
agent
/
credits
Credits
curl --request GET \
--url https://encrata.com/api/agent/credits \
--header 'Authorization: Bearer <token>'import requests
url = "https://encrata.com/api/agent/credits"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://encrata.com/api/agent/credits', 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://encrata.com/api/agent/credits",
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://encrata.com/api/agent/credits"
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://encrata.com/api/agent/credits")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://encrata.com/api/agent/credits")
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{
"credits_remaining": 4794,
"credits_used": 206,
"total_lookups": 206
}
{ "error": "invalid API key" }
Authentication
Requires an API key in theAuthorization header.
Authorization: Bearer YOUR_API_KEY
Request
No parameters required. The balance is scoped to the API key’s active workspace when one is selected, otherwise to the key owner’s account.curl https://encrata.com/api/agent/credits \
-H "Authorization: Bearer YOUR_API_KEY"
Response
number
Credits currently available to spend.
number
Total credits consumed to date.
number
Total number of lookups performed to date.
Errors
Errors return a JSON body of the form{"error": "<message>"} with the matching
HTTP status code.
| Status | Message | Cause |
|---|---|---|
401 | unauthorized / invalid API key | Missing or invalid API key |
405 | Only GET method is allowed | Wrong HTTP method |
{
"credits_remaining": 4794,
"credits_used": 206,
"total_lookups": 206
}
{ "error": "invalid API key" }
Was this page helpful?
⌘I
Credits
curl --request GET \
--url https://encrata.com/api/agent/credits \
--header 'Authorization: Bearer <token>'import requests
url = "https://encrata.com/api/agent/credits"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://encrata.com/api/agent/credits', 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://encrata.com/api/agent/credits",
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://encrata.com/api/agent/credits"
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://encrata.com/api/agent/credits")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://encrata.com/api/agent/credits")
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{
"credits_remaining": 4794,
"credits_used": 206,
"total_lookups": 206
}
{ "error": "invalid API key" }