---
metadata:
  - name: generator
    content: Diplodoc Platform v5.70.0
alternate:
  - https://divkit.tech/docs/en/concepts/patches.md
  - https://divkit.tech/docs/ru/concepts/patches.md
  - href: https://divkit.tech/docs/en/concepts/patches.md
    type: text/markdown
    title: Markdown version
  - href: https://divkit.tech/docs/en/llms.txt?revision=r22102947
    rel: describedby
---
> **Documentation Index:** Fetch the complete configuration index at https://divkit.tech/docs/en/llms.txt?revision=r22102947

# Loading more data and patches

A card can be updated partially, without loading it again. The `download` action requests a patch — a description of changes — from the server and applies it to the card elements.

## The download action {#loading-data}

To load more data in the form of a [patch](https://divkit.tech/docs/en/concepts/divs/2/div-patch.md) and update the current element, specify the `download` action:

```translate=no
div-action://download?url=<patch_url>
```

#|
||
**Parameter**
|
**Description**
||

||
`url`
|
URL to get the patch.
||
|#

The typed [download](https://divkit.tech/docs/en/concepts/divs/2/div-action-download.md) action can also specify what to do after loading:

```json
{
  "log_id": "load_more",
  "typed": {
    "type": "download",
    "url": "https://example.com/patch.json",
    "on_success_actions": [
      {
        "log_id": "loaded",
        "url": "div-action://set_variable?name=is_loaded&value=true"
      }
    ],
    "on_fail_actions": [
      {
        "log_id": "load_failed",
        "url": "div-action://set_variable?name=has_error&value=true"
      }
    ]
  }
}
```

#|
|| **Parameter** | **Description** ||
|| `url` | Link for getting the patch. ||
|| `on_success_actions` | Actions in case of successful loading. ||
|| `on_fail_actions` | Actions in case of unsuccessful loading, if the host reported it or the waiting time expired. ||
|#

For an action in the `url` format, the same actions are set in the `download_callbacks` field.

## Patch format {#patch-format}

Response format:

```json translate=no
{
  "patch": {
    // data in patch format
  },
  "templates": {
    // templates that can be used in the patch section
  }
}
```

The `patch` section is described by the [patch](https://divkit.tech/docs/en/concepts/divs/2/div-patch.md) object:

#|
|| **Parameter** | **Description** ||
|| `changes` | Element changes. Required parameter. Each change contains `id`, the ID of the element to be replaced or removed, and `items`, the elements to be inserted. If `items` is not specified, the element is removed. ||
|| `mode` | Procedure for applying changes:<br>- `partial` — all possible changes are applied, and errors are reported (default value);<br>- `transactional` — if an error occurs while applying at least one change, no changes are applied. ||
|| `on_applied_actions` | Actions to perform after the changes are applied. ||
|| `on_failed_actions` | Actions to perform if an error occurs when applying changes in the `transactional` mode. ||
|#

{% cut "Example: replacing an element" %}

```json
{
  "patch": {
    "changes": [
      {
        "id": "placeholder",
        "items": [
          {
            "type": "text",
            "text": "Loaded text"
          }
        ]
      }
    ]
  }
}
```

The element with the `placeholder` ID is replaced with the text from `items`.

{% endcut %}

## Loading patches on platforms {#platforms}

- Android: patches are loaded through `DivNetworkClient` if it is configured, see [Configuring the network stack](https://divkit.tech/docs/en/quickstart/android.md). Your own loader, a `DivDownloader` implementation, is passed to `DivConfiguration` and takes priority.
- iOS: patches are loaded by `DivKitComponents`. Your own loader, an implementation of the `DivPatchProvider` protocol, is passed in the `patchProvider` parameter.
- Web: request parameters are set in the `fetchInit` parameter of the `render` function.

<!-- source: en/_includes/index/troubleshooting.md -->
## Learn more {#troubleshooting}

You can discuss topics of interest in the DivKit user community in Telegram: [https://t.me/divkit_community_en](https://t.me/divkit_community_en).



[DivKit Repository](https://github.com/divkit/divkit)
<!-- endsource: en/_includes/index/troubleshooting.md -->
