Account and usage
Which workspace a key reaches, and how much allowance is left.
Two endpoints for the account behind the key: who you are, and how much of the allowance is left.
GET /me
Which workspace this key reaches
The key, its workspace, and what the plan allows. Takes no parameters and changes nothing, which makes it the right endpoint for a health check.
Request
curl "https://webrankpage.com/api/v1/me" \
-H "Authorization: Bearer wrp_live_8fKp2mQx9tR4vN7c"<?php
$ch = curl_init('https://webrankpage.com/api/v1/me');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer wrp_live_8fKp2mQx9tR4vN7c',
],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($response);// Node 18+, or any server-side runtime. Never in browser code:
// an API key in a page is readable by anyone who opens it.
const response = await fetch('https://webrankpage.com/api/v1/me', {
headers: {
Authorization: `Bearer ${process.env.WEBRANKPAGE_KEY}`,
},
});
const data = await response.json();
console.log(data);import requests
response = requests.get(
'https://webrankpage.com/api/v1/me',
headers={'Authorization': 'Bearer wrp_live_8fKp2mQx9tR4vN7c'},
)
print(response.json())require 'net/http'
require 'json'
uri = URI('https://webrankpage.com/api/v1/me')
request = Net::HTTP::Get.new(uri)
request['Authorization'] = 'Bearer wrp_live_8fKp2mQx9tR4vN7c'
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
puts JSON.parse(response.body)package main
import (
"encoding/json"
"fmt"
"net/http"
)
func main() {
req, _ := http.NewRequest("GET", "https://webrankpage.com/api/v1/me", nil)
req.Header.Set("Authorization", "Bearer wrp_live_8fKp2mQx9tR4vN7c")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
var data map[string]interface{}
json.NewDecoder(res.Body).Decode(&data)
fmt.Println(data)
}Response
{
"key": {
"name": "docs-temp",
"prefix": "wrp_7Hzu7VRo"
},
"workspace": {
"id": 172,
"slug": "your-pages",
"name": "Your pages"
},
"plan": {
"name": "Agency",
"site_crawl": true,
"uptime": true
}
}GET /usage
What is left this month
Reports and API calls used, the limit, and what remains. Worth checking before a bulk run rather than discovering the ceiling halfway through one.
Request
curl "https://webrankpage.com/api/v1/usage" \
-H "Authorization: Bearer wrp_live_8fKp2mQx9tR4vN7c"<?php
$ch = curl_init('https://webrankpage.com/api/v1/usage');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer wrp_live_8fKp2mQx9tR4vN7c',
],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($response);// Node 18+, or any server-side runtime. Never in browser code:
// an API key in a page is readable by anyone who opens it.
const response = await fetch('https://webrankpage.com/api/v1/usage', {
headers: {
Authorization: `Bearer ${process.env.WEBRANKPAGE_KEY}`,
},
});
const data = await response.json();
console.log(data);import requests
response = requests.get(
'https://webrankpage.com/api/v1/usage',
headers={'Authorization': 'Bearer wrp_live_8fKp2mQx9tR4vN7c'},
)
print(response.json())require 'net/http'
require 'json'
uri = URI('https://webrankpage.com/api/v1/usage')
request = Net::HTTP::Get.new(uri)
request['Authorization'] = 'Bearer wrp_live_8fKp2mQx9tR4vN7c'
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
puts JSON.parse(response.body)package main
import (
"encoding/json"
"fmt"
"net/http"
)
func main() {
req, _ := http.NewRequest("GET", "https://webrankpage.com/api/v1/usage", nil)
req.Header.Set("Authorization", "Bearer wrp_live_8fKp2mQx9tR4vN7c")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
var data map[string]interface{}
json.NewDecoder(res.Body).Decode(&data)
fmt.Println(data)
}Response
{
"usage": {
"plan": "Agency",
"reports": {
"used": 3,
"limit": 6000,
"remaining": 5997,
"period": "this month"
},
"api_calls": {
"used": 21,
"limit": 4000,
"remaining": 3979,
"period": "this month"
}
}
}This call counts against your API allowance like any other, so polling it every few seconds spends the thing you are measuring.