> For the complete documentation index, see [llms.txt](https://docs.codemash.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.codemash.io/cloud/code/marketplace/function.md).

# Function

**Where:** Code → Marketplace → package → function · `/projects/<project>/code/marketplace/<connectionId>/functions/<functionId> (+ /edit)`

Add or edit one marketplace function. On add, `<functionId>` is the curated definition's function key (for example `chat.postMessage`); once installed, the function has a `func_…` id and the edit route uses it. When the listing is not installed, the screen is review-only.

{% hint style="info" %}
Screenshot TODO — capture comes from testing-plan area **11-code**.
{% endhint %}

## What you can do here

* **Display Name** — the same function can be added multiple times; give each copy a distinct name (e.g. "Notify #alerts channel"). Plus a **Description** field.
* **Payload parameters** — informational: what the function expects from the caller (name, type, required, description). You send these on the invoke payload when calling the function by its id.
* **Bindings** — how each `@Model.*` token gets its value. For every bindable token you pick one of: **Default (connection / listing)** — resolved by the connection's configuration; **Fixed value** — a pinned value (e.g. `#general`); **Dynamic binding** — resolved at call time from the caller, project, or trigger context (e.g. `@Model.User.UserId`, `@Model.Trigger.New.email`). `@Model.Request.*` tokens always come from the caller payload and are not listed here. Advanced mappings created via the API are shown read-only and preserved on save.
* **Add** (new) or **Save** (edit) stores the function. If the parent connection is disabled, an alert ("Connection is not enabled") blocks all changes.
* **Delete** — only from this edit screen, via the actions menu.
* **Make a test call** (edit only) — invoke the function with a JSON payload, exactly what your code would send, and see the raw response with **Run test call**.

Example: add the Slack `chat.postMessage` definition twice — once as "Notify #alerts channel" with the channel token pinned to `#alerts`, once as "DM the acting user" with the channel bound to `@Model.User.UserId`.

## Use it from code

[Invoke Marketplace Function Binding](/sdks-and-cli/code/marketplace/invoke-marketplace-function-binding.md) in the SDK reference.

## API reference

Endpoints: [Save Marketplace Function Binding](/api-reference/code/marketplace/save-marketplace-function-binding.md), [Invoke Marketplace Function Binding](/api-reference/code/marketplace/invoke-marketplace-function-binding.md), [Get Marketplace Binding Tokens](/api-reference/code/marketplace/get-marketplace-binding-tokens.md), [Enable](/api-reference/code/marketplace/enable-marketplace-function-binding.md) / [Disable](/api-reference/code/marketplace/disable-marketplace-function-binding.md) / [Delete Marketplace Function Binding](/api-reference/code/marketplace/delete-marketplace-function-binding.md).
