---
title: "Function Versions hooks"
description: "Hand-written shim. Generated CRUD hooks via ./function-versions.gen.
useForkFunctionVersion + useSetDefaultFunctionVersion stay hand-written
(the codegen skips `custom` ops)."
section: "Libraries"
group: "React hooks"
order: 422
---

## Hooks

### `useCreateFunctionVersion` `mutation`

Create an ADDITIONAL version of an existing function. The initial v1 is created automatically by `createFunction` — do NOT call this right after `createFunction`. Use this only when you actually need a v2+, or use `forkFunctionVersion` to branch from a specific version.

```ts
useCreateFunctionVersion(options?: MutationOpts<FunctionVersion, CreateFunctionVersionParams>)
```

**Types:** [FunctionVersion](/types/function-version) · [CreateFunctionVersionParams](/types/create-function-version-params)

### `useDeleteFunctionVersion` `mutation`

Soft-delete a function version.

```ts
useDeleteFunctionVersion(options?: MutationOpts<SuccessResponse, string>)
```

**Types:** [SuccessResponse](/types/success-response)

### `useForkFunctionVersion` `composite`

```ts
useForkFunctionVersion(options?: MutationOpts<FunctionVersion, ForkFunctionVersionParams>)
```

**Types:** [FunctionVersion](/types/function-version) · [ForkFunctionVersionParams](/types/fork-function-version-params)

### `useListFunctionVersions` `query`

List function versions.

```ts
useListFunctionVersions(params?: Omit<ListFunctionVersionsParams, | > & { filter?: FunctionVersionFilter; orderBy?: FunctionVersionOrderBy[]; } & FunctionVersionShorthands, options?: QueryOpts<Page<FunctionVersion>>)
```

**Types:** [ListFunctionVersionsParams](/types/list-function-versions-params) · [FunctionVersionFilter](/types/function-version-filter) · [FunctionVersionOrderBy](/types/function-version-order-by) · [FunctionVersionShorthands](/types/function-version-shorthands) · [Page](/types/page) · [FunctionVersion](/types/function-version)

### `usePurgeFunctionVersion` `composite`

Permanently delete a soft-deleted function version.

```ts
usePurgeFunctionVersion(options?: MutationOpts<SuccessResponse, PurgeFunctionVersionParams>)
```

**Types:** [SuccessResponse](/types/success-response) · [PurgeFunctionVersionParams](/types/purge-function-version-params)

### `useRestoreFunctionVersion` `composite`

Restore a soft-deleted function version.

```ts
useRestoreFunctionVersion(options?: MutationOpts<FunctionVersion, string>)
```

**Types:** [FunctionVersion](/types/function-version)

### `useRetrieveFunctionVersion` `query`

Get a function version by ID.

```ts
useRetrieveFunctionVersion(id: string, options?: QueryOpts<FunctionVersion>)
```

**Types:** [FunctionVersion](/types/function-version)

### `useSetDefaultFunctionVersion` `composite`

```ts
useSetDefaultFunctionVersion(options?: MutationOpts<Function, SetDefaultFunctionVersionParams>)
```

**Types:** [Function](/types/function) · [SetDefaultFunctionVersionParams](/types/set-default-function-version-params)

### `useUpdateFunctionVersion` `mutation`

Update a function version.

```ts
useUpdateFunctionVersion(options?: MutationOpts<FunctionVersion, UpdateFunctionVersionParams>)
```

**Types:** [FunctionVersion](/types/function-version) · [UpdateFunctionVersionParams](/types/update-function-version-params)
