---
title: "Swarms hooks"
description: "Hand-written shim. Implementation is generated; see ./swarms.gen."
section: "Libraries"
group: "React hooks"
order: 454
---

## Hooks

### `useCreateSwarm` `mutation`

Create a swarm.

```ts
useCreateSwarm(options?: MutationOpts<Swarm, CreateSwarmParams>)
```

**Types:** [Swarm](/types/swarm) · [CreateSwarmParams](/types/create-swarm-params)

### `useDeleteSwarm` `mutation`

Soft-delete a swarm.

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

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

### `useListSwarms` `query`

List swarms.

```ts
useListSwarms(params?: Omit<ListSwarmsParams, | > & { filter?: SwarmFilter; orderBy?: SwarmOrderBy[]; } & SwarmShorthands, options?: QueryOpts<Page<Swarm>>)
```

**Types:** [ListSwarmsParams](/types/list-swarms-params) · [SwarmFilter](/types/swarm-filter) · [SwarmOrderBy](/types/swarm-order-by) · [SwarmShorthands](/types/swarm-shorthands) · [Page](/types/page) · [Swarm](/types/swarm)

### `usePurgeSwarm` `composite`

Permanently delete a soft-deleted swarm.

```ts
usePurgeSwarm(options?: MutationOpts<SuccessResponse, PurgeSwarmParams>)
```

**Types:** [SuccessResponse](/types/success-response) · [PurgeSwarmParams](/types/purge-swarm-params)

### `useRestoreSwarm` `composite`

Restore a soft-deleted swarm.

```ts
useRestoreSwarm(options?: MutationOpts<Swarm, string>)
```

**Types:** [Swarm](/types/swarm)

### `useRetrieveSwarm` `query`

Get a swarm by ID.

```ts
useRetrieveSwarm(id: string, options?: QueryOpts<Swarm>)
```

**Types:** [Swarm](/types/swarm)

### `useUpdateSwarm` `mutation`

Update a swarm.

```ts
useUpdateSwarm(options?: MutationOpts<Swarm, UpdateSwarmParams>)
```

**Types:** [Swarm](/types/swarm) · [UpdateSwarmParams](/types/update-swarm-params)
