---
name: "up.network"
area: "API"
kind: "module"
parent: "API reference"
url: "https://unpoly.com/api/up.network"
---
<nav aria-label="Unpoly docs">[All docs](https://unpoly.com/index.md) · [API reference](https://unpoly.com/api.md)</nav>

# `up.network`

Features to make HTTP requests and cache their responses.

Unpoly uses this client automatically when following a link or submitting a form. To make a request from your own code, call [`up.request()`](https://unpoly.com/api/up.request.md). It returns an [`up.Request`](https://unpoly.com/api/up.Request.md) that fulfills with an [`up.Response`](https://unpoly.com/api/up.Response.md) and that can be aborted. Responses can be cached so that a later request for the same URL renders instantly, and cached content is revalidated after rendering. The cache is managed through [`up.cache.get()`](https://unpoly.com/api/up.cache.get.md), [`up.cache.expire()`](https://unpoly.com/api/up.cache.expire.md) and [`up.cache.evict()`](https://unpoly.com/api/up.cache.evict.md).

Events are emitted throughout the request lifecycle. [`up:network:late`](https://unpoly.com/api/up:network:late.md) fires when requests take longer than expected and drives the default progress bar; [`up:request:offline`](https://unpoly.com/api/up:request:offline.md) fires when a request fails without a response. Defaults for timeouts, concurrency and caching live in [`up.network.config`](https://unpoly.com/api/up.network.config.md).

<nav aria-label="Guides">

- [Learn: Network & caching](https://unpoly.com/learn/network.md)

</nav>

---

## Features {#features}

- ### [up.ajax([url], [options])](https://unpoly.com/api/up.ajax.md) (JavaScript function) (deprecated)

  Makes a request to the given URL and caches the response.

- ### [up.cache.clear()](https://unpoly.com/api/up.cache.clear.md) (JavaScript function) (deprecated)

  Expires cache entries.

- ### [up.cache.evict([pattern])](https://unpoly.com/api/up.cache.evict.md) (JavaScript function)

  Evicts responses in the cache.

- ### [up.cache.expire([pattern])](https://unpoly.com/api/up.cache.expire.md) (JavaScript function)

  Expires entries in the cache.

- ### [up.cache.get(requestOptions)](https://unpoly.com/api/up.cache.get.md) (JavaScript function) (experimental)

  Returns a cached request matching the given request options.

- ### [up.network.abort([condition], [options])](https://unpoly.com/api/up.network.abort.md) (JavaScript function)

  Aborts pending requests matching a condition.

- ### [up.network.config](https://unpoly.com/api/up.network.config.md) (Configuration object)

  Sets default options for network requests.

- ### [up.network.isBusy()](https://unpoly.com/api/up.network.isBusy.md) (JavaScript function)

  Returns whether Unpoly is currently loading a request.

- ### [up.network.isIdle()](https://unpoly.com/api/up.network.isIdle.md) (JavaScript function) (deprecated)

  Returns whether Unpoly is _not_ currently loading a request.

- ### [up:network:late](https://unpoly.com/api/up:network:late.md) (DOM event)

  This event is emitted when requests are taking long to finish loading.

- ### [up.network.loadPage(options)](https://unpoly.com/api/up.network.loadPage.md) (JavaScript function)

  Makes a full-page request, replacing the entire browser environment with a new page from the server response.

- ### [up:network:recover](https://unpoly.com/api/up:network:recover.md) (DOM event)

  This event is emitted when requests have taken long to finish, but have finished now.

- ### [up.proxy.clear()](https://unpoly.com/api/up.proxy.clear.md) (JavaScript function) (deprecated)

  Expires all cache entries.

- ### [up.proxy.preload(link)](https://unpoly.com/api/up.proxy.preload.md) (JavaScript function) (deprecated)

  Preloads the given link.

- ### [up.request([url], [options])](https://unpoly.com/api/up.request.md) (JavaScript function)

  Makes a request to the given URL.

- ### [up:request:aborted](https://unpoly.com/api/up:request:aborted.md) (DOM event)

  This event is emitted when a request was aborted.

- ### [up:request:load](https://unpoly.com/api/up:request:load.md) (DOM event)

  This event is emitted before a request is sent over the network.

- ### [up:request:loaded](https://unpoly.com/api/up:request:loaded.md) (DOM event)

  This event is emitted when the response to a request has been received.

- ### [up:request:offline](https://unpoly.com/api/up:request:offline.md) (DOM event)

  This event is emitted when a request encounters a fatal error, like a timeout or loss of network connectivity.

