---
title: Get Layer Parameters
description: Fetches parameter values from a layer. Layers allow you to share parameters across multiple experiments. Automatically logs exposure events.
product: general
token_estimate: 1608
---
# Get Layer Parameters

> For AI agents: a documentation index is available at [/llms.txt](/llms.txt). Append `.md` to any page URL for markdown, or send `Accept: text/markdown`.

## Get Layer Parameters

**POST** `/v1/get_layer`

Full URL: `https://api.statsig.com/v1/get_layer`

**Servers:**
- SDK API Server: `https://api.statsig.com/v1/get_layer`
- Events API Server: `https://events.statsigapi.net/v1/get_layer`

Get Layer Parameters

Fetches parameter values from a layer. Layers allow you to share parameters across multiple experiments. Automatically logs exposure events.

## Authorizations

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| statsig-api-key | string | Yes | — | SDK API key (Server Secret or Client SDK Key) |

## Body (application/json)

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| layerName | string | Yes | — | Name of the layer |
| user | object | No | — | User object containing identification and attributes for evaluation. At minimum, provide at least one identifier. |
| user.userID | string | No | user-123 | Primary user identifier |
| user.email | string | No | user@example.com | User email address Constraints: format: email |
| user.ip | string | No | 192.168.1.1 | User IP address for geo-targeting |
| user.userAgent | string | No | Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 | User agent string for device/browser targeting |
| user.country | string | No | US | 2-letter country code (ISO 3166-1 alpha-2) |
| user.locale | string | No | en_US | Locale/language code |
| user.appVersion | string | No | 1.2.3 | Application version |
| user.custom | object | No | {"subscription_plan":"premium","account_age_days":45,"is_beta_tester":true} | Custom user attributes for targeting (string, number, boolean, or array of strings) |
| user.privateAttributes | object | No | {"internal_user_id":"12345"} | Private attributes used for evaluation but not logged to analytics |
| user.customIDs | object | No | {"companyID":"company-456","deviceID":"device-789"} | Additional custom identifier mappings |
| user.statsigEnvironment | object | No | — | Environment tier for targeting |
| user.statsigEnvironment.tier | string | No | — | Environment tier Allowed values: production, staging, development |
| statsigMetadata | object | No | {"sdkType":"js-client","sdkVersion":"4.20.0","exposureLoggingDisabled":false} | SDK metadata for tracking SDK type, version, and other diagnostic information |
| statsigMetadata.sdkType | string | No | — | SDK type sending the request (e.g., js-client) |
| statsigMetadata.sdkVersion | string | No | — | SDK version |
| statsigMetadata.exposureLoggingDisabled | boolean | No | — | When true, prevents the HTTP API from automatically logging exposures. Use this only if you will handle exposure logging yourself. |

## Response (application/json)

**200** — Layer parameter values

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| name | string | Yes | — | Layer name |
| value | object | Yes | — | Layer parameter values |
| ruleID | string | No | — | ID of the rule that was evaluated |
| allocatedExperimentName | string | No | — | Name of the experiment this layer is allocated to (if any) |

```json
{
  "name": "product_page_layer",
  "value": {
    "add_to_cart_color": "blue",
    "price_format": "compact",
    "show_reviews": true
  },
  "ruleID": "rule_abc123",
  "allocatedExperimentName": "add_to_cart_experiment"
}
```

**404** — Layer not found

## Code samples

### cURL

```bash
curl -X POST "https://api.statsig.com/v1/get_layer" \
  -H "Content-Type: application/json" \
  -H "statsig-api-key: YOUR_API_KEY" \
  -d '{
  "layerName": "product_page_layer",
  "user": {
    "userID": "user-123"
  }
}'
```

### Python

```python
import requests

response = requests.post(
    "https://api.statsig.com/v1/get_layer",
    headers={
        "Content-Type": "application/json",
        "statsig-api-key": "YOUR_API_KEY"
    },
    json={
  "layerName": "product_page_layer",
  "user": {
    "userID": "user-123"
  }
}
)
data = response.json()
```

### JavaScript

```javascript
const response = await fetch("https://api.statsig.com/v1/get_layer", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "statsig-api-key": "YOUR_API_KEY"
  },
  body: JSON.stringify({
  "layerName": "product_page_layer",
  "user": {
    "userID": "user-123"
  }
})
});
const data = await response.json();
```

### PHP

```php
<?php
$ch = curl_init("https://api.statsig.com/v1/get_layer");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Content-Type: application/json",
    "statsig-api-key: YOUR_API_KEY"
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$body = json_encode({
  "layerName": "product_page_layer",
  "user": {
    "userID": "user-123"
  }
});
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
$response = curl_exec($ch);
curl_close($ch);
```

### Go

```go
package main

import (
  "bytes"
  "net/http"
)

func main() {
body := []byte("{\"layerName\":\"product_page_layer\",\"user\":{\"userID\":\"user-123\"}}")
req, _ := http.NewRequest("POST", "https://api.statsig.com/v1/get_layer", bytes.NewReader(body))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("statsig-api-key", "YOUR_API_KEY")
  client := &http.Client{}
  resp, _ := client.Do(req)
  defer resp.Body.Close()
}
```

### Java

```java
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
      .uri(URI.create("https://api.statsig.com/v1/get_layer"))
      .method("POST", HttpRequest.BodyPublishers.ofString("{\"layerName\":\"product_page_layer\",\"user\":{\"userID\":\"user-123\"}}"))
.header("Content-Type", "application/json")
      .header("statsig-api-key", "YOUR_API_KEY")
      .build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
```

### Ruby

```ruby
require "net/http"
require "json"

uri = URI("https://api.statsig.com/v1/get_layer")
request = Net::HTTP::Post.new(uri)
request["Content-Type"] = "application/json"
request["statsig-api-key"] = "YOUR_API_KEY"
request.body = "{\"layerName\":\"product_page_layer\",\"user\":{\"userID\":\"user-123\"}}"
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
  http.request(request)
end
```

