> For the complete documentation index, see [llms.txt](https://partner-docs.covergenius.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://partner-docs.covergenius.com/xcover-elements/client-integration-examples/requests-and-responses.md).

# Requests & Responses

Example payloads for requests to and responses from XCE

## Offer Request

The below is an example quote request to send to the XCE widget during initialization.

```json
{
  "schema": "demo-partner-travel:v1",
  "customer": {
    "currency": "EUR",
    "language": "en",
    "country": "NL"
  },
  "context": {
    "departure_country": "GB",
    "destination_country": "GB",
    "reservation_number": "aaca2167-3d55-4d12-a58d-cecf2657a7f4",
    "total_tickets_price": 265,
    "number_of_adults": 1,
    "number_of_children": 0,
    "number_of_infants": 0,
    "trip_start_date": "2025-11-08T09:25:00+11:00",
    "trip_end_date": "2025-11-17T15:45:00+11:00",
    "trips": [
      {
        "legs": [
          {
            "departure_datetime": "2025-11-08T09:25:00+11:00",
            "arrival_datetime": "2025-11-08T11:30:00+11:00",
            "trip_number": "ABC123",
            "departure_location": "Machester Piccadilly",
            "arrival_location": "London Kings Cross",
            "departure_country": "GB",
            "arrival_country": "GB",
            "departure_city": "Machester",
            "arrival_city": "London",
            "transport_mode": "train"
          }
        ]
      },
      {
        "legs": [
          {
            "departure_datetime": "2025-11-08T09:25:00+11:00",
            "arrival_datetime": "2025-11-08T11:30:00+11:00",
            "trip_number": "DEF456",
            "departure_location": "London Kings Cross",
            "arrival_location": "Piccadilly",
            "departure_country": "GB",
            "arrival_country": "GB",
            "departure_city": "London",
            "arrival_city": "Machester",
            "transport_mode": "train"
          }
        ]
      }
    ]
  }
}
```

## Offer Response

The below is an example response provided by XCE during the `onSet` function once an offer was successfully generated for a customer. This data is required to be stored for later consumption in the confirm offer request.

#### Finance and Benefits Response Fields

By default, the offer response includes these fields at the product level with null values:

* `tax` — tax amount for the product
* `surcharge` — surcharge amount
* `commission` — commission amount
* `benefits` — policy benefit details

The response contract is stable — these fields are always present. However, tax, surcharge, and commission will return `null` until your element is configured by your Client Solution Engineer (CSE) to request them. Once set up, the XCover engine populates them with their actual values. No changes are required on your side.

{% hint style="info" %}
To enable extra response fields, reach out to your CSE.
{% endhint %}

```json
{
    "id": "fe92ecc3-fe4c-408a-b678-a80e5a073c65",
    "offer_config_id": "409ae590-3302-4d56-9279-af956c1e2170",
    "products": [
        {
            "id": "1846ae80-bda8-4288-aeea-4ad130a4de6a",
            "product_config_id": "6e29bc7e-aca0-48d5-ba65-2c3eeb01ab08",
            "type": "insurance",
            "details": {
                "policy_version_id": "ab150d4d-38bb-4560-9901-fcea7ade5ede",
                "start_date": "2025-11-08T09:25:00+11:00",
                "end_date": "2025-11-22T09:25:00+11:00",
                "finance": {
                    "price": {
                        "total_amount": 18.61,
                        "total_amount_without_tax": null,
                        "total_amount_formatted": "€18.61",
                        "total_amount_without_tax_formatted": null
                    },
                    "tax": {
                        "total_amount": null,
                        "total_amount_formatted": null,
                        "breakdown": null,
                    },
                    "surcharge": {
                        "total_amount": null,
                        "total_amount_formatted": null
                    },
                    "commission": {
                        "total_amount": null,
                        "total_amount_formatted": null
                    }
                },
                "pds_url": "https://staging.xcover.com/en/pds/fe92ecc3-fe4c-408a-b678-a80e5a073c65?policy_type=travel_ticket_cover_v1",
                "files": [],
                "extra_fields": {},
                "experiment": {}
            }
        }
    ],
    "brightwrite_details": {
        "bw_device_id": "de506c6f-d65e-4abd-89f2-9daebb1b721a",
        "bw_experiment_id": null,
        "bw_variant_id": null
    }
}
```


---

# 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://partner-docs.covergenius.com/xcover-elements/client-integration-examples/requests-and-responses.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.
