> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://api.docs.modulards.com/modular-ds-public-api/websites/manage-websites/count-websites/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://api.docs.modulards.com/_mcp/server. # Count websites GET https://api.modulards.com/api/public/v1/sites/count Returns how many websites match the filters, without listing them. Use it to size a selection, for example how many websites carry a tag or run a given PHP version, before you act on it. It accepts the same filters as "List websites". Only `filter` is accepted: `sort`, `page`, `fields` and `include` answer `422`. Reference: https://api.docs.modulards.com/modular-ds-public-api/websites/manage-websites/count-websites ## Authentication - `Authorization` header (bearer token, required) — Personal access token created in the Modular DS dashboard; read-only tokens can only call GET endpoints. ## Request ### Query parameters - `filter[s]` (string, optional) — Free-text search on the website's name, slug or address. - `filter[core_version][]` (string, optional) — Exact WordPress versions, for example `6.8.1`. Several values match any of them. - `filter[engine_version][]` (string, optional) — Exact PHP versions, for example `8.2.27`. Several values match any of them. - `filter[alerts][]` (string, optional) — Notification configuration ids. Several values match websites associated with any of them. - `filter[id][]` (string, optional) — Website ids. Several values match any of them. - `filter[team][]` (string, optional) — Team ids. Several values match websites in any of these teams. - `filter[tags][]` (string, optional) — Tag ids. Several values match websites carrying any of these tags. - `filter[connected]` (string, optional) — `1` for websites whose connection works, `0` for websites that are not connected. - `filter[patchstack]` (string, optional) — `1` for websites with Patch & Protect switched on, `0` for websites without it. ## Response ### 200 200 - Website count - `jsonapi` (ApiPublicV1SitesCountGetResponsesContentApplicationJsonSchemaJsonapi, optional) - `meta` (ApiPublicV1SitesCountGetResponsesContentApplicationJsonSchemaMeta, optional) ## Types ### ApiPublicV1SitesCountGetResponsesContentApplicationJsonSchemaJsonapi - `version` (string, optional) ### ApiPublicV1SitesCountGetResponsesContentApplicationJsonSchemaMeta - `count` (integer, optional) — Number of websites that match the filters. ## Examples **Response** ```json { "jsonapi": { "version": "1.1" }, "meta": { "count": 3 } } ``` **SDK Code** ```python 200 - Website count import requests url = "https://api.modulards.com/api/public/v1/sites/count" headers = {"Authorization": "Bearer "} response = requests.get(url, headers=headers) print(response.json()) ``` ```javascript 200 - Website count const url = 'https://api.modulards.com/api/public/v1/sites/count'; const options = {method: 'GET', headers: {Authorization: 'Bearer '}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go 200 - Website count package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.modulards.com/api/public/v1/sites/count" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby 200 - Website count require 'uri' require 'net/http' url = URI("https://api.modulards.com/api/public/v1/sites/count") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body ``` ```java 200 - Website count import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api.modulards.com/api/public/v1/sites/count") .header("Authorization", "Bearer ") .asString(); ``` ```php 200 - Website count request('GET', 'https://api.modulards.com/api/public/v1/sites/count', [ 'headers' => [ 'Authorization' => 'Bearer ', ], ]); echo $response->getBody(); ``` ```csharp 200 - Website count using RestSharp; var client = new RestClient("https://api.modulards.com/api/public/v1/sites/count"); var request = new RestRequest(Method.GET); request.AddHeader("Authorization", "Bearer "); IRestResponse response = client.Execute(request); ``` ```swift 200 - Website count import Foundation let headers = ["Authorization": "Bearer "] let request = NSMutableURLRequest(url: NSURL(string: "https://api.modulards.com/api/public/v1/sites/count")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```