> For the complete documentation index, see [llms.txt](https://docs.umbraco.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.umbraco.com/umbraco-ui-builder/19.latest/advanced/async-apis.md).

# Async APIs

Learn about the asynchronous APIs in Umbraco UI Builder, and how to move code from the removed synchronous repository and service APIs.

Umbraco UI Builder 17.1 added asynchronous versions of the repository and service APIs and marked the synchronous ones as obsolete. Umbraco UI Builder 19 removes the synchronous repository and service APIs.

All asynchronous methods have an `Async` suffix. Each one accepts an optional `CancellationToken cancellationToken = default` as its last parameter.

## Deprecation Timeline

| Version          | Status                                                 |
| ---------------- | ------------------------------------------------------ |
| **Version 17.1** | Sync methods marked `[Obsolete]`, async methods added. |
| **Version 19**   | Sync methods removed.                                  |

## What Was Removed

The synchronous members were removed from these types:

* `IRepository`, for example `Get`, `Save`, `Delete`, `GetAll`, `GetPaged`, and `GetCount`.
* `Repository<TEntity, TId>`, including the public methods and the `*Impl` methods that custom repositories override.
* `EntityService`, for example `GetEntity`, `SaveEntity`, `DeleteEntity`, and `FindEntities`.

Use the `*Async` version of each member, such as `GetAsync`, `SaveAsync`, `GetEntityAsync`, or `FindEntitiesAsync`.

## Migration Guide for Custom Repository Implementations

If you have a custom repository extending `Repository<TEntity, TId>` or `EFCoreRepository<TEntity, TId>`:

1. Delete the synchronous `*Impl` overrides. They no longer compile, because the methods they override were removed.
2. Implement all `*ImplAsync` abstract methods.
3. Migrate callers from sync to async methods.
4. Pass the `CancellationToken` through the call chain.

`InsertImplAsync` and `UpdateImplAsync` are optional. Both call `SaveImplAsync` unless you override them.

{% code title="ProductRepository.cs" %}

```csharp
// Before (version 18 and earlier)
protected override Product GetImpl(int id)
{
    return _myDataSource.Get(id);
}

// After (version 17.1 and later)
protected override async Task<Product> GetImplAsync(int id, CancellationToken cancellationToken = default)
{
    return await _myDataSource.GetAsync(id, cancellationToken);
}
```

{% endcode %}

For a full example, see the [Repositories](/umbraco-ui-builder/19.latest/advanced/repositories.md) article.

## Asynchronous Extension Points

From Umbraco UI Builder 19, actions, cards, data views builders, and filter options builders also have asynchronous methods. Umbraco UI Builder only calls the asynchronous methods. By default, each one calls the synchronous method, so existing code keeps working.

| Extension point         | Asynchronous method | Synchronous method | More information                                                                                 |
| ----------------------- | ------------------- | ------------------ | ------------------------------------------------------------------------------------------------ |
| Actions                 | `ExecuteAsync`      | `Execute`          | [The Basics](/umbraco-ui-builder/19.latest/actions/the-basics.md)                                |
| Custom cards            | `GetValueAsync`     | `GetValue`         | [Custom Cards](/umbraco-ui-builder/19.latest/cards/custom-cards.md)                              |
| Data views builders     | `GetDataViewsAsync` | `GetDataViews`     | [Data Views Builders](/umbraco-ui-builder/19.latest/filtering/data-views/data-views-builders.md) |
| Filter options builders | `GetOptionsAsync`   | `GetOptions`       | [Filterable Properties](/umbraco-ui-builder/19.latest/filtering/filterable-properties.md)        |

Override the asynchronous method when your code awaits anything, such as a database query or an HTTP call. Override only one of the two methods:

* A class that overrides neither method throws a `NotImplementedException` when it is used.
* A class that only overrides the asynchronous method throws a `NotImplementedException` when code calls the synchronous method.


---

# 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.umbraco.com/umbraco-ui-builder/19.latest/advanced/async-apis.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.
