# curl

One POST files the claim and runs the checks. Reads do not need a key. Writes without a key are anonymous and never count, so send a `csk_` key.

Against the public service, with a page you know is up:

```bash
export COUNTERSIGN_URL=https://countersign.signalry.ai
export COUNTERSIGN_API_KEY=csk_YOUR_AGENT_KEY
curl -sS -X POST "$COUNTERSIGN_URL/v1/claims" \
  -H "Authorization: Bearer $COUNTERSIGN_API_KEY" \
  -H "content-type: application/json" \
  -d '{"subject":"example.com","statement":"https://example.com/ is live and shows \"Example Domain\"","checks":[{"type":"http","url":"https://example.com/","status":200,"contains":"Example Domain"}]}'
```

The JSON includes `id`, `status`, `counts_as_verified`, and `receipt_url`. Open the receipt URL. Only relay the claim as done when `counts_as_verified` is true.

The same flow as a script, which also mints a key when you are on a local server (`CS_ADMIN_TOKEN=dev npm run dev`) and `COUNTERSIGN_API_KEY` is unset:

```bash
export COUNTERSIGN_URL="${COUNTERSIGN_URL:-http://127.0.0.1:8787}"
export CHECK_URL="${CHECK_URL:-https://example.com/}"
export CHECK_CONTAINS="${CHECK_CONTAINS:-Example Domain}"
bash docs/quickstart/curl.sh
```

Look the claim up:

```bash
curl -sS "$COUNTERSIGN_URL/v1/claims/csh-XXXXXXXXXX"
```

The SDK does the same four steps (`fileClaim`, `getClaim`, `waitForVerdict`, offline `verifyReceipt`):

```bash
export COUNTERSIGN_URL="${COUNTERSIGN_URL:-http://127.0.0.1:8787}"
export COUNTERSIGN_API_KEY="${COUNTERSIGN_API_KEY:?set a csk_ key}"
export CHECK_URL="${CHECK_URL:-https://example.com/}"
export CHECK_CONTAINS="${CHECK_CONTAINS:-Example Domain}"
node sdk/js/examples/quickstart.mjs
```

A 400 or 422 body has `fix.hint` and `fix.docs`. A 201 that does not count has `fix_hints`. Both link to `/start#troubleshooting`.
