> For the complete documentation index, see [llms.txt](https://flapjax.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://flapjax.gitbook.io/docs/settings/workspace/custom-actions.md).

# Custom Actions

### Viewing Custom Actions

The list page shows every custom action you have created. Each entry displays:

* **Name**, with an emoji icon for quick identification
* **Method**, the HTTP method: POST, GET, PUT, PATCH or DELETE
* **Incoming Type**, the expected response format, such as Object, Array of Objects or None

The search bar finds a custom action by name.

***

### Creating a Custom Action

Click **New Custom Action** in the top-right corner and fill in:

* **Display Name**, a descriptive name with an optional emoji
* **Endpoint**, the full URL of the external API, such as `https://api.example.com/endpoint`. It must be a valid HTTP or HTTPS URL.
* **Method**, the HTTP method to use: POST, GET, PUT, PATCH or DELETE
* **Response type**, the format you expect back: None, Object, Boolean, Array of Strings, Array of Integers or Array of Objects
* **Headers**, optional custom HTTP headers sent with the request, entered as key and value rows. See **Why headers?** below.

Click **Save** to create the action.

{% hint style="info" %}
**Note:** the **Method** and **Response type** stay locked after creation, so choose carefully. They form the action's contract. The response type drives the incoming attribute schema that later automation steps read, and Flapjax locks it once the action exists. The endpoint, headers, name and attribute schemas stay editable.
{% endhint %}

### Why headers?

Headers are free-form key and value pairs sent with every request this action makes. They let you meet whatever the destination API expects. Three common reasons to set one:

* **Authentication.** Most APIs want proof of who you are. Add the credential the destination asks for, such as an `Authorization: Bearer <token>` header or an API-key header like `X-API-Key: <key>`.
* **`Content-Type`.** This tells the destination how to read the request body. A JSON payload wants `Content-Type: application/json`.
* **Provider-required headers.** Some APIs mandate their own keys, such as an account, version or region header. Check the destination's API docs and add what it lists as required.

Leave Headers empty if the destination needs none of these.

***

### Header sets, for reusable headers

The Custom Actions page carries two tabs: **Actions** and **Headers**. A **header set** is a named group of headers you define once and attach to any number of custom actions. That helps when several actions hit the same API with the same authentication or provider keys.

* **New Header Set** takes a display name, unique in your workspace, an optional description and the header rows.
* Attach sets to an action with the **Header sets** field on the action's form. One action can carry several, and they apply on top of the headers defined on the action itself.
* The Headers tab lists each set with how many headers it holds and how many actions use it.
* **Editing a set changes every custom action that uses it.** That is the point, and the reason to keep destination-specific credentials on the action instead.
* A set still attached to an action **cannot be deleted**. The error names the actions still using it, so detach it everywhere first.

***

### Custom Action Detail Page

Click a custom action's name to open its detail page, which carries three tabs.

#### Outgoing JSON (Request)

Define the data structure Flapjax sends to the external API. Add attributes with a key and data type to build the request payload. Attributes can nest inside objects.

#### Incoming JSON (Response)

Define the data structure you expect back. Flapjax then parses the response and offers those values as context fields in later automation steps.

#### Settings

Quick actions for the custom action's name, emoji and description. The **Danger Zone** for permanent deletion sits here too.

***

### Deleting a Custom Action

Deleting a custom action is permanent, and it does three things:

* Removes the custom action configuration
* Pauses any automations that use it
* Removes any delayed events from those automations

{% hint style="info" %}
**Tip:** you define custom actions here in Settings and run them as steps inside automations. Create one, then add it as an action in the automation builder.
{% endhint %}
