# Requests and responses

## Content type

Send JSON bodies with `Content-Type: application/json`, and request JSON with `Accept: application/json`.

Most responses are JSON. Successful PDF and CSV download endpoints return file bytes instead, and successful deletion returns an empty `204` response. Do not call a JSON parser on those responses.

## Resource wrapping

### Single resources

Single resources use a `data` wrapper:

```json
{
  "data": {
    "uuid": "9d4e2c8f-1234-4678-9abc-def012345678",
    "name": "Example"
  }
}
```

`GET /me` returns both `data.user` and `data.teams`. `GET /teams` returns a non-paginated `data` array. Check-run creation returns an array of check records in `data`.

### Paginated collections

Paginated collections include `data`, navigation `links`, and `meta`. This abbreviated example shows the main pagination fields:

```json
{
  "data": [],
  "links": {
    "first": "https://app.sitepulse.dev/api/v1/teams/9d4e2c8f-1234-4678-9abc-def012345678/sites?page=1",
    "last": "https://app.sitepulse.dev/api/v1/teams/9d4e2c8f-1234-4678-9abc-def012345678/sites?page=1",
    "prev": null,
    "next": null
  },
  "meta": {
    "current_page": 1,
    "from": null,
    "last_page": 1,
    "per_page": 25,
    "to": null,
    "total": 0
  }
}
```

## Identifiers

Use the `uuid` string returned by Sitepulse in route placeholders. Treat it as opaque: do not substitute a numeric `id`, construct an identifier yourself, or assume a particular UUID format.

| Resource | Example route |
|----------|---------------|
| Team | `/teams/{team-uuid}` |
| Site | `/sites/{site-uuid}` |
| Check | `/checks/{check-uuid}` |
| Issue | `/issues/{issue-uuid}` |
| Report schedule | `/reports/{report-profile-uuid}` |
| Report run | `/report-runs/{report-run-uuid}` |

Labels in braces are placeholders to replace, not literal path segments. Get team identifiers from `GET /teams`, and site, check, issue, and report identifiers from their corresponding responses.

## Team context

The team in the route, or the team owning the referenced resource, determines access and plan limits. You do not need to switch teams in the dashboard or send a separate team header.

For `GET /issues`, `team={team-uuid}` filters to one eligible team. Without it, the endpoint includes teams the account may view and whose access is active.

## Pagination

Paginated list endpoints accept `page` (minimum 1) and `per_page` (1–100, default 25). Keep your filters when requesting another page.

Replace `TEAM_UUID` and `YOUR_TOKEN` in this example:

```bash
curl --fail-with-body -sS \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Accept: application/json" \
  "https://app.sitepulse.dev/api/v1/teams/TEAM_UUID/sites?page=2&per_page=50"
```

For boolean query parameters such as `pinned` and `automatic`, use `1` or `0`. JSON request bodies use the JSON booleans `true` and `false`.

## Timestamps

Resource timestamps such as `created_at`, `completed_at`, and `resolved_at` are ISO 8601 strings in UTC, or `null` when not set. For example: `2026-05-28T14:32:10+00:00`.

Dates inside a check's `result` can use another documented format. SSL `valid_from` and `valid_to`, for example, use `YYYY-MM-DD HH:MM:SS` without an offset. See [check results](/docs/api/check-results/).

## HTTP status codes

| Code | Meaning |
|------|---------|
| `200` | Success. |
| `201` | Site created. |
| `202` | Check accepted; inspect the returned check status. |
| `204` | Success with no body, such as deletion. |
| `401` | Missing, invalid, expired, or revoked token. |
| `402` | The selected team lacks active trial or subscription access. |
| `403` | Missing scope, role permission, email verification, or feature access. |
| `404` | Resource unavailable or outside the account's team access. |
| `422` | Invalid input or a check cannot currently run. |
| `429` | Too many requests. |

## Inactive team access (402)

An expired trial on a protected route can return:

```json
{
  "message": "Your trial has ended. Subscribe to resume monitoring."
}
```

Other inactive states use `An active team subscription is required.` The team owner must subscribe or resolve billing in the app. See [access exceptions](/docs/api/authentication/#team-access-and-billing).

## Validation errors (422)

Inspect `errors` for field-level messages:

```json
{
  "message": "The url field is required.",
  "errors": {
    "url": ["The url field is required."]
  }
}
```

Common causes include duplicate site URLs, site or on-demand check limits, an invalid cadence, disabled API check tools, a pending check, or invalid filters. Changing an existing monitored URL is also rejected.

## Authorization and unavailable resources

Foreign team resources are hidden with `404`. A missing scope or permission can return `403` even when the resource exists. Input validation can return `422` for an unknown filter value before the resource query runs.

## Rate limits

The v1 API allows **60 requests per minute per authenticated user**, shared across that user's tokens. Check creation at `POST /sites/{site}/checks` also has a **10 requests per minute** limit per user.

API check runs additionally enforce a per-site, per-tool cadence. A request can return `422` for that cadence before it reaches the request-rate limit.

On `429`, respect the `Retry-After` header. Space out polling rather than retrying immediately.

## Check tools and statuses

Tool values are `status`, `ssl`, `dns`, `broken-links`, and `performance`.

| Check status | Meaning |
|--------------|---------|
| `pending` | Queued or running. |
| `completed` | Execution completed; inspect `result` to decide whether the site is healthy. |
| `failed` | Execution failed; inspect `error` and any result. |
| `skipped` | The check did not run. This is also terminal. |

A completed HTTP check can still report `up: false`. Completion describes execution, not site health. Poll only while the status is `pending`.

## Issue monitoring and workflow states

The `status` field is `open`, `acknowledged`, or `resolved`. `status=active` includes the first two, even when someone closed or ignored the issue in the dashboard. `acknowledged` remains a response value for existing records; the current dashboard uses the workflow actions below.

`workflow_status` is `open`, `closed`, or `ignored`. Use `view=open`, `view=closed`, or `view=ignored` to match dashboard views; `view=all` removes the workflow filter. When you send `view` without `status`, the default active-status filter is not applied. Sending both intersects the filters.

`needs_attention` identifies an active issue that has not been closed or ignored. `is_active` alone does not capture that workflow decision.

Issue severities are `critical`, `warning`, or `info`. Issue mutations are available in the app; the API is read-only for issues.

## Related references

- [API examples](/docs/api/overview/)
- [Resource reference](/docs/api/resources/)
- [Endpoints](/docs/api/endpoints/)
