> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xano.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Custom Functions

> Build business logic once and reuse it in multiple places

<Info>
  **Quick Summary**

  Custom functions are very similar to your APIs — they have inputs, a function stack, and a response. However, they can not be called externally. Instead, custom functions allow you to build something and use it in other places, while maintaining it in a centralized location.
</Info>

## What is a custom function?

Custom functions can be thought of as a building block for the rest of your backend. You can build a custom function just like an API endpoint, and insert that custom function into other function stacks, giving you easily reusable logic while only having to maintain it in one place. When you make a change inside of a custom function, that change is automatically in effect everywhere you have chosen to use the custom function.

***

## Building and Using Custom Functions

<Steps>
  <Step title="Access your custom functions from the sidebar.">
    From the sidebar, click <span class="ui-bubble">Functions</span> or hover over it and click <span class="ui-bubble"><Icon icon="plus" /></span> to create a new function immediately.

    <img src="https://mintcdn.com/xano-997cb9ee/WJuhSxAtuTt2bOAm/images/custom-functions-20260401-134442.png?fit=max&auto=format&n=WJuhSxAtuTt2bOAm&q=85&s=b40b877e0cfd49e5d126cffcd59998a3" alt="custom-functions-20260401-134442" width="566" height="533" data-path="images/custom-functions-20260401-134442.png" />
  </Step>

  <Step title="Click + Add Function to create a new custom function.">
    Give your custom function a **name**, **description**, **tags**, and choose your [Request History](/maintenance-monitoring-and-logging/request-history) settings.

    You can also choose to store your custom functions inside of a folder. If the folder already exists, just start typing the name and select it from the auto-complete. If the folder doesn't exist, you can create a new one from here.

    <Frame>
      <img src="https://mintcdn.com/xano-997cb9ee/_FyaEhYRFYQZinJ0/images/dc7b9f02-image.jpeg?fit=max&auto=format&n=_FyaEhYRFYQZinJ0&q=85&s=374b9cf42ca146f5d7ecba385a0efef9" alt="" width="491" height="595" data-path="images/dc7b9f02-image.jpeg" />
    </Frame>

    When you're done, click Save .
  </Step>

  <Step title="Build your custom function">
    A custom function has three sections — the same as an API endpoint.

    ### ⬇️ Inputs

    The inputs are anything that a function stack needs to run. For example, a function stack that logs in a user probably needs a username or email and a password; these would be the inputs.

    ### 🔄 Function stack

    This is where all of the magic happens. All of the business logic that is performed lives here.

    As you add functions to your function stack, it will suggest next steps based on most popular user activity.

    ### ⬆️ Response

    Once the function stack has done its job, it needs to know what to return. This lives in the Response section.
  </Step>

  <Step title="Insert your new custom function into other function stacks.">
    ### Insert your new custom function into other function stacks.

    When you're ready to use your new custom function in other function stacks, click

    <img src="https://mintcdn.com/xano-997cb9ee/dC3SQWgPCF_-1qn6/images/2c5feb7c-image.jpeg?fit=max&auto=format&n=dC3SQWgPCF_-1qn6&q=85&s=6451e2d2cd775e2cecad59f9d11992b9" className="inline m-0" width="122" height="30" data-path="images/2c5feb7c-image.jpeg" />

    , choose **Custom Functions** from the panel that opens, and select your custom function.

    You'll be able to supply data for any inputs the custom function is expecting here.

    <Frame>
      <img src="https://mintcdn.com/xano-997cb9ee/p57kHPQ04p_0aEqF/images/b1656994-image.jpeg?fit=max&auto=format&n=p57kHPQ04p_0aEqF&q=85&s=6b53482858cc9214ff47dbb322faf481" alt="" width="478" height="269" data-path="images/b1656994-image.jpeg" />
    </Frame>
  </Step>
</Steps>

***

### Creating Custom Functions from Existing Function Stacks

If you have a function stack that you'd like to convert into a custom function, you can do so in one of the following ways.

<Steps>
  <Step title="Convert the entire stack">
    Click the three dots in the upper-right corner and choose Convert To Function

    <Frame>
      <img src="https://mintcdn.com/xano-997cb9ee/dC3SQWgPCF_-1qn6/images/2ba76ceb-image.jpeg?fit=max&auto=format&n=dC3SQWgPCF_-1qn6&q=85&s=02c8b996dfc7d15f7cd990c17b9c5e46" alt="" width="294" height="364" data-path="images/2ba76ceb-image.jpeg" />
    </Frame>
  </Step>

  <Step title="Select individual steps to convert to a function">
    You can select a group of steps and click **Convert to Func** to convert those steps into a custom function.

    <Frame>
      <img src="https://mintcdn.com/xano-997cb9ee/p57kHPQ04p_0aEqF/images/asdasd.gif?s=34f4733e6a39f2a89d05e9c0a040d5d7" alt="" width="800" height="549" data-path="images/asdasd.gif" />
    </Frame>
  </Step>
</Steps>

***

## Custom Function Settings

### From the Settings panel

<Frame>
  <img src="https://mintcdn.com/xano-997cb9ee/Qia2QBMIuWWrGb-s/images/1a9e6efc-image.jpeg?fit=max&auto=format&n=Qia2QBMIuWWrGb-s&q=85&s=339d39bba525243f8d58248a36cd88ff" alt="" width="355" height="206" data-path="images/1a9e6efc-image.jpeg" />
</Frame>

| Name             | Purpose                                                                                                                                                                                                                                                   |
| ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Name             | The name of the custom function.                                                                                                                                                                                                                          |
| Description      | An internal description, just for you.                                                                                                                                                                                                                    |
| Tags             | Use tags to organize objects throughout your Xano workspace and find them later                                                                                                                                                                           |
| Request History  | - Inherit Settings: Use whatever is set in your workspace branch defaults<br />- Other: Set specific request history settings for this Function<br /><br />📖 [**Learn more about request history**](/maintenance-monitoring-and-logging/request-history) |
| Response caching | Cache the response and redeliver it during future runs<br /><br />📖 [**Learn more about response caching**](/the-function-stack/additional-features/response-caching)                                                                                    |

***

## Custom Function Folders

You can organize your custom functions into folders for better organization.

* Folders are not required if you prefer not to use them. You can store all of your functions in folders, or use a combination of folders and no folders.
* A folder requires having at least one function inside of it — empty folders are not supported.

<Steps>
  <Step title="Creating New Functions">
    When creating a new function, you'll be given the option to store it in a folder.

    Just start typing the name of the folder. If it exists, select it from the auto-complete dropdown. If it doesn't exist, it will be created for you.

    <Frame>
      <img src="https://mintcdn.com/xano-997cb9ee/kBkSb_XZ48XRxJA_/images/a1b9949b-image.jpeg?fit=max&auto=format&n=kBkSb_XZ48XRxJA_&q=85&s=1be8824bdac61d3d9ea8df77f66ff1b9" alt="" width="485" height="192" data-path="images/a1b9949b-image.jpeg" />
    </Frame>
  </Step>

  <Step title="Creating New Folders with Existing Functions">
    Click the Add Folder button to create a new folder for your existing functions.

    <Frame>
      <img src="https://mintcdn.com/xano-997cb9ee/o7zunZFYmjx8RZ8N/images/f74d5605-image.jpeg?fit=max&auto=format&n=o7zunZFYmjx8RZ8N&q=85&s=7ad544044eb87a6a6af47dd64525a2c3" alt="" width="609" height="168" data-path="images/f74d5605-image.jpeg" />
    </Frame>

    Give your new folder a name, and use the autocomplete to select at least one function to add to it.

    <Frame>
      <img src="https://mintcdn.com/xano-997cb9ee/_oKnuVg5Nf4VhJM4/images/500c6424-image.jpeg?fit=max&auto=format&n=_oKnuVg5Nf4VhJM4&q=85&s=6eaceee196ff00d72c47b7f53dcd536d" alt="" width="479" height="636" data-path="images/500c6424-image.jpeg" />
    </Frame>
  </Step>

  <Step title="Moving Existing Functions into Folders">
    Select the functions to move by using the checkboxes on the left-hand side, and click Move

    <Frame>
      <img src="https://mintcdn.com/xano-997cb9ee/p57kHPQ04p_0aEqF/images/b86676ce-image.jpeg?fit=max&auto=format&n=p57kHPQ04p_0aEqF&q=85&s=097728eb72b43fedb0be1e9b86f188f1" alt="" width="1797" height="605" data-path="images/b86676ce-image.jpeg" />
    </Frame>

    Type a new folder name, or add them to an existing folder. When you're ready, click Save

    <Frame>
      <img src="https://mintcdn.com/xano-997cb9ee/pz6e9Ndbn8i3u8Zz/images/6b511acd-image.jpeg?fit=max&auto=format&n=pz6e9Ndbn8i3u8Zz&q=85&s=5e3b388c5f8b896bf2404c7e0191f2c0" alt="" width="483" height="611" data-path="images/6b511acd-image.jpeg" />
    </Frame>
  </Step>
</Steps>
