The $limit Parameter

The $limit parameter controls the total number of rows returned, and it defaults to 1,000 records per request. It can be used either alone, or with $offset in order to page through a dataset.

For example, if you wanted to only return the top ten strongest earthquakes, you could use $limit in conjunction with $order:

https://soda.demo.socrata.com/resource/4tka-6guv.json?$order=magnitude DESC&$limit=10

When combined with an aggregation via $group, $limit is applied after the aggregation. For example, if the aggregation reduces a result set from 10,000 records to 100, the $limit is applied to the result set of 100, rather than the original records.

Note: Depending on the version of the API endpoint, it will have different maximums for $limit:

  • Version 2.0 endpoints have a maximum $limit of 50,000
  • Version 2.1 endpoints have no maximum

Details are available in the API documentation for each API. Make sure you pick a limit appropriate to the speed of your connection, as HTTP calls will time out and payloads for high $limits can be very large.