curl --request POST \
--url https://api.baselayer.com/autocomplete/sessions \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"scope": {
"routes": "<unknown>",
"max_limit": 5
}
}
'import requests
url = "https://api.baselayer.com/autocomplete/sessions"
payload = { "scope": {
"routes": "<unknown>",
"max_limit": 5
} }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({scope: {routes: '<unknown>', max_limit: 5}})
};
fetch('https://api.baselayer.com/autocomplete/sessions', 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.baselayer.com/autocomplete/sessions",
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([
'scope' => [
'routes' => '<unknown>',
'max_limit' => 5
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.baselayer.com/autocomplete/sessions"
payload := strings.NewReader("{\n \"scope\": {\n \"routes\": \"<unknown>\",\n \"max_limit\": 5\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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.baselayer.com/autocomplete/sessions")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"scope\": {\n \"routes\": \"<unknown>\",\n \"max_limit\": 5\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.baselayer.com/autocomplete/sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"scope\": {\n \"routes\": \"<unknown>\",\n \"max_limit\": 5\n }\n}"
response = http.request(request)
puts response.read_body{
"session_token": "eyJhbGciOiJFZERTQSIsInR5cCI6ImFjczEiLCJraWQiOiJ…",
"expires_in": 120,
"expires_at": "2026-09-23T12:03:00Z",
"request_budget": 10,
"pivot_allowance": 5,
"filter_min_stem": 5,
"scope": {
"routes": {
"businesses": [
"addresses",
"people"
]
},
"max_limit": 20
},
"sessions_per_window": 123,
"sessions_per_day": 123,
"user_sessions_per_window": 123,
"user_sessions_per_day": 123,
"min_query_chars": 2,
"filter_rules": {}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Mint an autocomplete session
Mints the grant every request to the autocomplete service carries in X-Autocomplete-Session. Minting writes one Order; the keystrokes it admits write nothing. An organization mints without limit unless one is set for it, sessions_per_window per ten minutes and sessions_per_day per rolling day (each null when there is none), one pool drawn from by every caller in it; past either the mint answers 429. The grant is bound to the Origin it was minted with, expires after expires_in seconds (refresh at about 80% of it; expires_at is the same instant as a UTC timestamp, for display) and admits request_budget requests per route. A sandbox application’s grant is served the sandbox’s own index, and its mint writes no Order and counts against neither limit. A caller whose autocomplete.enabled override is off is answered 403; a locked organization is answered 402.
curl --request POST \
--url https://api.baselayer.com/autocomplete/sessions \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"scope": {
"routes": "<unknown>",
"max_limit": 5
}
}
'import requests
url = "https://api.baselayer.com/autocomplete/sessions"
payload = { "scope": {
"routes": "<unknown>",
"max_limit": 5
} }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({scope: {routes: '<unknown>', max_limit: 5}})
};
fetch('https://api.baselayer.com/autocomplete/sessions', 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.baselayer.com/autocomplete/sessions",
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([
'scope' => [
'routes' => '<unknown>',
'max_limit' => 5
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.baselayer.com/autocomplete/sessions"
payload := strings.NewReader("{\n \"scope\": {\n \"routes\": \"<unknown>\",\n \"max_limit\": 5\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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.baselayer.com/autocomplete/sessions")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"scope\": {\n \"routes\": \"<unknown>\",\n \"max_limit\": 5\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.baselayer.com/autocomplete/sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"scope\": {\n \"routes\": \"<unknown>\",\n \"max_limit\": 5\n }\n}"
response = http.request(request)
puts response.read_body{
"session_token": "eyJhbGciOiJFZERTQSIsInR5cCI6ImFjczEiLCJraWQiOiJ…",
"expires_in": 120,
"expires_at": "2026-09-23T12:03:00Z",
"request_budget": 10,
"pivot_allowance": 5,
"filter_min_stem": 5,
"scope": {
"routes": {
"businesses": [
"addresses",
"people"
]
},
"max_limit": 20
},
"sessions_per_window": 123,
"sessions_per_day": 123,
"user_sessions_per_window": 123,
"user_sessions_per_day": 123,
"min_query_chars": 2,
"filter_rules": {}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Body
What a caller asks of a new session; the body is optional.
Narrows what the session may search, so a leaked session can do no more than this. Left out, everything the caller may search.
Show child attributes
Show child attributes
Response
Response
A grant from POST /autocomplete/sessions, and its organization's limits.
Opaque, signed session grant. Send it verbatim in the X-Autocomplete-Session header of every autocomplete request; it carries its own expiry and budget.
"eyJhbGciOiJFZERTQSIsInR5cCI6ImFjczEiLCJraWQiOiJ…"
Seconds until the grant expires, counted from this response. Time the refresh from this, not from expires_at: it is right however far the caller's clock is off. Mint the next grant at about 80% of it so expiry never lands on the typing path.
120
When the grant stops working, in UTC: the token's own expiry, for display and logs. Time refreshes from expires_in.
"2026-09-23T12:03:00Z"
Requests this session may make per autocomplete route. Past it the autocomplete service answers 429 with session_budget_spent; the remedy is a new session, not a retry.
10
How many times this session may change its query to a different name before the autocomplete service refuses it (429, code 482). Growing, trimming or correcting the name being typed never counts.
5
Characters the query needs before the person.*, address.* and state filters narrow the suggestions; shorter, a filtered request is a 422 naming q.
5
What this session may search: the routes, the relations per route, and the most suggestions a request may ask for. Offer a search only where its route is listed.
Show child attributes
Show child attributes
Sessions this organization may mint per ten-minute window, one number shared by every user and API key in it; the mint past it is answered 429 with a Retry-After. null when there is no limit.
Sessions this organization may mint in a rolling 24 hours, shared and refused the same way. null when there is no limit.
Sessions a user signed in to the console may mint per ten-minute window, their own pool beside the organization's; past it the mint answers 429 with a Retry-After. null for an API key, whose sessions are billed, or when there is no limit.
Sessions a user signed in to the console may mint in a rolling 24 hours, refused the same way. null for an API key, or when there is no limit.
Characters a query needs before the autocomplete service searches at all; shorter, a request is a 422 naming q. Advisory: the service holds it on its own.
2
What each route in scope holds its narrowing filters to, so a client can wait before sending a filter the service would refuse. Each route's min_stem is what this session enforces on it, and filter_min_stem is the strictest of them. The service decides; a client that ignores this learns the same from the 422.
Show child attributes
Show child attributes