Estimate a Template Run
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": 123,
"note": "<string>",
"pages": 123
}{
"status": "error",
"message": "<string>"
}{
"status": "error",
"code": "INVALID_INPUT",
"message": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>"
}
]
}Templates
Estimate a Template Run
Check inputs and see what a template run will cost, without running it.
POST
/
templates
/
{slug}
/
estimate
Estimate a Template Run
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": 123,
"note": "<string>",
"pages": 123
}{
"status": "error",
"message": "<string>"
}{
"status": "error",
"code": "INVALID_INPUT",
"message": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>"
}
]
}Checks the inputs the same way a run does and returns the credits a run should cost. It’s free and needs no API key, so it’s also a quick way to validate inputs.
curl -X POST https://api.spidra.io/api/templates/google-maps-leads/estimate \
-H "Content-Type: application/json" \
-d '{ "inputs": { "query": "dentist", "areas": ["Lekki, Lagos"] } }'
{ "status": "success", "credits": 1, "note": null, "pages": 1 }
note explains 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.
Inputs that need fixing return 422:
{
"status": "error",
"code": "INVALID_INPUT",
"message": "Some inputs need fixing.",
"errors": [
{ "field": "query", "message": "Business type is required." },
{ "field": "areas", "message": "Areas is required." }
]
}
Path Parameters
The template's slug.
Body
application/json
The template's inputs, by key.
Was this page helpful?

