Skip to main content
GET
/
states
/
search
Search States
curl --request GET \
  --url https://api.shovels.ai/v2/states/search \
  --header 'X-API-Key: <api-key>'
import requests

url = "https://api.shovels.ai/v2/states/search"

headers = {"X-API-Key": "<api-key>"}

response = requests.get(url, headers=headers)

print(response.text)
HttpResponse<String> response = Unirest.get("https://api.shovels.ai/v2/states/search")
.header("X-API-Key", "<api-key>")
.asString();
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://api.shovels.ai/v2/states/search"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("X-API-Key", "<api-key>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
require 'uri'
require 'net/http'

url = URI("https://api.shovels.ai/v2/states/search")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'

response = http.request(request)
puts response.read_body
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.shovels.ai/v2/states/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
{
  "items": [
    {
      "geo_id": "CA",
      "name": "CALIFORNIA"
    },
    {
      "geo_id": "TX",
      "name": "TEXAS"
    },
    {
      "geo_id": "MT",
      "name": "MONTANA"
    }
  ],
  "size": 3
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}

Authorizations

X-API-Key
string
header
required

Query Parameters

q
string
required

The name to search for in the state fields.

cursor
string | null

Cursor for pagination

size
integer
default:50
Required range: 1 <= x <= 100

Response

A list of states that match the search term.

Paginated response for states.

items
States · object[]
required

The list of items returned in the response following given criteria.

size
integer
required

The number of items returned in the response.

next_cursor
string | null
required

The cursor for retrieving the next page of results.

total_count
TotalCount · object | null

Total result count (capped at 10,000). Present on first-page responses when include_count=true. null if the count query timed out.