Skip to content

Search and lookup

MAIA API HTTP reference

MAIA's API takes a search over HTTP and returns the parcels or places in San Francisco that public records say fit it, each fact with its source. It also looks up what MAIA holds about one parcel or place, and geocodes street addresses and points to the parcels MAIA holds. A program calls it with a key; this page has everything it needs to make its first call and read the reply.

The API is for a program that needs MAIA's records about places, such as an agent's tool or a backend job. To use MAIA from Claude or ChatGPT instead, see Connect your AI assistant and the connector's tools.

For a program or an agent, this page is also served as plain Markdown at /docs/api/reference.md, and the API's spec is an OpenAPI 3.1 file at /openapi.json.

What it covers#

San Francisco County, California, for now. A search names its region, and a region MAIA does not cover is refused with the list of what is covered.

The records are San Francisco's public records: parcels and their zoning, land use, buildings, assessed values and sales; businesses and points of interest with their hours; permits; flood zones, hazards and ground elevation; schools, transit and neighborhoods. Each fact in a reply names the dataset it came from.

Get a key#

API access is open by invitation for now. To ask for it, email support@maia-analytics.com with the name of your company and what you will build, and say that you want search. MAIA sends you an invitation link and turns search on for your workspace. When you accept the invitation, API access opens for your workspace.

To make a key, sign in at app.maia-analytics.com/console/keys, give the key a name and copy it: the full key is shown only once. The first call below needs search: a key from a workspace without it is refused with forbidden.

Searches, lookups and geocodes are paid from your workspace's credits (see Price and limits). A key from a workspace that is out of credits is refused with out_of_credits. To add credits, see Buy credits.

A key belongs to your workspace, not to a person, and keeps working when the person who made it leaves. Every member of the workspace sees its keys on the Keys page. Keep a key on a server: anyone who reads it can make calls as your workspace. If a key leaks, revoke it on the Keys page and make another: a revoked key is refused at its next call. Do not rotate a leaked key, because a rotated key keeps working for 24 hours.

Make your first call#

A search for vacant lots zoned M-1 or PDR-1-G in San Francisco, outside flood zone AE, returns the lots that fit, each with the facts that matched and their sources.

Put your key in an environment variable:

export MAIA_API_KEY="maia_sk_..."

Send the search:

curl https://api.maia-analytics.com/api/v1/search \
  -H "Authorization: Bearer $MAIA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query": {"all": ["vacant lot", ["M-1", "PDR-1-G"]], "not": ["flood zone AE"]}, "region": {"county": ["San Francisco County, CA"]}, "limit": 3}'

The reply looks like this; the values here are illustrative:

{
  "output": "list",
  "count": 41,
  "results": [
    {
      "kind": "parcel",
      "id": "06075:3780001",
      "label": {
        "parcel_number": "3780001",
        "address": "1 Example St",
        "neighborhood": "Bayview Hunters Point",
        "use": "Vacant"
      },
      "values": {},
      "matched": [
        {"fact": "zoning district PDR-1-G", "sources": ["s1"]},
        {"fact": "vacant lot", "sources": ["s2"]}
      ]
    }
  ],
  "sources": {
    "s1": {"dataset": "Zoning Map - Zoning Districts", "publisher": "City and County of San Francisco"},
    "s2": {"dataset": "Assessor Historical Secured Property Tax Rolls", "publisher": "City and County of San Francisco"}
  },
  "flags": [],
  "cursor": "eyJ...",
  "meta": {
    "request_id": "6f1c2a...",
    "cost_usd": "0.005",
    "truncated": true,
    "narrow": "Send cursor with the same request for the next page.",
    "replayed": false
  }
}

This call is charged as one search, so its meta.cost_usd is "0.005". A reply with cursor has more results. Send the same request again with that cursor to read the next page.

Read the reply#

outputTypestringAlways thereYesMeaninglist, count or stats, as the request asked
countTypeintegerAlways thereYesMeaningHow many results fit, over all pages
resultsTypelistAlways thereNoMeaningA list's page of results. Each result is described below
examplesTypelistAlways thereNoMeaningFor count: a few of the results counted, in the same shape as results
statsTypeobjectAlways thereNoMeaningFor stats: each column's n, min, median, mean and max
sourcesTypeobjectAlways thereNoMeaningEach source a matched fact names, by its key: its dataset and, where on record, its publisher, licence and as_of date
flagsTypelistAlways thereYesMeaningWhat found nothing, was cut or was left out. Each flag names its part of the query, says what happened and what to do
cursorTypestringAlways thereNoMeaningSet when more results fit than the page holds. Send it back with the same request for the next page. It is good for 60 minutes
metaTypeobjectAlways thereYesMeaningThe facts about the call: see Every reply

Each result in results has these fields:

kind, idMeaningWhat the result is (parcel or place), and the id that names it to MAIA
labelMeaningWhat to call it. A parcel: parcel_number, address, neighborhood, use. A place: name, address, category, status, hours (by day, as text) and hours_source. A field MAIA has no record of is left out
valuesMeaningIts value for each column the request filtered or sorted by
matchedMeaningThe facts about it that matched the query. Each names its sources by their keys in sources

A reply is at most about 40 KB. A page that would be larger holds the results that fit, and its cursor reads on.

Calls#

Every call is a POST with a JSON body to https://api.maia-analytics.com/api/v1, with your key in the Authorization: Bearer header.

Finds parcels, or businesses and points of interest, by what public records say about them. Each search is charged from your workspace's credits: see Price and limits.

To send a search again safely, such as after a timeout, send an Idempotency-Key header with it: 1 to 255 printable characters, a new value for each new search. The same body sent again with the same key in the next 24 hours returns the first reply without running the search again, and is not charged again. That reply has meta.replayed set to true, the header Idempotent-Replayed: true and the first call's meta.request_id; its X-Request-Id header is its own. While the first call runs, the same call is refused with request_in_progress. The same key with another body is refused with idempotency_key_reused. A search that fails before it is charged frees its key, so sending it again runs it.

Search is open to every workspace with API access. A key from a workspace that MAIA has turned search off for is refused with forbidden.

queryTypestring or objectRequiredYesMeaningWhat to find. Text is searched as one part. As parts: every item of all must hold, and each part of not takes away what it matches. An item is one part (a few words naming one thing, such as vacant lot, M-1 or Noe Valley) or a list of alternatives, any one of which counts. Name the narrowest thing in not: flood zone AE, not flood zone. At most 8 parts
regionTypeobjectRequiredYesMeaningThe broad place searched: {"county": ["San Francisco County, CA"]} or {"state": "CA"}. A place is its name or its FIPS code. Name a neighborhood as a part of the query, not as the region
kindTypestringRequiredNoMeaningThe kind of result: parcel (the default) or place, a business or point of interest. A place search returns only open places unless filters.status asks for others. sort and stats are for parcels only
timeTypeobjectRequiredNoMeaningWhen the facts must be true: {"from": "2023-01-01", "to": "2023-12-31", "match": "any"}, whole days in UTC, both included. Left out, today. Most records carry no dates and count as true at every time
filtersTypeobjectRequiredNoMeaningNarrows the results. A parcel search takes a minimum, a maximum or both for a column, such as {"acres": {"min": 0.5}}. The parcel columns and the place filters are listed below this table. A result with no value for a filter is left out
outputTypestringRequiredNoMeaninglist (the default) returns the results; count how many there are, with a few examples; stats the count with the minimum, median, mean and maximum of each column. count and stats take no sort or cursor
sortTypeobjectRequiredNoMeaningOrders a list by one column: {"by": "acres", "order": "desc"}. Left out, best match first
limitTypeintegerRequiredNoMeaningHow many results a page holds, 1 to 100 (default 10)
cursorTypestringRequiredNoMeaningA reply's cursor, exactly as given, with the same request, for the next page. Leave it out for a new search

A parcel search can filter by these columns:

acresMeaningThe parcel's lot area, in acres
year_builtMeaningThe year the parcel's building was built
total_valueMeaningThe parcel's total assessed value (land and improvements), in US dollars
nearest_substation_mMeaningThe straight-line distance from the parcel to the nearest electric substation, in metres
nearest_transmission_line_mMeaningThe straight-line distance to the nearest high-voltage transmission line (69 kV and up), in metres
nearest_highway_mMeaningThe straight-line distance to the nearest highway (a motorway or trunk road), in metres
nearest_highway_ramp_mMeaningThe straight-line distance to the nearest highway on- or off-ramp, in metres
nearest_rail_transit_station_mMeaningThe straight-line distance to the nearest rail transit station (subway, light rail, streetcar or monorail), in metres
nearest_school_mMeaningThe straight-line distance to the nearest K-12 school, in metres

MAIA records no nearest_*_m distance beyond 80 km, so a filter on that column leaves such a parcel out.

A search with kind place returns only open places, unless filters.status asks for others. A place search takes these filters. A filter of the other kind is refused with invalid_request, and field is filters.<name>: for example acres on a place search, or status on a parcel search.

statusTakes{"is": "open"}; is is open, temporarily_closed, permanently_closed or anyMeaningThe place's operating status. Left out, open
open_onTakes{"day": "mon"}, a day from mon to sunMeaningIt has opening hours that day. A place with no recorded hours is not in the results
open_afterTakes{"hour": "21:00", "day": "fri"}, with day optionalMeaningStill open after that time, on that day or on any day. A time before 05:00 is the night after that day. A place with no recorded hours is not in the results
open_24_hoursTakes{"is": true}MeaningRecorded as open the whole of every day. A place with no recorded hours is not in the results

The reply is described in Read the reply.

A request the search will not run is refused with invalid_request: field names the field to change and detail says why. A search that cannot finish in its time limit is refused with timed_out: make it smaller (fewer or narrower parts, a filter, count in place of a sorted list) and send it again. While MAIA has paused search, every search, a next page included, is refused with at_capacity and no Retry-After: try again later. While your workspace is out of credits, every search, a next page included, is refused with out_of_credits before it runs.

POST /lookup#

Reads what MAIA holds about one parcel or place: every fact linked to it, or only the facts that answer your questions. A lookup that finds a parcel or place is charged one lookup from your workspace's credits; one that finds nothing (not_held) costs nothing. See Price and limits. A lookup counts toward your workspace's searches a minute.

Lookup is open to the same workspaces as search. A key from any other workspace is refused with forbidden.

To send a lookup again safely, send an Idempotency-Key header with it, as for a search: the same rules apply. A key already used for another call in the last 24 hours is refused with idempotency_key_reused. While your workspace is out of credits, a lookup is refused with out_of_credits before it runs.

Name the parcel or place by the id of a search result, or by a point, or name a parcel by its street address. A point resolves to the parcel it lies in, or the nearest within 25 m; for a place, the nearest place within 30 m. An address resolves to the parcel whose record holds it, from MAIA's own records only. An address that several parcels hold equally is refused with invalid_request (status 400): field is location.address, and detail names up to three of the parcels, each by address and id, and counts the others. Add a unit to the address, or send one parcel's id as location.id.

curl https://api.maia-analytics.com/api/v1/lookup \
  -H "Authorization: Bearer $MAIA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"location": {"point": {"lat": 37.7793, "lon": -122.4193}}, "questions": ["What is it zoned?"]}'
locationTypeobjectRequiredYesMeaningThe parcel or place, as exactly one of {"id": "<id of a search result>"}, {"point": {"lat": 37.7793, "lon": -122.4193}} or, for a parcel, {"address": "1 Dr Carlton B Goodlett Pl, San Francisco, CA"}
kindTypestringRequiredNoMeaningWhat the location names: parcel (the default) or place, a business or point of interest. An id must be of this kind
questionsTypelist of stringRequiredNoMeaning1 to 10 questions about it, in plain words, such as what is the zoning and height limit?. Each gets only the facts relevant to it. Left out, the reply holds every fact linked to it
timeTypeobjectRequiredNoMeaningWhen the facts must be true, as in a search: {"from": "2023-01-01", "to": "2023-12-31", "match": "any"}, whole days in UTC. Left out, today
statusTypestringAlways thereYesMeaningresolved, or not_held when no parcel or place fits the location
reasonTypestringAlways thereNoMeaningWhy it is not held, when status is not_held
resultTypeobjectAlways thereNoMeaningWhat the location matched: its kind, id, label and a point on it; matched_by (exact for an id or an address held as asked, close for an address held with differs or unchecked as in /geocode, within for a point inside a parcel, nearest with distance_m for a point on none); and candidates, the ids of others that also fit
subjectsTypelist of objectAlways thereNoMeaningWithout questions: every fact, by subject. A fact has its field and value, its description where held, its sources by key into sources, and true: the days it holds
questionsTypelist of objectAlways thereNoMeaningWith questions: each in order, with status found or nothing_relevant and only the facts relevant to it, by subject
sourcesTypeobjectAlways thereNoMeaningEach source a fact names, by key: its dataset, publisher and licence
disagreementsTypelist of objectAlways thereNoMeaningWhere sources state the same thing differently: what each says, and when
flagsTypelist of objectAlways thereNoMeaningWhat to know about the match or the reply, each with what it means
timeTypeobjectAlways thereNoMeaningThe days the facts hold for
metaTypeobjectAlways thereYesMeaningThe facts about the call: see Every reply

A request the lookup will not run is refused with invalid_request: field names the field to change and detail says why.

POST /geocode#

Finds the parcels MAIA holds at street addresses, or nearest to points, and gives MAIA's id for each: the id a search result has and /lookup takes. Every value in the reply comes from records MAIA holds. Each row MAIA holds, matched or ambiguous, is charged one geocode from your workspace's credits; a row that is not_held or refused costs nothing. See Price and limits.

Geocode is open to the same workspaces as search. A key from any other workspace is refused with forbidden.

To send a geocode again safely, send an Idempotency-Key header with it, as for a search: the same rules apply. A key already used for another call in the last 24 hours is refused with idempotency_key_reused. While your workspace is out of credits, a geocode is refused with out_of_credits before it runs.

curl https://api.maia-analytics.com/api/v1/geocode \
  -H "Authorization: Bearer $MAIA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"rows": [{"address": "1 Dr Carlton B Goodlett Pl, San Francisco, CA 94102"}, {"point": {"lat": 37.7793, "lon": -122.4193}}]}'
rowsTypelist of object, 1 to 100 itemsRequiredYesMeaningEach row is exactly one of {"address": "..."}, a house number and street, then optionally a unit, city, state and ZIP, at most 300 characters; or {"point": {"lat": 37.7793, "lon": -122.4193}}. Send more than 100 rows in more calls
coverageTypelist of objectAlways thereYesMeaningThe counties a row can be matched in, each with its county FIPS code, name and state
rowsTypelist of objectAlways thereYesMeaningOne answer for each row sent, in the same order. Each is described below

The reply also carries meta: see Every reply.

Each answer in rows has its index, counting from 0, and a status:

matchedMeaningplace is the parcel
ambiguousMeaningMore than one parcel holds the address equally well. tied counts them and candidates lists up to 10 of them; MAIA does not pick one. Add the unit, city or state, or choose by county
not_heldMeaningMAIA holds no parcel for the row, and reason says why
refusedMeaningThe row can't be matched as sent: code is invalid_request, field names it, such as rows[2].address, and reason says why. The other rows are still answered

A place, and each of the candidates, has these fields:

id, kind, countyMeaningMAIA's id for the parcel, parcel, and its county FIPS code
addressMeaningThe address as MAIA's records hold it
pointMeaningA point on the parcel: lat and lon
matchMeaningFor an address, exact (held as sent) or close. For a point, within (the parcel holds it) or nearest, with distance_m
differsMeaningFor a close match: the street_type, direction or unit that differ from what was sent
uncheckedMeaningFor a close match: the city or zip sent that MAIA's records can't confirm at the parcel

A request MAIA will not run, such as one with no rows or more than 100, is refused whole with invalid_request: field names the field to change and detail says why.

POST /feedback#

Tells the MAIA team about a wrong result, an error or something MAIA can't do. The team reads each report but does not reply through the API.

curl https://api.maia-analytics.com/api/v1/feedback \
  -H "Authorization: Bearer $MAIA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"kind": "wrong_result", "message": "Search 6f1c2a... returned a parcel in flood zone AE."}'
kindTypewrong_result, error, missing_capability, feature_request, confusing, slow, praise or otherRequiredYesMeaningWhat kind of report it is
messageTypestring, up to 2,000 charactersRequiredYesMeaningWhat was expected and what happened. Quote a reply's request_id. Leave out personal information
impactTypeblocked, worked_around or minorRequiredNoMeaningHow much it got in your way
user_askedTypebooleanRequiredNoMeaningtrue when a person asked for the report to be sent. Defaults to false
noteTypestringAlways thereYesMeaningSent to the MAIA team.
metaTypeobjectAlways thereYesMeaningThe facts about the call: see Every reply

Every reply#

Every reply, refused or not, carries the same facts about the call, in the body's meta and in headers.

request_idTypestringAlways thereYesMeaningNames this call to MAIA. Also in the X-Request-Id header. Quote it in a feedback report
cost_usdTypestringAlways thereYesMeaningWhat this call was charged, in US dollars, such as "0.005". A price under a cent keeps its places. "0.00" when the call was not charged
limitTypeobjectAlways thereNoMeaningThe calls left this minute: limit, remaining and resets_in_seconds
truncatedTypebooleanAlways thereNoMeaningtrue when the reply holds less than matched. Defaults to false
narrowTypestringAlways thereNoMeaningHow to get the rest, when truncated is true
replayedTypebooleanAlways thereNoMeaningtrue when this is the stored reply to an earlier /search, /lookup or /geocode with the same Idempotency-Key, not run or charged again. Defaults to false
X-Request-IdMeaningThe request id
RateLimit-Limit, RateLimit-Remaining, RateLimit-ResetMeaningThe calls a minute, the calls left, and the seconds until the minute starts again. On /search and /lookup they count your workspace's searches and lookups. On /geocode they report the key's calls or the workspace's rows, whichever has fewer left
Retry-AfterMeaningOn a refusal you can retry: the seconds to wait
Idempotent-ReplayedMeaningtrue on a /search, /lookup or /geocode reply replayed for its Idempotency-Key

Price and limits#

Searches, lookups and geocodes are paid from your workspace's credits. A search and a lookup cost the same over the API and MAIA's connector. Each reply's meta.cost_usd says what the call cost.

/search for a listPrice$0.005 a search ($5 per 1,000). It includes the search's first 10 results, counted over all its pages. Each result after those costs $0.001, on whichever page returns it. A list that finds nothing costs nothing
/search for countPrice$0.005, also when nothing matches
/search for statsPrice$0.008, also when nothing matches
/lookupPrice$0.01 a lookup that finds a parcel or place ($10 per 1,000). A lookup that finds nothing costs nothing
/geocodePrice$0.001 a row that is matched or ambiguous ($1 per 1,000 rows). A row that is not_held or refused costs nothing
/feedbackPriceNot charged

A call that is refused or fails costs nothing. A call sent again with its Idempotency-Key returns the first reply and is not charged again.

There are no free calls. When your workspace is out of credits, a search, a lookup or a geocode is refused with out_of_credits before it runs. Its detail says the date (UTC) your credits come back, when they will. To keep going before then, add credits: see Buy credits and Out of credits.

SearchesValue300 a minute for each workspace, over the API and MAIA's connector together. A next page counts like a first, and a lookup counts like a search
GeocodeValue30 calls a minute for each key, shared with /feedback, and 1,000 rows a minute for each workspace: a call of 100 rows counts 100. 1 to 100 rows a call
FeedbackValue30 calls a minute for each key, shared with /geocode, and 20 reports in each 24 hours
Keys that aren't validValue120 calls a minute from one address with a key that isn't valid. Past that, every call from the address is refused before its key is read, a valid key included
Page sizeValue1 to 100 results (default 10). A reply is at most about 40 KB
QueryValueAt most 8 parts
CursorValueGood for 60 minutes

Past a limit, a call is refused with limit_reached (status 429), and Retry-After says how many seconds to wait when the wait is known.

Errors#

A refused or failed call returns application/problem+json (RFC 9457 problem details):

{
  "type": "tag:maia-analytics.com,2026:error:invalid_request",
  "title": "The request can't be run as sent",
  "status": 400,
  "detail": "limit: must be at most 100.",
  "code": "invalid_request",
  "field": "limit",
  "request_id": "6f1c2a...",
  "meta": {"request_id": "6f1c2a...", "cost_usd": "0.00", "truncated": false, "replayed": false}
}

Branch on code; it does not change. detail is written for a person and can change. field names the field to change, when one is at fault. A path the API does not have gets a plain 404 with {"detail": "..."}, not a problem object.

invalid_requestStatus400WhenThe body does not match the fields on this page, or it holds a cursor MAIA did not makeWhat to doChange the request as detail and field say
unauthorizedStatus401WhenNo key, or a key that is unknown or revokedWhat to doCheck the key. Don't retry with a revoked key
forbiddenStatus403WhenThe call is not open to your workspace, your workspace is suspended, or its paid plan has not been paidWhat to doDon't retry. Ask MAIA, or pay the plan
not_foundStatus404WhenThe call names something MAIA has no record ofWhat to doCheck the name
idempotency_key_reusedStatus422WhenThe Idempotency-Key was sent in the last 24 hours with another body, or to another callWhat to doUse a new key for a new request
request_in_progressStatus409WhenA call with this Idempotency-Key is still runningWhat to doSend it again after Retry-After seconds to get its reply
limit_reachedStatus429WhenToo many calls or geocode rows in a minute, too many calls from one address with a key that isn't valid, or the day's feedback reports are usedWhat to doWait Retry-After seconds, when it is set
out_of_creditsStatus402WhenYour workspace is out of credits. detail says the date (UTC) its credits come back, when they willWhat to doAdd credits, or wait for that date. Don't retry before then
at_capacityStatus503WhenMAIA has paused search. It has no Retry-AfterWhat to doTry again later
internalStatus500WhenMAIA failedWhat to doRetry once. If it fails again, send a feedback report quoting request_id
unavailableStatus503WhenMAIA is unavailable for a momentWhat to doRetry after Retry-After seconds
timed_outStatus504WhenA search could not finish in its time limitWhat to doDon't send the same request again. Make it smaller and send it again

Changes#

MAIA adds fields to replies, codes to the table above and optional fields to requests without notice, so ignore fields you don't know. Removing or renaming a field or a code, or changing what one means, happens only under a new version of the API (a new base URL), with notice, except that a field or a code no call returns can be removed without one. This page and /openapi.json follow each MAIA release.