> For the complete documentation index, see [llms.txt](https://merithic.gitbook.io/merithic-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://merithic.gitbook.io/merithic-docs/api-reference/endpoints/version.md).

# POST /version

A cheap check for whether an update exists. Call this before [`/update`](/merithic-docs/api-reference/endpoints/update.md), which is much heavier.

```
POST https://api.merithic.com/version
```

## Request

| Field        | Type             | Required | Description                       |
| ------------ | ---------------- | -------- | --------------------------------- |
| `user_id`    | string or number | yes      | Roblox user ID.                   |
| `product_id` | string           | yes      | Your product's ID.                |
| `key`        | string           | yes      | The buyer's license key.          |
| `current`    | string           | no       | The version label you're holding. |

```json
{
  "user_id": "123456789",
  "product_id": "prod_abc123",
  "key": "the buyer's key",
  "current": "1.4.0"
}
```

## Response

```json
{
  "ok": true,
  "latest": "1.4.2",
  "update": true,
  "fileId": "..."
}
```

| Field    | Description                                               |
| -------- | --------------------------------------------------------- |
| `latest` | The newest version label the seller has published.        |
| `update` | `true` when `latest` differs from the `current` you sent. |
| `fileId` | Identifier for the stored build.                          |

Omitting `current` means `update` reflects only that a version exists.

## Examples

{% tabs %}
{% tab title="Luau (server)" %}

```lua
local HttpService = game:GetService("HttpService")

local PRODUCT_ID = "prod_abc123"
local KEY = "the buyer's key"
local INSTALLED = "1.4.0" -- bump this when you apply an update

local function checkForUpdate(userId: number)
	local ok, raw = pcall(function()
		return HttpService:PostAsync(
			"https://api.merithic.com/version",
			HttpService:JSONEncode({
				user_id = tostring(userId),
				product_id = PRODUCT_ID,
				key = KEY,
				current = INSTALLED,
			}),
			Enum.HttpContentType.ApplicationJson
		)
	end)
	if not ok then return false, INSTALLED end

	local res = HttpService:JSONDecode(raw)
	return res.update == true, res.latest
end

local hasUpdate, latest = checkForUpdate(123456789)
if hasUpdate then
	print(("Updatr: %s available (running %s)"):format(latest, INSTALLED))
end
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
async function checkForUpdate({ userId, productId, key, current }) {
  const res = await fetch("https://api.merithic.com/version", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({
      user_id: String(userId),
      product_id: productId,
      key,
      current,
    }),
  });

  const body = await res.json();
  if (!body.ok) return { update: false };

  return { update: body.update === true, latest: body.latest };
}
```

{% endtab %}

{% tab title="curl" %}

```bash
curl -X POST https://api.merithic.com/version \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": "123456789",
    "product_id": "prod_abc123",
    "key": "the buyers key",
    "current": "1.4.0"
  }'
```

{% endtab %}
{% endtabs %}

## When to call it

Once on server start is usually right. It's cheap, but calling it per-player on a busy game will hit the rate limit for no benefit. Check once, cache the answer, and act on it.

## See also

{% content-ref url="/pages/CX3qolbkrLEBVX5AwLlq" %}
[POST /update](/merithic-docs/api-reference/endpoints/update.md)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://merithic.gitbook.io/merithic-docs/api-reference/endpoints/version.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
