---
title: "Fleet in the SDK"
canonical: https://trickest.com/docs/developer-tools/sdk/fleet
description: "List fleets, manage machine registrations, and understand fleet API limits in @trickest/sdk."
---

# Fleet in the SDK

## Inspect fleets and machines

Use `client.fleet` to inspect execution capacity in the token's vault. Examples use an authenticated `client: TrickestClient` and a selected string `fleetId`.

| Method                                  | Description                                    |
| --------------------------------------- | ---------------------------------------------- |
| `list(options?)`                        | `AsyncGenerator<Fleet>`                        |
| `get(id, options?)`                     | Declared helper; use `list()` to find the fleet instead |
| `create(data, options?)`                | `{ name, max_machines? }`                      |
| `delete(id, options?)`                  | Declared helper; the backend does not support fleet deletion |
| `scale(id, data, options?)`             | Declared `{ max_machines }` payload; the backend does not support fleet scaling |
| `listMachines(fleetId?, options?)`      | Machines generator; optionally filter by fleet |
| `createMachine(fleetId, options?)`      | Register a machine in a fleet                  |
| `updateMachine(id, { name }, options?)` | Rename a registered machine                    |
| `deleteMachine(id, options?)`           | Remove a machine registration                  |

```ts
for await (const fleet of client.fleet.list()) {
  console.log(fleet.name, fleet.machines);
}

for await (const machine of client.fleet.listMachines(fleetId)) {
  console.log(machine.id, machine.name);
}
```

<Note>
  The current fleet-create route creates a self-hosted fleet with server
  defaults; it does not apply the SDK's `name` or `max_machines` body fields.
  Read the returned fleet instead of assuming those requested values took
  effect. Fleet `get()`, `delete()`, and `scale()` are unsupported.
  Find a fleet by ID while iterating `list()`.
</Note>

Use `createMachine()` and `deleteMachine()` to manage registrations within your
account's machine limit. `createMachine()` returns registration credentials;
store them securely and follow the
[machine enrollment guide](/docs/key-concepts/machines-and-fleet). Do not print
its authentication secret in logs.

**Types:** `Fleet`, `Machine`, `CreateFleet`, `ScaleFleet`

<Info>
  **Concepts:** [Machines & Fleet](/docs/key-concepts/machines-and-fleet).
  **CLI:** [Fleet](/docs/developer-tools/cli/fleet).
</Info>

---
_Markdown source of https://trickest.com/docs/developer-tools/sdk/fleet._
