# defineFunction

> API reference for defineFunction: parameters, properties, and return types.

Defines a function, its source, and its execution settings.

```ts
import { defineFunction } from '@rippling/rippling-sdk';
```

## Properties

| Property | Required | Type | Description |
| --- | --- | --- | --- |
| `apiName` | Required | `string` | Unique identifier for this function (e.g. `'gym_today_schedule_fn'`). |
| `description` | Required | `null \| string` | Human-readable description of what this function does. |
| `name` | Required | `string` | Display name shown in the Rippling UI. |
| `allowedDomains` | Optional | `string[]` | Outbound domain allowlist. Requests to domains not in this list will be blocked.<br>**Documented default:** `null` |
| `code` | Optional | `string` | TypeScript handler source code. Must export an `onRipplingEvent` function.<br>**Documented default:** `` `''` `` |
| `dependencies` | Optional | `Record<string, string>` | NPM package dependencies as a `{ packageName: versionRange }` map (e.g. `{ '@rippling/rippling-sdk': '^0.2.0' }`).<br>**Documented default:** `null` |
| `deploymentOptions` | Optional | `Record<string, any>` | Raw deployment options object.<br>**Documented default:** `null` |
| `editorGroup` | Optional | `null \| [DefinedGroup](https://developer.rippling.com/documentation/js-sdk/metadata-sdk/reference/types/DefinedGroup-09c3816e)` | — |
| `input` | Optional | `[ValueParser](https://developer.rippling.com/documentation/js-sdk/metadata-sdk/reference/types/ValueParser-ce5d7cd9)<TInput>` | — |
| `isAsync` | Optional | `boolean` | Whether this function runs asynchronously (fire-and-forget).<br>**Documented default:** `` `false` `` |
| `output` | Optional | `[ValueParser](https://developer.rippling.com/documentation/js-sdk/metadata-sdk/reference/types/ValueParser-ce5d7cd9)<TOutput>` | — |
| `runnerGroup` | Optional | `null \| [DefinedGroup](https://developer.rippling.com/documentation/js-sdk/metadata-sdk/reference/types/DefinedGroup-09c3816e)` | Embedded permission groups. Omit to preserve existing groups or use backend defaults on creation. |
| `settingDependencies` | Optional | `readonly (string \| [DefinedCustomSetting](https://developer.rippling.com/documentation/js-sdk/metadata-sdk/reference/types/DefinedCustomSetting-bb4e233d))[]` | Setting definitions to include in the manifest, or API names of existing settings. Composer currently supports declaring these on creation, but not changing an existing Function's list. |
| `source` | Optional | `URL` | Handler source file read unchanged by project export. Importing the definition performs no file I/O. |
| `viewerGroup` | Optional | `null \| [DefinedGroup](https://developer.rippling.com/documentation/js-sdk/metadata-sdk/reference/types/DefinedGroup-09c3816e)` | — |

[Complete options type](https://developer.rippling.com/documentation/js-sdk/metadata-sdk/reference/types/DefinedFunctionProps-5114fb35)

TypeScript signature

```ts
defineFunction<TInput = unknown, TOutput = unknown>(props: DefinedFunctionProps<TInput, TOutput>): DefinedFunction<TInput, TOutput>;
```

## Returns

```
DefinedFunction<TInput, TOutput>
```

## Availability

| Capability | Support |
| --- | --- |
| Pull into a project | Supported |
| Runtime operations | Available with an authenticated SDK client |

Source: https://developer.rippling.com/documentation/js-sdk/metadata-sdk/reference/defineFunction

> For the complete documentation index, see [llms.txt](https://developer.rippling.com/llms.txt). Public pages have a Markdown version at the same URL with .md added.
