> 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_list_campaigns.md).

# nats\_list\_campaigns

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

## Parameters

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

| Parameter                                                                                                       | Description                                                                         | Possible Values                 | Default Value                 | Example                |
| --------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ------------------------------- | ----------------------------- | ---------------------- |
| userid                                                                                                          | the loginid of the affiliate whose campaigns should be listed.                      | The I.D. user viewing the page. | Any integer greater than zero | userid=123             |
| details                                                                                                         | Set to 1 to provide more details about the campaigns in the output. See note below. | 0 or 1 (exclusive)              | 0                             | details=1              |
| show\_hidden                                                                                                    | Set to 1 to include details about hidden campaigns in the output.                   | 0 or 1 (exclusive)              | 0                             | show\_hidden=1         |
| [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

Outputs an array called *$campaigns*. The arguments above determine the array's structure.

If *details* is not set or are set to "0", *$campaigns* will have one-dimension with the numeric [campaignid](https://tmmwiki.com/index.php?title=Campaignid\&action=edit\&redlink=1) as the key and the campaign's text description as the value:

```
Array campaigns(
    [59] => "Main campaign used by default.",
    [276] => "My second campaign." 
)
```

If *details* is set to "1", all information about each campaign will be listed in a multi-dimensional array. For example:

```
Array campaigns(
    [59] => Array(
        [campaignid] => 59,
        [loginid] => 45,
        [name] => "Default",
        [description] => "Main campaign used by default.",
        [created_date] => 1209634033,
        [hide] => 0,
        [old_campaignid] => 0 ),
    [276] => Array(
        [campaignid] => 276,
        [loginid] => 45,
        [name] => "Second Campaign",
        [description] => "John Smith Special Campaign",
        [created_date] => 1209664102,
        [hide] => 0,
        [old_campaignid] => 0 ),

)
```

## See Also

* [nats\_list\_sites](/nats-admin/skins-and-templates/further-reading/template-functions/nats_list_sites.md) -- lists all sites in a particular program.
* [nats\_list\_tours](/nats-admin/skins-and-templates/further-reading/template-functions/nats_list_tours.md) -- lists all sites in a particular program and [site](/additional-resources/common-terms.md#site).


---

# 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_list_campaigns.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.
