> ## Documentation Index
> Fetch the complete documentation index at: https://docs.teamfortuna.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Game versioning and cache invalidation with Astra

> Use the Astra version endpoint to track Valorant patch updates and determine when to invalidate and refresh your locally cached game asset data.

Valorant receives regular patches that can introduce new agents, weapons, maps, and other assets. If your application caches game data locally, you need a reliable way to know when that data has changed. The Astra version endpoint gives you a lightweight signal you can poll to determine whether your cache is still valid — without re-fetching every asset on every request.

## The version endpoint

Send a `GET` request to `/v1/version` to retrieve the current game version information:

```bash theme={null}
curl https://astra.teamfortuna.xyz/v1/version \
  -H "User-Agent: my-app/1.0.0 (+https://example.com)"
```

Example response:

```json theme={null}
{
  "status": 200,
  "data": {
    "manifestId": "...",
    "branch": "release-10.00",
    "version": "10.00.00.1234567",
    "buildVersion": "22",
    "engineVersion": "4.26.2-...",
    "riotClientVersion": "release-10.00.00.1234",
    "riotClientBuild": "12345678",
    "buildDate": "2025-01-15"
  }
}
```

| Field               | Description                                      |
| ------------------- | ------------------------------------------------ |
| `manifestId`        | Unique identifier for the current game manifest  |
| `branch`            | Release branch name (e.g. `release-10.00`)       |
| `version`           | Full version string — use this to detect changes |
| `buildVersion`      | Incremental build number                         |
| `engineVersion`     | Unreal Engine version used for this build        |
| `riotClientVersion` | Riot Client version string                       |
| `riotClientBuild`   | Riot Client build number                         |
| `buildDate`         | Date the build was published                     |

## Cache invalidation strategy

Poll `/v1/version` periodically and compare the `version` field against the value you stored the last time you fetched asset data. If the value has not changed, your cached data is still valid and you can skip re-fetching. If it has changed, re-fetch the assets you care about.

```python theme={null}
import requests

CACHED_VERSION = None
CACHED_AGENTS = None

HEADERS = {"User-Agent": "my-app/1.0.0 (+https://example.com)"}
BASE_URL = "https://astra.teamfortuna.xyz"

def get_agents():
    global CACHED_VERSION, CACHED_AGENTS

    version_resp = requests.get(f"{BASE_URL}/v1/version", headers=HEADERS)
    current_version = version_resp.json()["data"]["version"]

    if current_version == CACHED_VERSION and CACHED_AGENTS is not None:
        # Cache is still valid — return stored data
        return CACHED_AGENTS

    # Version changed (or first run) — re-fetch
    agents_resp = requests.get(f"{BASE_URL}/v1/agents", headers=HEADERS)
    CACHED_AGENTS = agents_resp.json()["data"]
    CACHED_VERSION = current_version

    return CACHED_AGENTS
```

<Tip>
  Cache expensive resources like agents, weapons, and maps locally and only invalidate when the `version` field changes. This reduces latency and avoids unnecessary load on the API.
</Tip>

## Health check

Before making requests in a new environment or after a deployment, you can verify the API is ready by calling `/v1/health`:

```bash theme={null}
curl https://astra.teamfortuna.xyz/v1/health \
  -H "User-Agent: my-app/1.0.0 (+https://example.com)"
```

A successful response indicates the API is operational and ready to serve requests. Use this endpoint in health probes or startup checks rather than hitting a data endpoint.
