<!-- https://developers.silktide.com/guides/add-a-website | Get started -->

# Add a website and read its scores

This guide adds a website to Governance and reads its scores once Silktide has tested it. It uses four operations, in this order.

## 1. Check what you can add

Pages and documents you give a website come out of your account's balance. Ask how much is left:

```bash
curl https://api.eu.silktide.com/v1/balances \
  -H "Authorization: silktide token=$SILKTIDE_API_KEY"
```

`newWebsites` is how many more websites you can add, and `maxPages` and `maxDocuments` are the most pages and PDFs a new website could be given now. `-1` means unlimited. See [Get what the account can still add](https://developers.silktide.com/v1/platform/balances/get-account-balance.md).

## 2. Create the website

Send its name and home page, and always say how many pages and documents to test. Left out, Silktide picks an allocation for you.

```bash
curl https://api.eu.silktide.com/v1/websites \
  -H "Authorization: silktide token=$SILKTIDE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "website": {
      "name": "Fake University",
      "homeUrl": "https://fake-university.example/",
      "maxPages": 100,
      "maxDocuments": 100
    }
  }'
```

The response is the new website. Keep its `websiteId`. Silktide starts testing it straight away.

To change settings before the first test, create it with `"runNow": false` and `"isReady": false`, update it, then [test it](https://developers.silktide.com/v1/governance/websites/test-website.md) when you are ready. See [Set up a website before its first test](https://developers.silktide.com/guides/set-up-a-website-before-its-first-test.md).

## 3. Wait for the first test

A test takes from a few minutes to a few hours, depending on the size of the website. There is no callback yet, so check the website now and then:

```bash
curl https://api.eu.silktide.com/v1/websites/6 \
  -H "Authorization: silktide token=$SILKTIDE_API_KEY"
```

`website.lastTested` is `0` until the first test finishes, and then the time it finished. Checking every few minutes is plenty; checking every second only spends your [rate limit](https://developers.silktide.com/v1/concepts/rate-limits.md).

## 4. Read the scores

```bash
curl "https://api.eu.silktide.com/v1/results/scores?websiteId=6" \
  -H "Authorization: silktide token=$SILKTIDE_API_KEY"
```

```json
{
  "result": {
    "scores": {
      "overall": 80.8,
      "content": 70.1,
      "wcag-22-aa": 97.8,
      "wcag-22-pdf": null
    }
  },
  "selector": "/v1/results/scores",
  "duration": 0.009
}
```

Scores are out of 100. A score Silktide cannot work out for this website, such as PDF accessibility on a website with no PDFs, is `null`. Results queries report some errors with status `200` and an `error` body, so check for `error` before you read `result`; see [Results](https://developers.silktide.com/v1/concepts/results.md).

## Where to go next

- [Get how a score changed over time](https://developers.silktide.com/v1/governance/scores/get-score-trend.md), for charts and alerts.
- [List a website's checks](https://developers.silktide.com/v1/governance/checks/get-checks.md), to see what to fix.
- [Update a website](https://developers.silktide.com/v1/governance/websites/update-website.md), to change its schedule or allocation.
