---
title: "List sites"
method: GET
path: "/api/v1/sites"
tags: ["Sites"]
---

# List sites

`GET /api/v1/sites`

## Request

- Base URL: `https://app.scanopy.net`
- URL: `https://app.scanopy.net/api/v1/sites`
- Auth: one of:
  - API key in header `Authorization`
  - API key in cookie `session_id`

## Query parameters

- `credential_ids` string[], nullable
- `effective_stale_after_hours` integer[], nullable
- `tag_ids` string[], nullable
- `tag_sets` string[], nullable
- `search` string, nullable
- `group_by` 'created_at' | 'name' | 'updated_at' | 'effective_stale_after_hours': Fields the sites list can be ordered and grouped by.
- `order_by` 'created_at' | 'name' | 'updated_at' | 'effective_stale_after_hours': Fields the sites list can be ordered and grouped by.
- `group_by_tag_group` string, uuid, nullable
- `order_by_tag_group` string, uuid, nullable
- `order_direction` 'asc' | 'desc': Direction for ORDER BY clauses.
- `limit` integer, nullable
- `offset` integer, nullable

## Response `200`

List of sites

- object: Response type for paginated list endpoints (pagination is always present in meta)
  - `data` object[], required: The page of results. Empty when nothing matched the query.
    - `credential_ids` string[], nullable: Credential IDs assigned to this site (hydrated from the junction table, so always present in a response). On create, omitting it assigns the organization's site-wide default credentials and a list, even an empty one, is used exactly. On update, omitting it leaves the assignments unchanged.
    - `name` string, required: Human-facing name for this site.
    - `organization_id` string, uuid, required: The organization that owns this record.
    - `stale_after_hours` integer, nullable, required: How long a discovery-managed entity on this site may go unobserved before it reads as stale. `None` = unset; callers resolve the effective value through [`Site::stale_after`], never by reading this directly. Site-scoped because staleness is only meaningful relative to scan cadence, and cadence is a property of a site's discoveries.
    - `tags` string[], required: Tags assigned to this entity.
    - `created_at` string, date-time, required: When this record was first created.
    - `effective_stale_after_hours` integer: `stale_after_hours` with the server's default already applied. Computed, never stored (excluded from `to_params`). Published so the frontend derives staleness from the *same* number the digest uses rather than re-declaring the default in TypeScript, where the two could drift and a host could read stale in the app but current in the digest email.
    - `id` string, uuid, required: Server-assigned unique identifier.
    - `updated_at` string, date-time, required: When this record was last modified.
  - `error` string, nullable: Human-readable failure message. Omitted on success.
  - `meta` PaginatedApiMeta, required: API metadata for paginated list responses (pagination is always present)
    - `api_version` integer, required: API version (integer, increments on breaking changes)
    - `pagination` PaginationMeta, required: Pagination metadata returned with paginated responses.
      - `group_counts` GroupCount[], nullable: Size of every group, in the same order the rows are grouped, when the request specified a `group_by`. Lets a paginated client show a group's true size instead of the slice of it that happens to be on this page. Absent when the list isn't grouped.
        - `count` integer, required: How many rows fall in this group in total, not just on this page.
        - `value` string, nullable: The group's value, rendered as text. `null` for rows whose group key is NULL (the "ungrouped" bucket).
      - `has_more` boolean, required: Whether there are more items after this page
      - `limit` integer, required: Maximum items per page (as requested)
      - `offset` integer, required: Number of items skipped
      - `total_count` integer, required: Total number of items matching the filter (ignoring pagination)
    - `server_version` string, required: Server version (semver)
  - `success` boolean, required: `true` when the request succeeded. `false` responses carry `error` instead of `data`.

## Changes

- **2026-10-26** `c9d9d46d1ae8`: 1 info
  - api operation id `get_all_sites` removed and replaced with `list_sites`
- **2026-10-23** `c9f50be8bc26`: 10 info
  - added the new optional `query` request parameter `credential_ids`
  - added the new optional `query` request parameter `effective_stale_after_hours`
  - added the new optional `query` request parameter `group_by`
  - added the new optional `query` request parameter `group_by_tag_group`
  - …6 more
- **2026-10-12** `c305a1f5ae29`: 2 breaking
  - the response property `data/items/allOf[#/components/schemas/SiteBase]/credential_ids` became nullable for the status `200`
  - the response property `data/items/allOf[#/components/schemas/SiteBase]/credential_ids` became optional for the status `200`
- **2026-10-11** `a6ea2ab6fbb9`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/scanopy/apis/scanopy-api/changes/api/v1/sites/get.md)

---

[API](https://skmtc.dev/scanopy/apis/scanopy-api.md) - [All operations](https://skmtc.dev/scanopy/apis/scanopy-api/llms.txt) - [OpenAPI document](https://skmtc.dev/scanopy/apis/scanopy-api/revisions/966ba786bdb5?raw)
