By default, when you search for something with the /companies or /people APIs, we will return the first 10 matching records. However, this is not a hard limitation! Both the /companies and /people APIs have a parameter called 'limit' that you can use to tell the API how many records you want to return all at once. If you are using the 'GET' versions of the APIs, you can include this directly in the query string portion of the URL like this:

GET https://api.infoconnect.com/v1/companies/search?stateprovince=ma&limit=20&apikey=

(NOTE: you will have to add your API key to the end of this URL for this to work)

This example will return 20 records for companies in Massachusetts. Changing the limit parameter to limit=40 will return 40 records, and so on. With the /companies and /people APIs, there is a limit to the limit parameter. As of today, if you are asking for basic records, the max you can set the limit to is 100. If you're asking for core records, the max is 2000.

Ok, but what happens if you need more than 100?? The example above, where it searches for all companies in Massachusetts, will match way more than 100 records. In fact there are 428668 for that search. What happens if you want all the records? To get all the records you need to use another parameter along with limit called 'offset'. This parameter tells the API where to start returning records from the entire set of results. If you don't include this parameter, the default is to start at record number 0 and then return the number of records specified with the 'limit' parameter. So our example above returns records 0-99 for all the companies in Massachusetts. If you want records 100-199, you include the offset parameter set to 100 like this:

GET https://api.infoconnect.com/v1/companies/search?stateprovince=ma&limit=100&offset=100&apikey=

(NOTE: you will have to add your API key to the end of this URL for this to work)

To get all the records, it's just a simple matter of incrementing the offset parameter and calling the API, again and again until you have them all (or as many as you need).

GET https://api.infoconnect.com/v1/companies/search?stateprovince=ma&limit=100&offset=100&apikey=
https://api.infoconnect.com/v1/companies/search?stateprovince=ma&limit=100&offset=200&apikey=
https://api.infoconnect.com/v1/companies/search?stateprovince=ma&limit=100&offset=300&apikey=

 (NOTE: you will have to add your API key to the end of this URL for this to work)

The only thing to watch out for is that the POST versions of the search APIs don't accept the limit and offset parameters in the query string. For those APIs you need to pass both limit and offset with the rest of the search criteria in the POST body. For example:

POST https://api.infoconnect.com/v1/companies/search?apikey=
POST data:
{
  "ResourceType": Basic",
  "Limit":20,
  "Offset":40,
  "City":"Burlington",
  "StateProvince":"MA"
}

Nth Record

Another way of working with the number of records that are returned from the API is to use the NthRecord parameter. NthRecord works in conjunction with the Limit parameter to return a systematic sample of search results. Limit controls the number of records returned, while the sampling interval is determined by dividing the available results by the limit.

For Example: In a search with 200 potential results setting 'limit' to 10 and 'NthRecord' to 'True' would result in 10 records but it would be every 20th record (200/10) from the overall result set.

{
  "ResourceType":"Basic",
  "CompanyName":"I"
  "NthRecord":"true",
  "Limit":10
} 

Setting 'limit' to 3 would result in 3 records but it would be every 67th record (200/3) from the result set.

{
  "ResourceType":"Basic",
  "CompanyName":"I"
  "NthRecord":"true",
  "Limit":3
}