> For the complete documentation index, see [llms.txt](https://docs.nfh.global/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nfh.global/product-documentation/products/discovr/examples.md).

# Examples

Worked discover requests for each search mode.

Worked discover requests for each search mode. Each request body is sent to `POST /discover`.

## 1. Text Search

Search using keywords or natural language queries. DISCOVR supports both simple keyword matching and natural language understanding — you can search the way your users would ask.

### Keyword Search

```json
{
  "context": {
    "version": "2.0.0",
    "action": "discover",
    "messageId": "55555555-5555-5555-5555-555555555555",
    "transactionId": "66666666-6666-6666-6666-666666666666",
    "timestamp": "2026-03-26T11:00:00Z",
    "bapId": "bap.myapp.in",
    "bapUri": "https://bap.myapp.in",
    "networkId": "retail-grocery"
  },
  "message": {
    "intent": {
      "textSearch": "Coffee"
    }
  }
}
```

### Natural Language Search

You can also use natural language queries — the service understands conversational phrasing and extracts the relevant search intent:

```json
{
  "message": {
    "intent": {
      "textSearch": "strong Assam Darjeeling tea for morning chai"
    }
  }
}
```

```json
{
  "message": {
    "intent": {
      "textSearch": "premium instant coffee under 500 rupees"
    }
  }
}
```

The service matches against resource names, descriptions, and domain-specific attributes to find the most relevant results.

## 2. Spatial Search

Find resources available near a location. Uses spatial queries with CQL2-JSON semantics.

```json
{
  "context": {
    "version": "2.0.0",
    "action": "discover",
    "messageId": "bb9f86db-9a3d-4e9c-8c11-81c8f1a7b901",
    "transactionId": "f9d1e7f3-5f1a-4d23-9f10-31b72c0b0c01",
    "timestamp": "2026-03-26T12:00:00Z",
    "bapId": "bap.myapp.in",
    "bapUri": "https://bap.myapp.in",
    "networkId": "retail-grocery"
  },
  "message": {
    "intent": {
      "spatial": [
        {
          "op": "S_DWITHIN",
          "targets": "$.catalogs[*].provider.availableAt[*].geo",
          "geometry": {
            "type": "Point",
            "coordinates": [76.6527, 12.3116]
          },
          "distanceMeters": 1000
        }
      ]
    }
  }
}
```

This finds all resources available within 1 km of the specified coordinates (Mysore in this example).

| Field            | Description                                       |
| ---------------- | ------------------------------------------------- |
| `op`             | Spatial operation — `S_DWITHIN` (within distance) |
| `targets`        | JSONPath to the geo field in the resource         |
| `geometry`       | GeoJSON point with `[longitude, latitude]`        |
| `distanceMeters` | Search radius in meters                           |

## 3. JSONPath Filter

Query resources and offers using JSONPath expressions for fine-grained attribute filtering.

```json
{
  "context": {
    "version": "2.0.0",
    "action": "discover",
    "messageId": "bb9f86db-9a3d-4e9c-8c11-81c8f1a7b901",
    "transactionId": "f9d1e7f3-5f1a-4d23-9f10-31b72c0b0c01",
    "timestamp": "2026-03-26T12:00:00Z",
    "bapId": "bap.myapp.in",
    "bapUri": "https://bap.myapp.in",
    "networkId": "retail-grocery"
  },
  "message": {
    "intent": {
      "filters": {
        "type": "jsonpath",
        "expression": "$.catalogs[*].offers[*] ? (@.offerAttributes.tariffModel == 'FLAT_DISCOUNT' && @.offerAttributes.priceSpecification.price < 100)"
      }
    }
  }
}
```

This finds all offers with a flat discount where the price is under 100.

## 4. Combining Search Modes

You can combine text search with spatial or filter queries in a single request:

```json
{
  "message": {
    "intent": {
      "textSearch": "Coffee",
      "spatial": [
        {
          "op": "S_DWITHIN",
          "targets": "$.catalogs[*].provider.availableAt[*].geo",
          "geometry": { "type": "Point", "coordinates": [77.6401, 12.9116] },
          "distanceMeters": 5000
        }
      ]
    }
  }
}
```

This finds coffee-related resources available within 5 km of Bengaluru HSR Layout.

## 5. Retrieving Inactive or Expired Catalogs

By default DISCOVR returns only **active** and **currently-valid** catalogs. To retrieve catalogs that are inactive or outside their validity window, pass the `active` and/or `validity` query parameters on the request URL. The request body is unchanged.

```
POST /discover?validity=false
```

Returns **only** catalogs that are provably out of their validity window (expired or not yet valid):

```json
{
  "message": {
    "intent": {
      "textSearch": "Coffee"
    }
  }
}
```

Other combinations:

| Request                                      | Returns                                                |
| -------------------------------------------- | ------------------------------------------------------ |
| `POST /discover` (no params)                 | Active, currently-valid catalogs (default)             |
| `POST /discover?active=false`                | Only catalogs explicitly marked inactive               |
| `POST /discover?validity=false`              | Only expired / not-yet-valid catalogs                  |
| `POST /discover?active=false&validity=false` | Only catalogs that are both inactive and out of window |

See [Usage](/product-documentation/products/discovr/usage.md#filtering-by-active-and-validity-status) for the full semantics.

See [Usage](/product-documentation/products/discovr/usage.md) for the full response format.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.nfh.global/product-documentation/products/discovr/examples.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
