> For the complete documentation index, see [llms.txt](https://redefined.gitbook.io/connect/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://redefined.gitbook.io/connect/integerate-redefined/redefined-api/migration-from-expiresat-to-fetchedat-optimistic-results.md).

# Migration from expiresAt to fetchedAt (optimistic results)

### TL;DR

1. data considered as fresh when it's not older than
   1. **was:** 5 minutes
   2. **now:** 1 minute
2. stale data handling:
   1. **was:** completely removed from cache and never returned from API
   2. **now:** returned from API even if it's stale, but fetching of new data initiated immediately
3. **was:** all items in data array had `expiresAt` field that indicated when server will consider data as stale and will refresh it from blockchain. After that you could re-request fresh data.&#x20;
4. **now**: all items in data array have `fetchedAt` field that indicates when server received data from blockchain. Once 1 minute since it transpires, you can consider data as stale and re-request it.&#x20;

**Why:** data mappings change rarely. Results from hour ago and even from week ago will 99% be accurate. So we return stale from API just to provide a fast initial response, but at the same time we trigger refresh of our caches and when you re-request data in second or two, data will be absolitutely fresh. **BUT these second or two really matter when it comes to UX.**&#x20;

### Async endpoints

In **async** version of API now you will immediately receive *last fetched bindings* for requested domain/address. If some bindings are aged more than 1 minute, system will begin automatic data updating. After \~2-3 sec from first request you can rerequest data and obtain fresh bindings. About **completness and processedVendors** - previously was linked with data field and represented from how many and from what vendors data are included in response. Now to fit *optimistic results* concept `completness` and `processedVendors` only include vendors with data aged max 1 minute.

It means if you request data from following vendors: ens, lens and sid, the response will looks like this (the new approach):

```json
{
  "data": [
    {
      "domain": "nick.eth",
      "vendor": "ens",
      "fetchedAt": 1691049786092
    }, {
      "domain": "some.domain.sid",
      "vendor": "sid",
      "fetchedAt": 1691049000000
    },{
      "domain": "arachnid.lens",
      "vendor": "lens",
      "fetchedAt": 1691049786092
    }
  ],
  "completeness": 0.666666666666666667,
  "processedVendors": [
    "ens",
    "lens"
  ]
}
```

Please note that `completeness` is not 1, this means that some data is too old and can be used only for “readonly” mode and now our system is already updating data from corresponding vendors. You can evaluate `fetchedAt` field to see which records are actually outdated – the value will be older than 1 minute ago. Now see example of response for same request and same context of data fresness, but from `expiresAt` concept **(the old approach)**:

```json
{
  "data": [
    {
      "domain": "nick.eth",
      "vendor": "ens"
    }, {
      "domain": "arachnid.lens",
      "vendor": "lens"
    }
  ],
  "expiresAt": 1691049786155,
  "completeness": 0.666666666666666667,
  "processedVendors": [
    "ens",
    "lens"
  ]
}
```

### Sync endpoints

Previously you received fullfilled response (means with data from all requested vendors) with data aged max 5 minutes. Now data is aged max to 1 minute.


---

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://redefined.gitbook.io/connect/integerate-redefined/redefined-api/migration-from-expiresat-to-fetchedat-optimistic-results.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
