<!-- Generated from the operation definitions by `pnpm docs:reference`. Do not edit by hand. -->

# Check an address: `check_address`

Checks a UK address and returns it as it will print, or close matches if it is not found. Free. quote_letter runs the same check, so use this when you are unsure of an address. In test mode, postcodes TEST 01 to TEST 13 rehearse outcomes.

| | |
|---|---|
| MCP tool | `check_address` |
| REST | `POST /v1/addresses/check` |
| CLI | `atomside check-address` |
| Key needs | Read (`letters:read`) |
| Changes anything | No. It only reads. |
| Idempotency key | Not used. |

## Example

A real call and its real answer, made against the API in test mode. A test runs it again and fails if the answer changes. Ids, keys and links are replaced with stand-ins.

### A call that works

REST:

```sh
curl -X POST https://api.atomside.com/v1/addresses/check \
  -H "Authorization: Bearer $ATOMSIDE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "line1": "12 Specimen Road",
  "town": "Exampleton",
  "postcode": "xx11xx"
}'
```

MCP:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "check_address",
    "arguments": {
      "line1": "12 Specimen Road",
      "town": "Exampleton",
      "postcode": "xx11xx"
    }
  }
}
```

CLI:

```sh
atomside check-address \
  --line1 '12 Specimen Road' \
  --town Exampleton \
  --postcode xx11xx
```

The answer (HTTP 200; over MCP, the same JSON is the result's `structuredContent`):

```json
{
  "status": "corrected",
  "test": false,
  "address": {
    "lines": [
      "12 Specimen Road"
    ],
    "town": "Exampleton",
    "postcode": "XX1 1XX"
  },
  "prints_as": [
    "12 Specimen Road",
    "Exampleton",
    "XX1 1XX"
  ],
  "changes": [
    "Postcode as XX1 1XX"
  ],
  "matches": [],
  "says": "Found. It prints as 12 Specimen Road, Exampleton, XX1 1XX. We changed: Postcode as XX1 1XX.",
  "next": "Call quote_letter with this address."
}
```

## Input

Over REST, fields in the path go in the path, GET fields in the query string, and POST fields in the JSON body. Over MCP, every field is an argument of the tool.

```json
{
  "type": "object",
  "properties": {
    "line1": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100
    },
    "line2": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100
    },
    "line3": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100
    },
    "town": {
      "type": "string",
      "minLength": 1,
      "maxLength": 60
    },
    "postcode": {
      "type": "string",
      "minLength": 2,
      "maxLength": 10
    },
    "country": {
      "type": "string",
      "minLength": 1,
      "maxLength": 60
    }
  },
  "required": [
    "line1",
    "postcode"
  ],
  "additionalProperties": false
}
```

## Output

```json
{
  "type": "object",
  "properties": {
    "status": {
      "type": "string",
      "enum": [
        "valid",
        "corrected",
        "not_found",
        "ambiguous"
      ],
      "description": "valid: right as sent. corrected: found, written differently. Otherwise not usable."
    },
    "test": {
      "type": "boolean",
      "description": "True for a TEST postcode: nothing is looked up."
    },
    "address": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "lines": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "town": {
              "type": "string"
            },
            "postcode": {
              "type": "string"
            }
          },
          "required": [
            "lines",
            "town",
            "postcode"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ],
      "description": "The address as it will print. Null unless found."
    },
    "prints_as": {
      "anyOf": [
        {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        {
          "type": "null"
        }
      ]
    },
    "changes": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "What we changed from what you sent."
    },
    "matches": {
      "type": "array",
      "items": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "description": "Close matches. Use one only if it is clearly the same place."
    },
    "says": {
      "type": "string",
      "description": "A sentence to repeat to your person as it stands."
    },
    "next": {
      "type": "string"
    }
  },
  "required": [
    "status",
    "test",
    "address",
    "prints_as",
    "changes",
    "matches",
    "says",
    "next"
  ],
  "additionalProperties": false
}
```

## Refusals

Every refusal has the same shape. Branch on `code`, `answer` and `retry`; repeat `say` to your person.

| Code | Answer | Retry | HTTP | What to do next |
|---|---|---|---|---|
| [`key_missing`](../refusals.md#key_missing) | no | after_fix | 401 | Send the key as "Authorization: Bearer as_test_…". Ask your person if you have none. |
| [`key_not_valid`](../refusals.md#key_not_valid) | no | never | 401 | Ask your person for a new key. There is no link: we cannot say whose it was. |
| [`scope_missing`](../refusals.md#scope_missing) | no | after_person | 403 | Ask your person to give the key that permission. |
| [`invalid_request`](../refusals.md#invalid_request) | no | after_fix | 400 | Fix the field named in details.field. The same idempotency key is fine. |
| [`rate_limited`](../refusals.md#rate_limited) | no | at_time | 429 | Wait. The same idempotency key never sends twice. |
| [`try_again_shortly`](../refusals.md#try_again_shortly) | no | at_time | 503 | Try again after retry_after with the same idempotency key. |
| [`account_expired`](../refusals.md#account_expired) | no | never | 401 | Start again with start_account if your person still wants this. |
| [`connection_ended`](../refusals.md#connection_ended) | no | after_person | 401 | Tell your person. To carry on, they connect Atomside again in your assistant. |
| [`address_not_uk`](../refusals.md#address_not_uk) | no | never | 422 | Tell your person. We cannot post this letter. |
| [`test_postcode_in_live`](../refusals.md#test_postcode_in_live) | no | after_fix | 422 | Use the real address. Rehearse outcomes with a test key. |
| [`unclaimed_limit_reached`](../refusals.md#unclaimed_limit_reached) | no | after_person | 403 | Pass on tell_your_person from start_account, or new_claim_link. Claiming lifts the limit. |
| [`not_found`](../refusals.md#not_found) | no | after_fix | 404 | Check the name against the tool list or /v1/openapi.json. |
