One GIS tool saved as your own API — its settings fixed, its second input one of your data items — and called by another system with a key of its own.
A Tool API is one GIS tool saved as the API of a person on Pro or Max, or of an enterprise. Its settings are fixed, and the tool's second input is bound to one of the owner's own data items: read live as its Hyz Layer — an edit shows on the next call — or as a file, the newest version scanned clean at each call or a pinned one. Another system calls it with a key of its own, sends only the main input as GeoJSON and reads JSON back.
The owner's example is “inside Saudi Arabia”: the inside check, with the Saudi border bound as its reference and a rule — wholly inside, partly inside, or at least a share inside.
Any vector tool whose main input is one layer and whose output is a layer can be saved this way: the geometry tools, the intersect and union overlays, calculate geometry, validate, spatial join, zonal statistics and the inside check. Raster, image and document tools cannot.
The bound input is the tool's second one: the mask of clip and erase, the overlay layer of intersect and union, the join layer of spatial join, the raster of zonal statistics, the reference of the inside check.
In beta
A person makes theirs in the Portal; an enterprise makes its own in the Console.
One request with the API's own key. The caller sends only the main input; the settings and the bound layers are already saved.
/tool-apis/{id}/runAppend the path to the API's base address, with the Tool API's own id in it:
https://haiyz.net/apiAuthorization: Bearer hyzapi_…hyzapi_. An unknown API, no key, a revoked key and a wrong one all get the same 401.Content-Type: application/jsoninputA point in Riyadh, sent to a Tool API made of the inside check with the Saudi border as its reference. Set TOOL_API_ID to the API's id and TOOL_API_KEY to its key.
curl -X POST "https://haiyz.net/api/tool-apis/$TOOL_API_ID/run" \
-H "Authorization: Bearer $TOOL_API_KEY" \
-H "Content-Type: application/json" \
-d '{"input":{"type":"Point","coordinates":[46.7,24.7]}}'What the answer holds depends on the tool: a geometry tool returns its result, the inside check returns a verdict for each feature.
Every answer comes in the platform's standard envelope — ok, code and, on success, data — which the reference describes once. Read about the envelope
Every tool but the inside check answers with its result as GeoJSON in data:
featureCountresultThe inside check answers with its verdicts in data:
passedcountsinside, partial and outside, and how many passed.resultsEach entry of results is one input feature:
results[].indexresults[].relationinside, partial or outside — see how the inside check decides, below.results[].percentInsideresults[].passresults[].matchCountresults[].referenceThe answer to the call above: the point lies inside, so it passes the rule, and reference carries the field the owner picked from the Saudi border.
{
"ok": true,
"statusCode": 200,
"code": "TOOL_API_RESULT",
"data": {
"passed": true,
"counts": { "inside": 1, "partial": 0, "outside": 0, "passed": 1 },
"results": [
{
"index": 0,
"relation": "inside",
"percentInside": 100,
"pass": true,
"matchCount": 1,
"reference": { "name": "Saudi Arabia" }
}
]
}
}Each input feature is compared with the bound polygon reference layer.
insidepartialoutsidepercentInside is the share of a polygon's area, a line's length or a multipoint's points that lies inside, measured in an equal-area projection. A point is 100 or 0.
insidepartialpercent ≥ NpercentInside is at least N.reference holds the fields the owner picked from the reference feature the input overlaps most — which region it falls in, for example.
A call counts as one API request against its owner's daily allowance — not as a tool run.
A person's calls count against their plan's API requests a day, which their personal API keys share. An enterprise's calls count against its tier's API requests a day.
The bound layers stay inside
What the owner keeps
The codes a call can answer with, and what each one means.
TOOL_API_INPUT_INVALIDThe input is not a usable GeoJSON Feature, FeatureCollection or geometry. The message says why.
TOOL_API_KEY_INVALIDThe API is unknown, or the key is missing, revoked or wrong. All four get the same answer.
TOOL_API_DISABLEDThe owner has switched this Tool API off.
TOOL_API_PLANThe owner is no longer on a plan or tier that includes Tool APIs. The API answers again once they are.
TOOL_API_SUSPENDEDThe owner's account or enterprise is suspended. The API answers no calls while it is.
TOOL_API_HELDHaiyz has switched this Tool API off. It answers no calls until Haiyz releases it; its owner is told why.
GIS_TIER_REQUIREDThe tool needs a higher tier than the owner now has (spatial join and zonal statistics need Pro).
TOOL_API_BINDING_MISSINGA data item the API is bound to is gone, is no longer the owner's, or has no clean version.
TOOL_API_INPUT_TOO_LARGEThe input has more than 10,000 features.
TOOL_API_RESULT_TOO_LARGEThe result is too large to answer in one call. Send fewer features.
API_KEY_QUOTAThe owner is a person who has used the day's API requests their plan allows, which their personal API keys share.
ENTERPRISE_API_DAILY_LIMITThe owner is an enterprise that has used its tier's API requests for the day.
TOOL_API_RATE_LIMITEDMore than 60 calls in a minute to this Tool API. Wait a minute and try again.
The errors page has the full code catalogue and a retry policy for each kind of failure.
Errors, limits and quotas