---
title: Server API Reference
description: Kodit Server REST API Documentation
weight: 30
---

This file is automatically generated from the Kodit server OpenAPI specification.
You can view the live API documentation on the `/docs` endpoint of your Kodit server or
look at the [hosted version](https://kodit.helix.ml/docs).


This is the REST API for the Kodit server. Please refer to the
[Kodit documentation](https://docs.helix.ml/kodit/) for more information.
    
Current version: 0.4.4

## Authentication



### Security Schemes

| Name              | Type              | Description              | Scheme              | Bearer Format             |
|-------------------|-------------------|--------------------------|---------------------|---------------------------|
| Header (X-API-KEY) | apiKey | API key for authentication (only if set in environmental variables) |  |  |

## APIs

### GET /healthz

Return a health check for the kodit API.


#### Responses

- 200: Successful Response

- 500: Internal server error

### GET /api/v1/indexes

List all indexes.


#### Responses

- 200: Successful Response

[IndexListResponse](#indexlistresponse)

- 500: Internal server error

- 401: Unauthorized

- 422: Invalid request

### POST /api/v1/indexes

Create a new index and start async indexing.


#### Request Body

[IndexCreateRequest](#indexcreaterequest)


#### Responses

- 202: Successful Response

[IndexResponse](#indexresponse)

- 500: Internal server error

- 401: Unauthorized

- 422: Invalid request

### GET /api/v1/indexes/{index_id}

Get index details.


#### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| index_id | integer | True |  |


#### Responses

- 200: Successful Response

[IndexDetailResponse](#indexdetailresponse)

- 500: Internal server error

- 401: Unauthorized

- 422: Invalid request

- 404: Index not found

### DELETE /api/v1/indexes/{index_id}

Delete an index.


#### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| index_id | integer | True |  |


#### Responses

- 204: Successful Response

- 500: Internal server error

- 401: Unauthorized

- 422: Invalid request

- 404: Index not found

### GET /api/v1/indexes/{index_id}/status

Get the status of tasks for an index.


#### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| index_id | integer | True |  |


#### Responses

- 200: Successful Response

[TaskStatusListResponse](#taskstatuslistresponse)

- 500: Internal server error

- 401: Unauthorized

- 422: Invalid request

- 404: Index not found

### GET /api/v1/queue

List all tasks in the queue.

Optionally filter by task type.


#### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| task_type |  | False |  |


#### Responses

- 200: Successful Response

[TaskListResponse](#tasklistresponse)

- 500: Internal server error

- 401: Unauthorized

- 422: Invalid request

### GET /api/v1/queue/{task_id}

Get details of a specific task in the queue.


#### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| task_id | string | True |  |


#### Responses

- 200: Successful Response

[TaskResponse](#taskresponse)

- 500: Internal server error

- 401: Unauthorized

- 422: Invalid request

- 404: Task not found

### POST /api/v1/search

Search code snippets with filters matching MCP tool.


#### Request Body

[SearchRequest](#searchrequest)


#### Responses

- 200: Successful Response

[SearchResponse](#searchresponse)

- 500: Internal server error

- 422: Validation Error

[HTTPValidationError](#httpvalidationerror)

## Components



### HTTPValidationError



| Field | Type | Description |
|-------|------|-------------|
| detail | array |  |


### IndexAttributes


Index attributes for JSON:API responses.


| Field | Type | Description |
|-------|------|-------------|
| created_at | string |  |
| updated_at | string |  |
| uri | string |  |


### IndexCreateAttributes


Attributes for creating an index.


| Field | Type | Description |
|-------|------|-------------|
| uri | string | URI of the source to index |


### IndexCreateData


Data for creating an index.


| Field | Type | Description |
|-------|------|-------------|
| type | string |  |
| attributes |  |  |


### IndexCreateRequest


JSON:API request for creating an index.


| Field | Type | Description |
|-------|------|-------------|
| data |  |  |


### IndexData


Index data for JSON:API responses.


| Field | Type | Description |
|-------|------|-------------|
| type | string |  |
| id | string |  |
| attributes |  |  |


### IndexDetailResponse


JSON:API response for index details with included resources.


| Field | Type | Description |
|-------|------|-------------|
| data |  |  |


### IndexListResponse


JSON:API response for index list.


| Field | Type | Description |
|-------|------|-------------|
| data | array |  |


### IndexResponse


JSON:API response for single index.


| Field | Type | Description |
|-------|------|-------------|
| data |  |  |


### SearchAttributes


Search attributes for JSON:API requests.


| Field | Type | Description |
|-------|------|-------------|
| keywords |  | Search keywords |
| code |  | Code search query |
| text |  | Text search query |
| limit |  | Maximum number of results to return |
| filters |  | Search filters |


### SearchData


Search data for JSON:API requests.


| Field | Type | Description |
|-------|------|-------------|
| type | string |  |
| attributes |  |  |


### SearchFilters


Search filters for JSON:API requests.


| Field | Type | Description |
|-------|------|-------------|
| languages |  | Programming languages to filter by |
| authors |  | Authors to filter by |
| start_date |  | Filter snippets created after this date |
| end_date |  | Filter snippets created before this date |
| sources |  | Source repositories to filter by |
| file_patterns |  | File path patterns to filter by |


### SearchRequest


JSON:API request for searching snippets.


| Field | Type | Description |
|-------|------|-------------|
| data |  |  |


### SearchResponse


JSON:API response for search results.


| Field | Type | Description |
|-------|------|-------------|
| data | array |  |


### SnippetAttributes


Snippet attributes for JSON:API responses.


| Field | Type | Description |
|-------|------|-------------|
| content | string |  |
| created_at | string |  |
| updated_at | string |  |
| original_scores | array |  |
| source_uri | string |  |
| relative_path | string |  |
| language | string |  |
| authors | array |  |
| summary | string |  |


### SnippetData


Snippet data for JSON:API responses.


| Field | Type | Description |
|-------|------|-------------|
| type | string |  |
| id | integer |  |
| attributes |  |  |


### TaskAttributes


Task attributes for JSON:API responses.


| Field | Type | Description |
|-------|------|-------------|
| type | string |  |
| priority | integer |  |
| payload | object |  |
| created_at |  |  |
| updated_at |  |  |


### TaskData


Task data for JSON:API responses.


| Field | Type | Description |
|-------|------|-------------|
| type | string |  |
| id | string |  |
| attributes |  |  |


### TaskListResponse


JSON:API response for task list.


| Field | Type | Description |
|-------|------|-------------|
| data | array |  |


### TaskResponse


JSON:API response for single task.


| Field | Type | Description |
|-------|------|-------------|
| data |  |  |


### TaskStatusAttributes


Task status attributes for JSON:API responses.


| Field | Type | Description |
|-------|------|-------------|
| step | string | Name of the task/operation |
| state | string | Current state of the task |
| progress | number | Progress percentage (0-100) |
| total | integer | Total number of items to process |
| current | integer | Current number of items processed |
| created_at |  | Task start time |
| updated_at |  | Last update time |


### TaskStatusData


Task status data for JSON:API responses.


| Field | Type | Description |
|-------|------|-------------|
| type | string |  |
| id | string |  |
| attributes |  |  |


### TaskStatusListResponse


JSON:API response for task status list.


| Field | Type | Description |
|-------|------|-------------|
| data | array |  |


### TaskType


Task type.




### ValidationError



| Field | Type | Description |
|-------|------|-------------|
| loc | array |  |
| msg | string |  |
| type | string |  |
