K-Stra developers

Errors, limits & versions

Problem Details

Every error of /api/v1 and /mcp is an RFC 9457 problem, application/problem+json, including 429, a 404 and a body that cannot be read:

{
  "type": "https://www.k-stra.com/errors/insufficient_credits",
  "title": "Insufficient credits",
  "status": 402,
  "detail": "The run was blocked before anything was charged.",
  "error": "insufficient_credits",
  "errorCode": "3f9a1c2b7d",
  "instance": "/api/v1/actions/analysis.people_economy/execute",
  "blockedBy": "organization_balance",
  "credits": 2
}

type is stable per error code. error is the code (the same one the web app uses). errorCode correlates the request in our logs: quote it when you contact support.

detail is a sentence in English written for a person: show it to your user, log it, but do not parse it. Its wording can improve at any time without a new version; error and type are what your code should branch on.

Catalogue

Status error When
400 invalid_input the body is not a JSON object with the action's input, or not valid JSON for the route (for example a number where a string is expected in the body of an analyses route); or the input has a field the action's schema does not know: field gives its path (include, points[2].name) and detail suggests the closest known field. quotedCredits and idempotencyKey are always accepted
400 validation_error the input does not respect the action's rules; a required field left out is listed in missing and named in detail, a field of the wrong type is named in detail
400 invalid_name analyses: the name is empty or longer than 255 characters
400 invalid_state POST /api/v1/analyses without a state object (send {} when the analysis lives only in the API)
400 state_too_large analyses: the state is larger than 512 KB
400 invalid_id analyses: the id is not the code of an analysis
400 invalid_expiry sharing: anyoneExpiresDays is not 7, 30 or null
400 invalid_email sharing: more than 50 addresses in people, or one that is not an email address
400 quote_required a charged execution without quotedCredits
400 not_chargeable /quote called on a free action
401 not_authenticated no valid API key (WWW-Authenticate: Bearer)
402 insufficient_credits balance or a limit does not cover the run; nothing charged; see blockedBy
403 scope_required the key lacks the scope this route needs (run to spend, manage to write analyses, read their sharing and manage webhooks)
403 forbidden the action is not available to this key
403 read_only_role the key's user is a Viewer in their team: Viewers read, they do not run charged actions or save analyses
404 unknown_action no action with that id in the public API
404 not_found the analysis, version, job, job result or webhook does not exist or is not yours to see
404 unknown_tool MCP only: no tool with that name (tools/list has the current ones)
405 method_not_allowed the route does not accept this HTTP method
409 quote_changed the quote no longer matches quotedCredits; nothing charged; quotedCredits carries the new value and declaredCredits the one you sent
409 idempotency_key_conflict the idempotency key was already used for a different request (another action or another input) or for a run that did not complete; nothing run or charged; send it again with a new key (Credits)
413 payload_too_large the request body is larger than 8 MB
422 address_not_found market.* actions: no address in the countries the action covers matches address (or no postcode or suburb matches); give lat/lng instead
422 out_of_coverage market.* actions: the point is outside the countries the action covers (market.catchment and market.competition: Australia and New Zealand; market.traffic: Australia), or no road network is reachable from it
429 rate_limited too many requests; wait Retry-After seconds (always present)
503 engine_unavailable the geographic engine is restarting; nothing charged; retry in a few seconds
503 temporarily_unavailable /api/market/v1 only: the service cannot run analyses right now; nothing charged; retry later
500 internal_error our fault; errorCode identifies the request

Limits

Limit Value
Requests per key (REST and MCP together) 600 per minute
Charged executions per key (REST) 60 per minute; free executions count only toward the 600 requests
One-call analyses (/api/market/v1) 300 charged calls per minute per key; minutes 5 to 30, radius 200 to 3,000 m; at most 50 shops in market.competition
Engine-heavy calls (isochrones, quotes, and charged executions, which quote again before they run) 30 per minute per IP, 2 concurrent isochrones per IP
Continent data is served for oceania (Australia) only; europa stays in the schemas but is refused with 400 validation_error ("Unknown continent") before anything is charged
Country a territory outside the countries served, or across countries with different currencies, is refused with 400 validation_error before the quote. Where a country has no data for a module yet (New Zealand: Real Estate and Traffic & Footfall), the module answers 400 validation_error with "… is not available in New Zealand yet", before the quote: nothing is charged. The same holds where a country's stores have no sectors yet (New Zealand today): analysis.markets_sector answers "Sector without a computed model in New Zealand" and analysis.category_mix "Category counts are not available in New Zealand yet". markets.sectors with a country that is not served answers 400 validation_error ("Unknown country: … (one of AU, NZ)")
Isochrone 1 to 10 origins; 1 to 8 bands for analysis.isochrone and for the catchment bands of analysis.loyalty, 1 to 6 in the other analyses; up to 120 minutes or 30 km
Territory up to 1,000,000 address poles for areas and drawn polygons, and also for catchments in real estate; analysis.people_economy on administrative areas has no limit, the whole country included; sector analyses up to 400,000 on any territory; 1 to 12 areas, 1 to 10 polygons with 5,000 vertices in all. Refused with 400 before anything is charged
Store networks (network.coverage) 2 to 500 stores plus up to 100 candidates, catchments up to 60 minutes, at most 50,000,000 address poles across all catchments (refused before charging)
Coverage points (analysis.brand_coverage) up to 500 points (beyond, the first 500 are analysed and the result says so), catchments up to 30 minutes, same 50,000,000-pole ceiling
Own stores (analysis.site_comparison, site.rank) up to 100 in ownStores, a dataset counting as one (more are refused with 400 validation_error); a dataset brings in at most 100 points within reach, the first 100, and the source note of the comparison says so
One property (analysis.realestate_property) the property inside the territory; floor area 10 to 10,000 m² (land up to 1,000,000 m²); bedrooms, bathrooms and car spaces 0 to 30; floor area tolerance 5 to 100%; months back 1 to 36; discount 0 to 50%; refused with 400 before anything is charged. The pool of candidates is cut to the 20,000 listings nearest in drive time, and the result says so
Request body 8 MB, REST and MCP
Active keys per user 20; a key created by signing in with OAuth counts too, and connecting the same client again replaces its previous key
OAuth client registration (/oauth/register) 20 per minute in all; 1 to 10 redirect_uris, https or http to localhost
OAuth token requests (/oauth/token) 60 per minute in all; a code lasts 10 minutes and is used once
Webhook endpoints per organization 10
Dataset storage first 50 MB per organization free, then 2 credits a month every 100 MB; unpaid, the datasets are suspended and actions that read them are refused with 400 (see Credits)
Webhook delivery attempts 4 (now, +1 min, +10 min, +1 h); an endpoint is disabled after 20 consecutive failures

OAuth (MCP sign-in)

/oauth/register, /oauth/authorize and /oauth/token answer with the standard OAuth errors, as {"error": "…", "error_description": "…"} (and, from /oauth/authorize, as parameters on the client's redirect address):

Code Where Meaning
invalid_client_metadata, invalid_redirect_uri register the body is not valid client metadata, or a redirect address is not https (or http to localhost)
invalid_request authorize, token PKCE missing (code_challenge with S256 is required), or the token request is not form-encoded
unsupported_response_type authorize only code
invalid_scope authorize scopes are read and run
invalid_target authorize resource is not this server's /mcp
access_denied authorize the user did not allow access
invalid_client token unknown client, or wrong client secret (401)
unsupported_grant_type token only authorization_code; there are no refresh tokens
invalid_grant token the code is unknown, expired, already used, or does not match redirect_uri or code_verifier

Versions and deprecation

The version in the specification (info.version) is the contract version. It grows on additive changes only. Nothing is removed from v1; a deprecated element would keep working and carry the Deprecation and Sunset headers for at least twelve months, with a line in the Changelog.