---
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?)`                     | Fetch through the fleet detail route; backend support applies |
| `create(data, options?)`                | `{ name, max_machines? }`                      |
| `delete(id, options?)`                  | Request fleet deletion; backend support and permissions apply |
| `scale(id, data, options?)`             | Request `{ max_machines }`; backend support and limits apply |
| `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()` forward to the workflow backend.
  Handle a rejected operation; a declared SDK method is not proof that your
  backend supports it. You can also 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._
