curl --request POST \
--url https://api.spidra.io/api/templates/{slug}/estimate \
--header 'Content-Type: application/json' \
--data '
{
"inputs": {
"query": "dentist",
"areas": [
"Lekki, Lagos"
]
}
}
'import requests
url = "https://api.spidra.io/api/templates/{slug}/estimate"
payload = { "inputs": {
"query": "dentist",
"areas": ["Lekki, Lagos"]
} }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({inputs: {query: 'dentist', areas: ['Lekki, Lagos']}})
};
fetch('https://api.spidra.io/api/templates/{slug}/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.spidra.io/api/templates/{slug}/estimate",
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([
'inputs' => [
'query' => 'dentist',
'areas' => [
'Lekki, Lagos'
]
]
]),
CURLOPT_HTTPHEADER => [
"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.spidra.io/api/templates/{slug}/estimate"
payload := strings.NewReader("{\n \"inputs\": {\n \"query\": \"dentist\",\n \"areas\": [\n \"Lekki, Lagos\"\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
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.spidra.io/api/templates/{slug}/estimate")
.header("Content-Type", "application/json")
.body("{\n \"inputs\": {\n \"query\": \"dentist\",\n \"areas\": [\n \"Lekki, Lagos\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.spidra.io/api/templates/{slug}/estimate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"inputs\": {\n \"query\": \"dentist\",\n \"areas\": [\n \"Lekki, Lagos\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"credits": 1,
"note": null,
"pages": 1
}Estimate a template run
Checks a template’s inputs the same way a run does and returns the credits a run should cost, without running it. It’s free and needs no API key, so it’s also a quick way to validate inputs.
note says what can add to the number, such as AI tokens or a second step that visits each website. credits is null when the cost can’t be known in advance, such as for a parse template, where it depends on the document’s pages.
curl --request POST \
--url https://api.spidra.io/api/templates/{slug}/estimate \
--header 'Content-Type: application/json' \
--data '
{
"inputs": {
"query": "dentist",
"areas": [
"Lekki, Lagos"
]
}
}
'import requests
url = "https://api.spidra.io/api/templates/{slug}/estimate"
payload = { "inputs": {
"query": "dentist",
"areas": ["Lekki, Lagos"]
} }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({inputs: {query: 'dentist', areas: ['Lekki, Lagos']}})
};
fetch('https://api.spidra.io/api/templates/{slug}/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.spidra.io/api/templates/{slug}/estimate",
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([
'inputs' => [
'query' => 'dentist',
'areas' => [
'Lekki, Lagos'
]
]
]),
CURLOPT_HTTPHEADER => [
"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.spidra.io/api/templates/{slug}/estimate"
payload := strings.NewReader("{\n \"inputs\": {\n \"query\": \"dentist\",\n \"areas\": [\n \"Lekki, Lagos\"\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
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.spidra.io/api/templates/{slug}/estimate")
.header("Content-Type", "application/json")
.body("{\n \"inputs\": {\n \"query\": \"dentist\",\n \"areas\": [\n \"Lekki, Lagos\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.spidra.io/api/templates/{slug}/estimate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"inputs\": {\n \"query\": \"dentist\",\n \"areas\": [\n \"Lekki, Lagos\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"credits": 1,
"note": null,
"pages": 1
}Path Parameters
The template's slug.
Body
The template's inputs by key, as listed by GET /templates/{slug}. You can also send the inputs at the top level of the body instead.
Response
The inputs are valid. This is what a run should cost.
success The credits a run should cost, or the most it can cost when note says "at most". null when it can't be known in advance.
What can add to credits, or null.
How many pages or searches the run would start with.
Was this page helpful?

