# Thran Foundry Ask API

Thran Foundry is a Magic: The Gathering shop in Wrenmouth. This API answers questions about the shop: singles prices, buylist offers, stock, house rules, events and shipping. No account or API key is needed.

## Any question: `GET https://thranfoundry.com/ask`

```sh
curl --fail-with-body -sS --max-time 60 -G 'https://thranfoundry.com/ask' \
  --data-urlencode 'q=How much store credit do you pay for a Rhystic Study?'
```

| Parameter | Required | Meaning |
| --- | --- | --- |
| `q` | yes | The user's question, 3 to 500 characters |
| `session` | no | The `session` value from a previous response; pass it on every follow-up so earlier questions are taken into account |
| `page` | no | Path of the page the question came from, such as `/buylist.html` |

A successful response is HTTP 200 with JSON:

```json
{
  "answer": "…",
  "session": "k7q2mx9p",
  "next": "For a follow-up question call https://thranfoundry.com/ask?q=<question>&session=k7q2mx9p"
}
```

Use `answer` in your reply. For a follow-up, call the endpoint again with the same `session`.

## Ready-made questions: `GET https://thranfoundry.com/ask/...`

If your fetch tool can only open URLs it has already seen, start at <https://thranfoundry.com/ask> and follow links: question type, then card, country or event, then condition. Each page answers one question and links to related ones; every link already carries your session.

Question types: price of a card, what we pay for a card, stock, whether a card is legal at Tuesday Commander night, shipping to a country, events.

## Errors and limits

| Status | Meaning |
| --- | --- |
| `400` | `q` or `session` is malformed |
| `429` | Too many questions; wait a minute (`Retry-After`) |
| `502` | The answer service is unavailable; try again later |
