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

# Custom Response

> Attach custom JSON metadata to validate responses for feature flagging and entitlement delivery.

Custom response lets you attach arbitrary JSON metadata to a product and return it in every validate response. Use it to deliver feature flags, entitlement data, or any other configuration your application needs at runtime.

## Requirements

Custom response is a paid plan feature. Enable it for your product in the KeyPort dashboard.

## The `custom` field

When custom response is enabled and configured, the validate endpoint returns a `custom` field containing your JSON payload:

<ResponseField name="custom" type="object | null">
  A merged JSON object containing product-level metadata and any license-level overrides. Returns `null` if the feature is disabled or the merged object is empty.
</ResponseField>

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "valid": true,
  "custom": {
    "tier": "pro",
    "features": ["exports", "analytics"]
  }
}
```

## How the payload is built

KeyPort merges two sources to produce the `custom` value:

1. **Product template** — the default metadata defined on your product
2. **License override** — optional metadata set on the individual license

When both are present, the license override wins on any conflicting keys. This lets you define a baseline payload at the product level while customizing it per customer.

<Tip>
  Use the product template for defaults that apply to all licenses, and use license overrides only for fields that differ per customer.
</Tip>

## When `custom` is `null`

The `custom` field returns `null` in two cases:

* The custom response feature is disabled for your product
* The merged object is empty after combining the product template and license override

Check for `null` before accessing fields on `custom` in your application code.
