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

# API reference

> The Gamavas Pass HTTP API: sign-in, the game API, the server API and webhooks.

The SDKs wrap all of this. Use the API directly from your own server, or from any language without an SDK.

```text Base URL theme={"theme":{"light":"github-light","dark":"github-dark"}}
https://gamavas.fun/api
```

The same reference as an OpenAPI 3.1 document, for API tools and client generators, is at [`https://gamavas.fun/api/pass/v1/openapi.json`](https://gamavas.fun/api/pass/v1/openapi.json).

## Three kinds of calls

> [card] Sign-in
>
> OAuth 2.1 and OpenID Connect, under `/auth/oauth2/…`. PKCE (S256) is required. The SDKs do this for you.

> [card] Game API
>
> Called by your game with the player's **access token**. Achievements, level and ownership.

> [card] Server API
>
> Called by your server with a **secret key**. Verify players, check ownership, unlock any achievement.

## Authentication

> [tab] Player access token
>
> The token your game gets when the player signs in, sent as a bearer token:
>
> ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
> curl https://gamavas.fun/api/pass/v1/me \
>   -H "Authorization: Bearer <access token>"
> ```
>
> Access tokens are short-lived (the token response's `expires_in` says for how long). The SDKs refresh them for you with the refresh token, which rotates on every use. `/me` and the achievement endpoints need the `progress` scope; the SDKs ask for it.

> [tab] Secret key
>
> Create one on your app's **Keys** page in the developer portal. Keep it on your server:
>
> ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
> curl -X POST https://gamavas.fun/api/pass/v1/server/players/verify \
>   -H "Authorization: Bearer gmv_sk_live_…" \
>   -H "Content-Type: application/json" \
>   -d '{ "accessToken": "<the player'\''s access token>" }'
> ```
>
> > [!WARNING]
> >
> > Gamavas refuses secret keys sent from a browser (any request with an `Origin` header). A key in a web page is a leaked key: revoke it in the portal and create a new one.
>
> A **test key** (`gmv_sk_test_…`) sees only test purchases, and a **live key** (`gmv_sk_live_…`) only real ones.

## Errors

Errors are JSON with a human-readable message:

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{ "error": "That player hasn't connected your game." }
```

| Status | Meaning |
| - | - |
| `400` | The request is missing something, for example the body |
| `401` | A missing, expired or revoked token, or an invalid secret key |
| `403` | Not allowed: a server-only achievement, a missing scope, or a secret key sent from a browser |
| `404` | Unknown achievement, or a player who hasn't connected your game |
| `429` | Too many requests. Slow down and retry |

## Webhooks

Gamavas can call your server when a player buys your game, gets a refund, loses access or unlocks an achievement. Add an endpoint on your app's **Webhooks** page. Each request is a signed `POST`:

```text Gamavas-Signature theme={"theme":{"light":"github-light","dark":"github-dark"}}
t=1764583200,v1=5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bd
```

`v1` is the hex HMAC-SHA256 of `<t>.<raw body>` with your endpoint's `whsec_` secret. Refuse requests older than 5 minutes. Answer any `2xx` within 10 seconds; otherwise Gamavas retries after 1 minute, 5 minutes, 30 minutes, then 2, 6 and 12 hours. The event `id` stays the same on every retry, so skip IDs you've already handled. Each event's fields are under **Webhooks** in the menu.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.