> For the complete documentation index, see [llms.txt](https://docs.toomuchmedia.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.toomuchmedia.com/nats-admin/skins-and-templates/further-reading/template-functions/nats_decode.md).

# nats\_decode

*Article Topics:* [*Smarty*](/getting-started/common-topics/smarty.md)*,* [*Customization*](/getting-started/common-topics/customization.md)

Decodes a [linkcode](/using-nats/nats-admin-features/linkcodes.md) into a [Smarty](/using-nats/one-off-articles/smarty.md) array.

## **Parameters**

(*Required parameters in **bold**)*

| Parameter                                                                                                       | Description                                                      | Possible Values                                    | Default Value                        | Example                         |
| --------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- | -------------------------------------------------- | ------------------------------------ | ------------------------------- |
| **nats**                                                                                                        | **The linkcode to be decoded.**                                  | **Any valid linkcode for this NATS installation.** | **None. This parameter is required** | **nats="OC4xLjEuMS4wLjAuMC4w"** |
| assign                                                                                                          | Array name to store the decoded linkcode.                        | Any valid Smarty array name                        | decoded                              | assign="myarray"                |
| [assign\_prefix](/nats-admin/skins-and-templates/further-reading/template-function-parameters/assign_prefix.md) | Prefix output variables with this word. (Click link for details) | Any valid Smarty variable name                     | *None.* (No prefix is used)          | assign\_prefix="myvar"          |

## Output

Output is stored in an array with the same structure as the parameters in [nats\_encode](/nats-admin/skins-and-templates/further-reading/template-functions/nats_encode.md). The data here is stored within the *$decoded* array, and contains the following information:

```
loginid => "2"
programid => "18"
siteid => "3"
tourid => "7"
campaignid => "0"
adtoolid => "0"
subid1 => "0"
subid2 => "0"
promotionalid => "0"
is_unencoded => 0
networkid => 0
old_code => 0	
inhouse => "0"
```

The values displayed for each variable in the example above are sample values, which will be replaced with the actual values found in your *$decoded* array.

The *old\_code* variable provided here lets you know whether the code in question was generated in previous versions of NATS. If the code was generated in NATS, it will be displayed as *old\_code=1*, and code generated in NATS will be displayed as *old\_code=0*

## See Also

{% content-ref url="/pages/i6owS2gl4Pc3oEZjTFDs" %}
[nats\_encode](/nats-admin/skins-and-templates/further-reading/template-functions/nats_encode.md)
{% endcontent-ref %}


---

# 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:

```
GET https://docs.toomuchmedia.com/nats-admin/skins-and-templates/further-reading/template-functions/nats_decode.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
