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

# List All Indexes

> Retrieve all available knowledge base indexes

# List All Indexes

Retrieve a comprehensive list of all available knowledge base indexes in the system.

## Endpoint

```
GET /indexes/all
```

## Description

This endpoint returns all knowledge base indexes available in the SecureAI system. It provides detailed information about each index including its type, status, creation date, and metadata. This is useful for discovering available knowledge bases and their capabilities.

## Authentication

**Required**: API Key

```
Authorization: Bearer sk-your-api-key-here
```

## Query Parameters

| Parameter   | Type    | Required | Description |                                                 |
| ----------- | ------- | -------- | ----------- | ----------------------------------------------- |
| `page`      | integer | No       | 1           | Page number for pagination                      |
| `limit`     | integer | No       | 50          | Number of indexes per page (1-100)              |
| `search`    | string  | No       | -           | Search term for index name or shared index name |
| `type`      | string  | No       | -           | Filter by index type (personal, general, group) |
| `status`    | string  | No       | active      | Filter by index status (active, deleted, all)   |
| `sortBy`    | string  | No       | createdAt   | Field to sort by                                |
| `sortOrder` | string  | No       | desc        | Sort order (asc, desc)                          |

## Example Request

```bash theme={null}
GET /indexes/all?type=personal&limit=20&page=1
```

## Success Response

**Status Code**: `200 OK`

```json theme={null}
{
  "success": true,
  "indexes": [
    {
      "id": "60a7c8f5e8b4f5001f7a8c23",
      "name": "my-knowledge-base",
      "sharedIndexName": "my-knowledge-base",
      "namespace": "user-namespace",
      "type": "personal",
      "assignedUser": {
        "id": "60a7c8f5e8b4f5001f7a8c24",
        "name": "John Doe",
        "email": "john@example.com"
      },
      "assignedGroup": null,
      "userId": "60a7c8f5e8b4f5001f7a8c24",
      "isActive": true,
      "createdAt": "2024-01-01T00:00:00.000Z",
      "updatedAt": "2024-01-15T10:30:00.000Z",
      "deletedAt": null
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 50,
    "total": 150,
    "pages": 3
  }
}
```

### Response Fields

| Field                       | Type    | Description                                    |
| --------------------------- | ------- | ---------------------------------------------- |
| `success`                   | boolean | Indicates if the operation was successful      |
| `indexes[]`                 | array   | Array of index objects                         |
| `indexes[].id`              | string  | Unique index identifier                        |
| `indexes[].name`            | string  | Index name                                     |
| `indexes[].sharedIndexName` | string  | Shared index name                              |
| `indexes[].namespace`       | string  | Index namespace                                |
| `indexes[].type`            | string  | Index type (personal, general, group, unknown) |
| `indexes[].assignedUser`    | object  | Assigned user information (if personal)        |
| `indexes[].assignedGroup`   | object  | Assigned group information (if group)          |
| `indexes[].userId`          | string  | User ID                                        |
| `indexes[].isActive`        | boolean | Whether index is active                        |
| `indexes[].createdAt`       | string  | Creation timestamp                             |
| `indexes[].updatedAt`       | string  | Last update timestamp                          |
| `indexes[].deletedAt`       | string  | Deletion timestamp (if deleted)                |
| `pagination`                | object  | Pagination information                         |

## Index Types

| Type       | Description                     | Access                |
| ---------- | ------------------------------- | --------------------- |
| `personal` | User-created personal indexes   | Full access for owner |
| `general`  | Shared organizational indexes   | Varies by permissions |
| `group`    | Group-assigned indexes          | Group members         |
| `unknown`  | Indexes with unclear assignment | Varies                |

## Index Status

| Status    | Description                     |
| --------- | ------------------------------- |
| `active`  | Index is available for use      |
| `deleted` | Index has been deleted          |
| `all`     | Include both active and deleted |

## Example Usage

### JavaScript

```javascript theme={null}
const listIndexes = async (params = {}) => {
  const queryString = new URLSearchParams(params).toString();
  const url = `https://{customer.name}.hiperai.ai/api/external/indexes/all${queryString ? `?${queryString}` : ''}`;
  
  const response = await fetch(url, {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer sk-your-api-key-here'
    }
  });
  
  return await response.json();
};

// Example usage
const result = await listIndexes({
  type: 'personal',
  limit: 10,
  page: 1
});
console.log(result.indexes);
```

### Python

```python theme={null}
import requests

def list_indexes(params=None):
    url = "https://{customer.name}.hiperai.ai/api/external/indexes/all"
    headers = {
        "Authorization": "Bearer sk-your-api-key-here"
    }
    
    response = requests.get(url, headers=headers, params=params)
    return response.json()

# Example usage
params = {
    "type": "personal",
    "limit": 10,
    "page": 1
}

result = list_indexes(params)
print(result["indexes"])
```

### cURL

```bash theme={null}
curl -X GET "https://{customer.name}.hiperai.ai/api/external/indexes/all?type=personal&limit=10&page=1" \
  -H "Authorization: Bearer sk-your-api-key-here"
```

## Error Responses

### 401 Unauthorized

```json theme={null}
{
  "success": false,
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Invalid or missing API key"
  }
}
```

### 429 Too Many Requests

```json theme={null}
{
  "success": false,
  "error": {
    "code": "RATE_LIMIT_EXCEEDED",
    "message": "Rate limit exceeded",
    "retryAfter": 60
  }
}
```

## Filtering Examples

### Filter by Type

```bash theme={null}
# Get only personal indexes
GET /indexes/all?type=personal

# Get only group indexes
GET /indexes/all?type=group
```

### Filter by Status

```bash theme={null}
# Get only active indexes
GET /indexes/all?status=active

# Get deleted indexes
GET /indexes/all?status=deleted
```

### Pagination

```bash theme={null}
# Get first 20 indexes
GET /indexes/all?limit=20&page=1

# Get next 20 indexes
GET /indexes/all?limit=20&page=2
```

## Use Cases

* **Discovery**: Find available knowledge bases for RAG operations
* **Management**: List indexes for administrative purposes
* **Integration**: Discover indexes for application integration
* **Monitoring**: Check index status and metadata
* **Filtering**: Find specific types of indexes (system, personal, etc.)

## Rate Limits

* **Default**: 100 requests per minute
* **Daily**: 10,000 requests per day
* **Monthly**: 300,000 requests per month

## Notes

* This endpoint is only accessible by administrators
* Personal indexes are only visible to their owners
* Group indexes are visible to group members
* The response includes assigned user and group information
* Pagination uses page parameter, not offset
* Filtering by type and status helps narrow down results


## OpenAPI

````yaml GET /indexes/all
openapi: 3.0.3
info:
  title: SecureAI External API
  description: >
    SecureAI External API provides AI chat completion and image generation
    capabilities with knowledge base retrieval, 

    security policies, and comprehensive usage tracking. This API is designed
    for external developers 

    and integrations using API key authentication.


    ## Key Features

    - **RAG (Retrieval-Augmented Generation)**: Automatically search knowledge
    bases for relevant context

    - **Multi-Model Support**: OpenAI, Anthropic, Google, Meta, and other AI
    models

    - **Model Redundancy & Failover**: Caller-defined failover chains (primary +
    fallbacks) with per-attempt timeouts

    - **OpenAI-Compatible Endpoint**: Point any OpenAI SDK at `/api/external/v1`
    — no code changes

    - **Image Generation**: Generate and edit images using Google Gemini 2.5
    Flash Image

    - **Speech-to-Speech (S2S)**: Real-time voice conversations using OpenAI
    Realtime API with WebRTC

    - **Security Policies**: SMLTP policy enforcement, per-call Prompt Shield,
    and signed compliance receipts

    - **Usage Tracking**: Comprehensive usage monitoring, self-service quota,
    and rate limiting

    - **Knowledge Base Integration**: Access to personal and shared knowledge
    bases

    - **User Management**: Complete user, group, and role management
    capabilities

    - **Audit Logging**: Comprehensive activity and security audit logs


    ## Authentication

    All endpoints (except health check) require API key authentication using
    Bearer token:

    ```

    Authorization: Bearer sk-your-api-key-here

    ```


    ## Billing and Usage

    By default, API requests are billed to the user account that owns the API
    key. You can specify 

    a different user to bill by including the `user_id` parameter in your
    request. This allows for:

    - Multi-tenant applications with per-user billing

    - Flexible completion limit management

    - Per-user "Usage by Model" settings


    ## Rate Limits

    - Default: 60 requests per minute, 1000 requests per hour

    - Daily limits: 100 requests (configurable)

    - Monthly limits: 10,000 requests (configurable)


    ## Base URL

    ```

    https://secureai.hiperai.ai/api/external

    ```
  version: 1.1.0
  contact:
    name: SecureAI Support
    email: support@secureai.hiperai.ai
  license:
    name: Proprietary
    url: https://secureai.hiperai.ai/terms
servers:
  - url: https://secureai.hiperai.ai/api/external
    description: Production server
  - url: http://localhost:3010/api/external
    description: Development server
security:
  - ApiKeyAuth: []
tags:
  - name: System
    description: System health and status endpoints
  - name: Discovery
    description: Endpoints to discover available models, indexes, and policies
  - name: Chat
    description: AI chat completion endpoints
  - name: User Management
    description: Endpoints for managing user accounts and roles
  - name: Index Management
    description: Endpoints for managing knowledge base indexes
  - name: Group Management
    description: Endpoints for managing user groups
  - name: SMLTP Security
    description: Endpoints for managing SMLTP security policies and audit logs
  - name: Role Management
    description: Endpoints for managing user roles
  - name: Activity Logs
    description: Endpoints for retrieving activity logs
externalDocs:
  description: SecureAI Documentation
  url: https://secureai.hiperai.ai/docs
paths:
  /indexes/all:
    get:
      tags:
        - Index Management
      summary: Get All Indexes
      description: >
        Retrieve all indexes (both user and group indexes) with pagination and
        filtering. Only accessible by administrators.
      parameters:
        - name: page
          in: query
          description: Page number for pagination
          required: false
          schema:
            type: integer
            default: 1
            minimum: 1
        - name: limit
          in: query
          description: Number of indexes per page
          required: false
          schema:
            type: integer
            default: 50
            minimum: 1
            maximum: 100
        - name: search
          in: query
          description: Search term for index name or shared index name
          required: false
          schema:
            type: string
        - name: type
          in: query
          description: Filter by index type
          required: false
          schema:
            type: string
            enum:
              - personal
              - general
              - group
        - name: status
          in: query
          description: Filter by index status
          required: false
          schema:
            type: string
            enum:
              - active
              - deleted
              - all
            default: active
      responses:
        '200':
          description: List of all indexes
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  indexes:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          example: 60a7c8f5e8b4f5001f7a8c23
                        name:
                          type: string
                          example: my-knowledge-base
                        sharedIndexName:
                          type: string
                          example: my-knowledge-base
                        namespace:
                          type: string
                          example: user-namespace
                        type:
                          type: string
                          enum:
                            - personal
                            - general
                            - group
                            - unknown
                          example: personal
                        assignedUser:
                          type: object
                          nullable: true
                          properties:
                            id:
                              type: string
                              example: 60a7c8f5e8b4f5001f7a8c24
                            name:
                              type: string
                              example: John Doe
                            email:
                              type: string
                              example: john@example.com
                        assignedGroup:
                          type: object
                          nullable: true
                          properties:
                            id:
                              type: string
                              example: 60a7c8f5e8b4f5001f7a8c25
                            name:
                              type: string
                              example: Engineering Team
                        userId:
                          type: string
                          example: 60a7c8f5e8b4f5001f7a8c24
                        isActive:
                          type: boolean
                          example: true
                        createdAt:
                          type: string
                          format: date-time
                          example: '2024-01-01T00:00:00.000Z'
                        updatedAt:
                          type: string
                          format: date-time
                          example: '2024-01-15T10:30:00.000Z'
                        deletedAt:
                          type: string
                          format: date-time
                          nullable: true
                          example: null
                  pagination:
                    type: object
                    properties:
                      page:
                        type: integer
                        example: 1
                      limit:
                        type: integer
                        example: 50
                      total:
                        type: integer
                        example: 150
                      pages:
                        type: integer
                        example: 3
        '401':
          description: Invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Access denied - admin only
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          type: string
          example: Invalid API key
        message:
          type: string
          example: The provided API key is invalid or has been revoked
        request_id:
          type: string
          example: req-abc123
          description: Request ID for tracking (if available)
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      description: |
        API key authentication using Bearer token format.
        Example: `Authorization: Bearer sk-your-api-key-here`

````