---
title: "CreateFunctionBody"
description: "Request body for creating a Function."
section: "Reference"
group: "Types"
order: 99
---

## Definition

```ts
interface CreateFunctionBody {
  workspaceId: string;
  name: string;
  inputSchemaId: string;
  outputSchemaId: string;
  description?: string | undefined;
  source?: "custom" | "system" | "openapi-op" | undefined;
}
```

## Fields

| Field            | Type                                                | Notes                                                                                                                                               |
| ---------------- | --------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| `workspaceId`    | `string`                                            | `required` — Workspace that will own the new function.                                                                                              |
| `name`           | `string`                                            | `required` — Function name                                                                                                                          |
| `inputSchemaId`  | `string`                                            | `required` — Schema enforced on the initial version's input. Required — both I/O contracts must be set so the function is composable from creation. |
| `outputSchemaId` | `string`                                            | `required` — Schema for the initial version's return value. Required — see `inputSchemaId`.                                                         |
| `description`    | `string \| undefined`                               | `optional` — Function description                                                                                                                   |
| `source`         | `"custom" \| "system" \| "openapi-op" \| undefined` | `optional` — Override the source; defaults to 'custom' for user-created functions.                                                                  |
