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

# Get Available Steps

> Get all available steps for a taxonomy and collection.

This endpoint discovers what steps exist in your analytics data by querying
the ClickHouse taxonomy_events table. Use this before querying transitions
or paths to understand what step values you can use.

**Use Cases:**
- Discover available steps before querying analytics
- Validate step names (avoid typos in from_step/to_step)
- See which steps have the most events
- Check data freshness (first_seen/last_seen timestamps)

**Example Usage:**
```python
# 1. Get available steps
GET /v1/taxonomies/tax_sales/analytics/available-steps?collection_id=col_emails

# Response:
{
    "taxonomy_id": "tax_sales",
    "collection_id": "col_emails",
    "total_events": 5432,
    "total_sequences": 1000,
    "steps": [
        {"step_key": "inquiry", "event_count": 1000, ...},
        {"step_key": "followup", "event_count": 450, ...},
        {"step_key": "closed_won", "event_count": 350, ...}
    ]
}

# 2. Use discovered steps in transition query
POST /v1/taxonomies/tax_sales/analytics/transitions
{
    "collection_id": "col_emails",
    "from_step": "inquiry",      # From available steps
    "to_step": "closed_won"      # From available steps
}
```

Args:
    request: FastAPI request object (contains tenant context)
    taxonomy_id: Taxonomy ID to query
    collection_id: Collection ID for filtering events

Returns:
    AvailableStepsResponse with all steps sorted by event count (descending)

Raises:
    NotFoundError: If taxonomy not found
    ValidationError: If unable to query ClickHouse



## OpenAPI

````yaml get /v1/taxonomies/{taxonomy_id}/analytics/available-steps
openapi: 3.1.0
info:
  title: Mixpeek API
  description: >-
    This is the Mixpeek API, providing access to various endpoints for data
    processing and retrieval.
  termsOfService: https://mixpeek.com/terms
  contact:
    name: Mixpeek Support
    url: https://mixpeek.com/contact
    email: info@mixpeek.com
  version: '0.82'
servers:
  - url: https://api.mixpeek.com
    description: Production
security: []
paths:
  /v1/taxonomies/{taxonomy_id}/analytics/available-steps:
    get:
      tags:
        - Taxonomy Analytics
      summary: Get Available Steps
      description: >-
        Get all available steps for a taxonomy and collection.


        This endpoint discovers what steps exist in your analytics data by
        querying

        the ClickHouse taxonomy_events table. Use this before querying
        transitions

        or paths to understand what step values you can use.


        **Use Cases:**

        - Discover available steps before querying analytics

        - Validate step names (avoid typos in from_step/to_step)

        - See which steps have the most events

        - Check data freshness (first_seen/last_seen timestamps)


        **Example Usage:**

        ```python

        # 1. Get available steps

        GET
        /v1/taxonomies/tax_sales/analytics/available-steps?collection_id=col_emails


        # Response:

        {
            "taxonomy_id": "tax_sales",
            "collection_id": "col_emails",
            "total_events": 5432,
            "total_sequences": 1000,
            "steps": [
                {"step_key": "inquiry", "event_count": 1000, ...},
                {"step_key": "followup", "event_count": 450, ...},
                {"step_key": "closed_won", "event_count": 350, ...}
            ]
        }


        # 2. Use discovered steps in transition query

        POST /v1/taxonomies/tax_sales/analytics/transitions

        {
            "collection_id": "col_emails",
            "from_step": "inquiry",      # From available steps
            "to_step": "closed_won"      # From available steps
        }

        ```


        Args:
            request: FastAPI request object (contains tenant context)
            taxonomy_id: Taxonomy ID to query
            collection_id: Collection ID for filtering events

        Returns:
            AvailableStepsResponse with all steps sorted by event count (descending)

        Raises:
            NotFoundError: If taxonomy not found
            ValidationError: If unable to query ClickHouse
      operationId: >-
        get_available_steps_v1_taxonomies__taxonomy_id__analytics_available_steps_get
      parameters:
        - name: taxonomy_id
          in: path
          required: true
          schema:
            type: string
            title: Taxonomy Id
        - name: collection_id
          in: query
          required: true
          schema:
            type: string
            description: Collection ID to analyze
            title: Collection Id
          description: Collection ID to analyze
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AvailableStepsResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    AvailableStepsResponse:
      properties:
        taxonomy_id:
          type: string
          title: Taxonomy Id
          description: Taxonomy ID
        collection_id:
          type: string
          title: Collection Id
          description: Collection ID
        total_events:
          type: integer
          minimum: 0
          title: Total Events
          description: Total events in dataset
        total_sequences:
          type: integer
          minimum: 0
          title: Total Sequences
          description: Total unique sequences
        steps:
          items:
            $ref: '#/components/schemas/StepInfo'
          type: array
          title: Steps
          description: Available steps sorted by count
      type: object
      required:
        - taxonomy_id
        - collection_id
        - total_events
        - total_sequences
        - steps
      title: AvailableStepsResponse
      description: >-
        Response containing all available steps for a taxonomy/collection.


        This endpoint helps users discover what steps exist in their analytics
        data

        before querying transitions or paths.


        Example Response:
            ```json
            {
                "taxonomy_id": "tax_sales_stages",
                "collection_id": "col_emails",
                "total_events": 5432,
                "total_sequences": 1000,
                "steps": [
                    {
                        "step_key": "inquiry",
                        "event_count": 1000,
                        "sequence_count": 1000,
                        "first_seen": "2025-11-01T00:00:00Z",
                        "last_seen": "2025-12-07T00:00:00Z"
                    },
                    {
                        "step_key": "followup",
                        "event_count": 450,
                        "sequence_count": 450,
                        "first_seen": "2025-11-02T00:00:00Z",
                        "last_seen": "2025-12-06T00:00:00Z"
                    },
                    {
                        "step_key": "closed_won",
                        "event_count": 350,
                        "sequence_count": 350,
                        "first_seen": "2025-11-05T00:00:00Z",
                        "last_seen": "2025-12-07T00:00:00Z"
                    }
                ]
            }
            ```
    ErrorResponse:
      properties:
        success:
          type: boolean
          title: Success
          description: Always false for error responses
          default: false
        status:
          type: integer
          title: Status
          description: HTTP status code for this error
        error:
          $ref: '#/components/schemas/ErrorDetail'
          description: Error details payload
      type: object
      required:
        - status
        - error
      title: ErrorResponse
      description: Error response model.
      examples:
        - error:
            details:
              id: ns_123
              resource: namespace
            message: Namespace not found
            type: NotFoundError
          status: 404
          success: false
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    StepInfo:
      properties:
        step_key:
          type: string
          title: Step Key
          description: Step identifier
        event_count:
          type: integer
          minimum: 0
          title: Event Count
          description: Total events for this step
        sequence_count:
          type: integer
          minimum: 0
          title: Sequence Count
          description: Unique sequences with this step
        first_seen:
          type: string
          title: First Seen
          description: Earliest event timestamp (ISO format)
        last_seen:
          type: string
          title: Last Seen
          description: Most recent event timestamp (ISO format)
      type: object
      required:
        - step_key
        - event_count
        - sequence_count
        - first_seen
        - last_seen
      title: StepInfo
      description: |-
        Information about a single step in the taxonomy analytics data.

        Attributes:
            step_key: The step identifier (e.g., "inquiry", "closed_won")
            event_count: Number of events with this step
            sequence_count: Number of unique sequences with this step
            first_seen: ISO timestamp of earliest event with this step
            last_seen: ISO timestamp of most recent event with this step
    ErrorDetail:
      properties:
        message:
          type: string
          title: Message
          description: Human-readable error message
        type:
          type: string
          title: Type
          description: Stable error type identifier (machine-readable)
        code:
          anyOf:
            - type: string
            - type: 'null'
          title: Code
          description: >-
            Fine-grained error code for programmatic handling (e.g.,
            namespace_name_taken, feature_extractor_not_found). Present only
            when consumers may need to branch on a specific error condition.
        details:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Details
          description: >-
            Optional structured details to help debugging (validation errors,
            IDs, etc.)
      type: object
      required:
        - message
        - type
      title: ErrorDetail
      description: Error detail model.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````