> For the complete documentation index, see [llms.txt](https://docs.stackai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stackai.com/technical-reference/connections-and-tool-execution/custom-actions-authentication-and-execution.md).

# Custom Actions: Authentication and Execution

Custom actions let you expose an operation for use by agents or workflows. Define a narrow purpose, clear inputs, and an output that later steps can use.

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSQ1Sgy933krTyK0S4JpP%2Fuploads%2Fm78Pb9S0aFCOZ9ieSKDd%2FG050.mp4?alt=media&token=f1d05668-43db-4493-99a9-cf9b8553a4ed>" %}

## Before you begin

Permission to create custom actions, a supported provider connection, and the provider’s public API documentation.

## Key concepts

| Term          | Definition                                                                                                                                                  |
| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Custom action | An operation defined for a specific provider API task. Review its request, authentication, output, and error behavior before agent use.                     |
| Provider      | The service or tool family that offers an integration capability. Choose the provider before selecting its connector or action.                             |
| Connection    | A saved authorization to a particular provider account. An action uses the selected account’s access, subject to StackAI sharing controls.                  |
| Request body  | The payload transmitted with an HTTP request. Interpret it using the content type expected by the endpoint.                                                 |
| Schema        | A definition of fields, types, required values, and supported constraints. Use it to validate the shape of data; it does not establish factual correctness. |

## Configure a custom action

1. Define the operation and its input fields. Use the action editor or generation option to create the action.

![Describe the operation and its inputs and outputs before reviewing the generated action.](https://content.gitbook.com/content/SQ1Sgy933krTyK0S4JpP/blobs/futPfrnEg7hvd04vfdtS/assets/g050-g050-02-prompt.png)

Describe the operation and its inputs and outputs before reviewing the generated action.

2. Configure authentication through the supported connection settings. Review the generated request and output fields.
3. Run the action with valid inputs and inspect the provider response before adding it to an agent.

The action performs the intended provider operation and returns a usable result.

## Behavior and limitations

Generated code needs review. Check its endpoint, request method, permissions, pagination, and error handling. Keep credentials in supported connection fields rather than action text. Explain when an agent should use the action, especially when it changes records or sends messages.

## Related resources

[Create a custom action](https://docs.stackai.com/guides-and-quickstarts/using-tools-and-actions/create-a-custom-action.md)

[Connection Ownership, Sharing, and Permissions](https://docs.stackai.com/technical-reference/connections-and-tool-execution/connection-ownership-sharing-and-permissions.md)


---

# 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.stackai.com/technical-reference/connections-and-tool-execution/custom-actions-authentication-and-execution.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.
