How to Use ArcGIS REST API Query Parameters
Learn the ArcGIS REST API query parameters that matter most — where, outFields, returnGeometry, f, and more. A practical reference with real examples.
Every ArcGIS REST FeatureServer exposes a /query endpoint. This is what almost every GIS tool — including ours — uses to fetch features from a service. Understanding how to construct a query is essential if you want to pull exactly the data you need.
This article is a practical reference to the query parameters that matter most.
The basic query URL
The simplest query looks like this:
https://services.arcgis.com/.../FeatureServer/0/query?where=1%3D1&outFields=*&f=jsonThis asks for every feature in layer 0 with all attributes, returned as JSON. The %3D is a URL-encoded equals sign (=).
The parameters you will use most
where
The attribute filter. Uses SQL syntax. The most common value is 1=1 (return everything).
where=POPULATION > 10000where=STATE = 'California'where=YEAR > 2020 AND STATUS = 'Active'outFields
Which attribute fields to return. Use * for all fields, or a comma-separated list for a subset.
outFields=*outFields=OBJECTID,NAME,POPULATIONReducing outFields makes queries significantly faster on large datasets.
returnGeometry
Whether to include geometry. Defaults to true.
returnGeometry=falseSet to false when you only need attributes — this makes the response smaller and faster.
f
The output format. Common values:
- f=json — ArcGIS JSON format (default)
- f=geojson — GeoJSON (not all services support this)
- f=pjson — pretty-printed JSON (for debugging)
- f=html — HTML (rarely useful)
returnCountOnly
Returns just the count of matching features, without any data. Extremely fast.
returnCountOnly=truereturnIdsOnly
Returns only the object IDs of matching features. Useful for paginated downloads — this is what a browser-based downloader uses under the hood.
returnIdsOnly=trueobjectIds
Fetches specific features by their object IDs. Used for retrieving chunks of data.
objectIds=1,2,3,4,5resultOffset and resultRecordCount
Pagination parameters. Most servers cap a single query at 1,000–2,000 features.
resultOffset=0&resultRecordCount=1000resultOffset=1000&resultRecordCount=1000Increment the offset by the record count until you get fewer features back than you requested — that means you have hit the end.
geometry and spatialRelationship
Spatial filter. Return only features that intersect (or touch, or contain, etc.) a given geometry.
geometry=-95.99,36.15,-95.98,36.16&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&inSR=4326outSR
Output spatial reference. Forces the response geometry to a specific coordinate system.
outSR=4326orderByFields
Sort the results by one or more fields.
orderByFields=POPULATION DESCgroupByFieldsForStatistics
Used with outStatistics to group features before aggregating.
returnDistinctValues
Returns only unique values for the specified outFields.
outFields=STATE&returnDistinctValues=truePutting it together: a real example
Suppose you want to get all parcels in a specific county that are larger than 5 acres, sorted by area, in WGS84 coordinates:
https://services.arcgis.com/.../Parcels/FeatureServer/0/query?where=ACRES > 5&outFields=APN,OWNER,ACRES&returnGeometry=true&outSR=4326&orderByFields=ACRES DESC&f=jsonAdd pagination if you expect more than 1,000 results:
&resultOffset=0&resultRecordCount=1000Common errors and how to fix them
- "Invalid URL" — check that you have URL-encoded special characters like spaces (use %20), quotes (use %27), and equals (use %3D).
- "Field not found" — verify the field name. Field names are case-sensitive on some servers.
- "Too many features" — add pagination with resultOffset and resultRecordCount.
- "Token required" — the service is secured. You need an authentication token.
- Garbled geometry — check the outSR. If the source is in Web Mercator and you expect WGS84, they will not match.
Why you might not need to do this manually
If all you want is to download a dataset, you do not need to build query URLs by hand. A browser-based tool like Geo Server Data Downloader handles the pagination, chunking, and format conversion automatically — and lets you export the result as Shapefile, GeoJSON, KML, or GeoPackage without writing a single query.
Summary
The ArcGIS REST query API is powerful once you know the parameters. For quick one-off queries, use where, outFields, and f=json. For downloads, add returnIdsOnly and pagination. For spatial filters, use geometry and spatialRel. Everything else is icing on the cake.
Related guides
Ready to try it yourself?
Export ArcGIS REST services, WFS endpoints, and ArcGIS Online datasets to Shapefile, GeoJSON, KML, or GeoPackage — all in your browser.
Open the Downloader