---
title: Resolving macros using the API
related:
  - https://docs.kentico.com/13/macro-expressions/extending-the-macro-engine.md
  - https://docs.kentico.com/13/macro-expressions/macro-syntax.md
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

If you need to process macro expressions inside text values in your custom code, use the **MacroResolver.Resolve** method. Specify the string where you want to resolve macros as the method's input parameter.

For example:

```csharp

using CMS.MacroEngine;

...

// Resolves macros in the specified string using a new instance of the global resolver
string resolvedTextGlobal = MacroResolver.Resolve("The current user is: {% CurrentUser.UserName %}");


```

The method evaluates the macros using a new instance of the global resolver and automatically ensures thread-safe processing.

Macro resolvers are system components that provide the processing of macros. The resolvers are organized in a hierarchy that allows child resolvers to inherit all macro options from the parent. The global resolver is the parent of all other resolvers in the system.

> **Note:** **Resolving macros on the live site**
>
> Certain macros that are only intended for the Xperience administration interface do not work when resolving macros from the code of the live site application. For example, macros that return the HTML code of font icons used in the administration interface. Such macros are only available within the code libraries of the administration application.

## Resolving localization macros

If you only need to resolve [localization macros](https://docs.kentico.com/13/multilingual-websites/setting-up-a-multilingual-user-interface/localizing-text-fields.md) in text, call the **CMS.Helpers.ResHelper.LocalizeString** method.

```csharp

using CMS.Helpers;

...

// Resolves localization macros in text
string localizedResult = ResHelper.LocalizeString("{$general.actiondenied$}");

```
