# Get remote config

> Fetch the project's SDK settings and running experiments, which a game server applies without being republished.

Returns the settings a game server should run with: how often to flush, which kinds of events to send, the configured currencies, whether the Cmdr bridge is on, and every running experiment with its variants.

These come from the project's **SDK** page, under **Configuration**, and from the experiments you start. Changing them there takes effect in live servers the next time they fetch this endpoint, with no republish. See [Remote configuration](https://docs.bloxlytics.app/sdk/remote-config).

The Luau SDK fetches it once when it starts and then every 300 seconds. Authenticate with the project's **write key**; see [Authentication](https://docs.bloxlytics.app/api/authentication).

## Headers

- `Authorization` (string, header, required): `Bearer ` followed by the project's write key, `bxw_…`.

- `X-Bloxlytics-Project` (string, header, required): The experience's Universe ID (`game.GameId`). Legacy UUID project IDs are also accepted.

This endpoint takes no query parameters and no body. It's limited to 2,000 requests a minute per project.

## Response

`200 OK` with the current settings. Fields not saved in the project yet have their defaults.

- `flushIntervalSeconds` (integer, required, default 10): How often, in seconds, the server should send queued events. From 2 to 60.

- `maxBatchSize` (integer, required, default 200): The most events to send in one [ingest](https://docs.bloxlytics.app/api/ingest/send-events) request. From 10 to 500. The SDK also flushes early when this many events are queued.

- `trackSessions` (boolean, required, default true): Whether to send `$session_start` and `$session_end`. When `false`, the API also discards them.

- `trackEconomy` (boolean, required, default true): Whether to send `$economy`, `$economy_transfer` and `$balance`. When `false`, the API also discards them.

- `trackPurchases` (boolean, required, default true): Whether to send `$purchase`. When `false`, the API also discards it.

- `trackCustomEvents` (boolean, required, default true): Whether to send custom events. When `false`, the API also discards them.

- `blockedEvents` (string[], required, default []): Custom event names not to send, matched exactly. Up to 100 names. The API discards them too.

- `currencies` (string[], required, default []): The keys of the configured currencies, up to 20. When the list isn't empty, economy events in any other currency are discarded (the match ignores case). When it's empty, any currency is accepted.

- `bridgeEnabled` (boolean, required, default true): Whether the Cmdr bridge is turned on for the project. The bridge itself reads this from [`POST /v1/bridge/hello`](https://docs.bloxlytics.app/api/bridge/hello), which returns the same setting as `enabled`.

- `experiments` (Experiment[], required): Experiments that are running now: status **running**, started (or with no start time), and not yet ended (or with no end time). Drafts, stopped experiments and experiments outside their schedule aren't listed. Empty when none are running.  **Experiment**
  
  - `key` (string, required): The experiment key, as used in `Analytics:GetVariant(player, key)` and in `$experiment_exposure`.
  
  - `allocation` (integer, required): The percentage of players in the experiment, from 1 to 100. The rest get no variant.
  
  - `variants` (Variant[], required): The variants, in order.  **Variant**
    
    - `key` (string, required): The variant key, 1 to 32 letters, digits, `_` or `-`.
    
    - `weight` (integer, required): The variant's relative weight, from 1 to 100.
    
    - `config` (object, required): Flat values the game reads for this variant, such as `{ "StartingCoins": 500 }`. Keys up to 40 characters; values are strings (up to 256 characters), numbers or booleans.

## Assigning variants

Assignment happens in the game server, from `experiments`, without another request. It is deterministic, so a player gets the same variant on every server, and Bloxlytics computes the same answer when it analyses results. Both sides use 32-bit FNV-1a over the bytes of a string (experiment keys and user ids are plain ASCII):

1. `bucket = fnv1a("<experiment key>:<user id>") % 10000`. If `bucket >= allocation * 100`, the player isn't in the experiment.
2. Otherwise, `pick = fnv1a("<experiment key>:variant:<user id>") % <sum of weights>`.
3. Walk the variants in order, adding up their weights. The first variant where `pick` is less than the running total is the player's.

FNV-1a here starts from `0x811c9dc5` and multiplies by the prime `0x01000193`, modulo 2³². `<user id>` is the decimal user id with no separators. If you write your own client, send `$experiment_exposure` the first time a player is given a variant, once per session, so the experiment's results include them. See [Experiments](https://docs.bloxlytics.app/sdk/experiments).

## How the SDK applies it

The Luau SDK copies every field of the response over its own settings. Values from this endpoint therefore replace the `FlushInterval` and `MaxBatchSize` you pass to `Analytics:Start`, from the first successful fetch onwards.

If the request fails, the SDK keeps the settings it already has (its built-in defaults, before the first success) and tries again at the next refresh. Tracking switches and blocked events are applied in the server before events are queued, and again by the API while it processes batches. Shortly after you change a setting, events it turns off are discarded even from servers still running the old settings.

**Request example**

```bash cURL
curl https://api.bloxlytics.app/v1/config \
  -H "Authorization: Bearer bxw_…" \
  -H "X-Bloxlytics-Project: <universe id>"
```

```luau Luau
local HttpService = game:GetService("HttpService")

local response = HttpService:RequestAsync({
	Url = "https://api.bloxlytics.app/v1/config",
	Method = "GET",
	Headers = {
		["Authorization"] = HttpService:GetSecret("bloxlytics_write_key"):AddPrefix("Bearer "),
		["X-Bloxlytics-Project"] = string.format("%d", game.GameId),
	},
})
local config = HttpService:JSONDecode(response.Body)
```

**Response example**

```json 200
{
  "flushIntervalSeconds": 10,
  "maxBatchSize": 200,
  "trackSessions": true,
  "trackEconomy": true,
  "trackPurchases": true,
  "trackCustomEvents": true,
  "blockedEvents": ["DebugPing"],
  "currencies": ["Coins", "Gems"],
  "bridgeEnabled": true,
  "experiments": [
    {
      "key": "starter-pack",
      "allocation": 50,
      "variants": [
        { "key": "control", "weight": 50, "config": { "StartingCoins": 100 } },
        { "key": "generous", "weight": 50, "config": { "StartingCoins": 500 } }
      ]
    }
  ]
}
```

```json 401
{ "error": { "code": "unauthorized", "message": "Missing project id or key." } }
```

```json 429
{ "error": { "code": "rate_limited", "message": "Too many requests." } }
```
