> ## Documentation Index
> Fetch the complete documentation index at: https://docs.threadify.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Querying Steps

> Get step data and history

### Getting Steps

<CodeGroup>
  ```javascript JavaScript theme={null}
  // All steps
  const steps = await thread.steps();

  // Specific step
  const orderSteps = await thread.steps('order_placed');

  // With filters
  const failedSteps = await thread.steps('payment_processed', { 
    status: 'failed',
    limit: 50
  });
  ```

  ```go Go theme={null}
  // All steps
  steps, err := thread.Steps(ctx, "", "", "")
  if err != nil {
      log.Fatal(err)
  }

  // Specific step
  orderSteps, err := thread.Steps(ctx, "order_placed", "", "")
  if err != nil {
      log.Fatal(err)
  }

  // With filters
  failedSteps, err := thread.Steps(ctx, "payment_processed", "", "failed")
  if err != nil {
      log.Fatal(err)
  }
  ```

  ```python Python theme={null}
  # All steps
  steps = await archived_thread.steps()

  # Specific step
  order_steps = await archived_thread.steps(step_name="order_placed")

  # With filters
  failed_steps = await archived_thread.steps(
      step_name="payment_processed",
      status="failed"
  )
  ```
</CodeGroup>

### Filter Options

| Option          | Type   | Description           |
| --------------- | ------ | --------------------- |
| `status`        | string | `success` or `failed` |
| `startedAfter`  | string | ISO timestamp filter  |
| `startedBefore` | string | ISO timestamp filter  |
| `limit`         | number | Max results           |

### Step Properties

| Property         | Type   | Description           |
| ---------------- | ------ | --------------------- |
| `stepId`         | string | Step ID               |
| `stepName`       | string | Step name             |
| `status`         | string | `success` or `failed` |
| `idempotencyKey` | string | Idempotency key       |
| `context`        | object | Business context      |
| `createdAt`      | string | ISO timestamp         |
| `retryCount`     | number | Retry attempts        |

### Step History

<CodeGroup>
  ```javascript JavaScript theme={null}
  const history = await step.history();
  ```

  ```go Go theme={null}
  history, err := step.History(ctx)
  if err != nil {
      log.Fatal(err)
  }
  ```

  ```python Python theme={null}
  from threadify.models import HistoryQueryOptions

  history = await step.history(HistoryQueryOptions(limit=100))
  ```
</CodeGroup>

### History Properties

| Property    | Type   | Description           |
| ----------- | ------ | --------------------- |
| `attempt`   | number | Attempt number        |
| `status`    | string | `success` or `failed` |
| `timestamp` | string | ISO timestamp         |
| `context`   | object | Context at attempt    |
| `error`     | string | Error message         |
| `duration`  | number | Execution time (ms)   |

### Next Steps

<CardGroup cols={2}>
  <Card title="Validation Results" icon="shield-check" href="/core-concepts/data-retrieval/validation-results">
    Query contract violations
  </Card>

  <Card title="Sub-steps" icon="list-tree" href="/core-concepts/sub-steps">
    Track granular operations
  </Card>
</CardGroup>
