Server API Reference

Server API Reference

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.

This is the REST API for the Kodit server. Please refer to the Kodit documentation for more information.

Current version: 0.5.15

Authentication

Security Schemes

NameTypeDescriptionSchemeBearer Format
Header (X-API-KEY)apiKeyAPI 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/queue

List all tasks in the queue.

Optionally filter by task type.

Parameters

NameTypeRequiredDescription
task_typeFalse

Responses

  • 200: Successful Response

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

NameTypeRequiredDescription
task_idstringTrue

Responses

  • 200: Successful Response

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

Responses

  • 200: Successful Response

SearchResponse

  • 500: Internal server error

  • 422: Validation Error

HTTPValidationError

GET /api/v1/repositories/{repo_id}/commits

List all commits for a repository.

Parameters

NameTypeRequiredDescription
repo_idstringTrue
pageintegerFalsePage number, starting from 1
page_sizeintegerFalseItems per page

Responses

  • 200: Successful Response

CommitListResponse

  • 500: Internal server error

  • 401: Unauthorized

  • 422: Invalid request

GET /api/v1/repositories/{repo_id}/commits/{commit_sha}

Get a specific commit for a repository.

Parameters

NameTypeRequiredDescription
repo_idstringTrue
commit_shastringTrue

Responses

  • 200: Successful Response

CommitResponse

  • 500: Internal server error

  • 401: Unauthorized

  • 422: Invalid request

  • 404: Repository or commit not found

GET /api/v1/repositories/{repo_id}/commits/{commit_sha}/files

List all files in a specific commit.

Parameters

NameTypeRequiredDescription
repo_idstringTrue
commit_shastringTrue
pageintegerFalsePage number, starting from 1
page_sizeintegerFalseItems per page

Responses

  • 200: Successful Response

FileListResponse

  • 500: Internal server error

  • 401: Unauthorized

  • 422: Invalid request

GET /api/v1/repositories/{repo_id}/commits/{commit_sha}/files/{blob_sha}

Get a specific file from a commit.

Parameters

NameTypeRequiredDescription
repo_idstringTrue
commit_shastringTrue
blob_shastringTrue

Responses

  • 200: Successful Response

FileResponse

  • 500: Internal server error

  • 401: Unauthorized

  • 422: Invalid request

  • 404: Repository, commit or file not found

GET /api/v1/repositories/{repo_id}/commits/{commit_sha}/snippets

List all snippets in a specific commit.

Parameters

NameTypeRequiredDescription
repo_idstringTrue
commit_shastringTrue

Responses

  • 200: Successful Response

  • 500: Internal server error

  • 401: Unauthorized

  • 422: Invalid request

  • 404: Repository or commit not found

GET /api/v1/repositories/{repo_id}/commits/{commit_sha}/embeddings

List all embeddings for snippets in a specific commit.

Parameters

NameTypeRequiredDescription
repo_idstringTrue
commit_shastringTrue
fullbooleanFalseIf true, return full vectors. If false, return first 5 values.

Responses

  • 200: Successful Response

EmbeddingListResponse

  • 500: Internal server error

  • 401: Unauthorized

  • 422: Invalid request

  • 404: Repository or commit not found

GET /api/v1/repositories/{repo_id}/commits/{commit_sha}/enrichments

List all enrichments for a specific commit.

Parameters

NameTypeRequiredDescription
repo_idstringTrue
commit_shastringTrue
enrichment_typeFalse
pageintegerFalsePage number, starting from 1
page_sizeintegerFalseItems per page

Responses

  • 200: Successful Response

EnrichmentListResponse

  • 500: Internal server error

  • 401: Unauthorized

  • 422: Invalid request

  • 404: Repository or commit not found

DELETE /api/v1/repositories/{repo_id}/commits/{commit_sha}/enrichments

Delete all enrichments for a specific commit.

Parameters

NameTypeRequiredDescription
repo_idstringTrue
commit_shastringTrue

Responses

  • 204: Successful Response

  • 500: Internal server error

  • 401: Unauthorized

  • 422: Invalid request

  • 404: Repository or commit not found

DELETE /api/v1/repositories/{repo_id}/commits/{commit_sha}/enrichments/{enrichment_id}

Delete a specific enrichment for a commit.

Parameters

NameTypeRequiredDescription
repo_idstringTrue
commit_shastringTrue
enrichment_idintegerTrue

Responses

  • 204: Successful Response

  • 500: Internal server error

  • 401: Unauthorized

  • 422: Invalid request

  • 404: Repository, commit, or enrichment not found

GET /api/v1/repositories

List all cloned repositories.

Responses

  • 200: Successful Response

RepositoryListResponse

  • 500: Internal server error

  • 401: Unauthorized

  • 422: Invalid request

POST /api/v1/repositories

Create a new repository or trigger re-indexing if it exists.

Request Body

RepositoryCreateRequest

Responses

  • 200: Successful Response

RepositoryResponse

  • 500: Internal server error

  • 401: Unauthorized

  • 422: Invalid request

GET /api/v1/repositories/{repo_id}

Get repository details including branches and recent commits.

Parameters

NameTypeRequiredDescription
repo_idstringTrue

Responses

  • 200: Successful Response

RepositoryDetailsResponse

  • 500: Internal server error

  • 401: Unauthorized

  • 422: Invalid request

  • 404: Repository not found

DELETE /api/v1/repositories/{repo_id}

Delete a repository and all its associated data.

Parameters

NameTypeRequiredDescription
repo_idstringTrue

Responses

  • 204: Successful Response

  • 500: Internal server error

  • 401: Unauthorized

  • 422: Invalid request

  • 404: Repository not found

GET /api/v1/repositories/{repo_id}/status

Get the status of tasks for an index.

Parameters

NameTypeRequiredDescription
repo_idintegerTrue

Responses

  • 200: Successful Response

TaskStatusListResponse

  • 500: Internal server error

  • 401: Unauthorized

  • 422: Invalid request

  • 404: Repository or index not found

GET /api/v1/repositories/{repo_id}/status/summary

Get a summary of the repository indexing status.

Parameters

NameTypeRequiredDescription
repo_idintegerTrue

Responses

  • 200: Successful Response

RepositoryStatusSummaryResponse

  • 500: Internal server error

  • 401: Unauthorized

  • 422: Invalid request

  • 404: Repository not found

GET /api/v1/repositories/{repo_id}/tags

List all tags for a repository.

Parameters

NameTypeRequiredDescription
repo_idstringTrue

Responses

  • 200: Successful Response

TagListResponse

  • 500: Internal server error

  • 401: Unauthorized

  • 422: Invalid request

  • 404: Repository not found

GET /api/v1/repositories/{repo_id}/tags/{tag_id}

Get a specific tag for a repository.

Parameters

NameTypeRequiredDescription
repo_idstringTrue
tag_idstringTrue

Responses

  • 200: Successful Response

TagResponse

  • 500: Internal server error

  • 401: Unauthorized

  • 422: Invalid request

  • 404: Repository or tag not found

GET /api/v1/repositories/{repo_id}/enrichments

List the most recent enrichments for a repository.

Uses the repository’s tracking_config to find the most recent enriched commit.

Query parameters:

  • enrichment_type: Optional filter for specific enrichment type.
  • max_commits_to_check: Number of recent commits to search (default: 100).
  • limit: Maximum number of enrichments to return. Defaults to 10.

Parameters

NameTypeRequiredDescription
repo_idstringTrue
enrichment_typeFalse
max_commits_to_checkintegerFalseNumber of recent commits to search for recent enriched commits
pageintegerFalsePage number, starting from 1
page_sizeintegerFalseItems per page

Responses

  • 200: Successful Response

EnrichmentListResponse

  • 500: Internal server error

  • 401: Unauthorized

  • 422: Invalid request

  • 404: Repository not found

GET /api/v1/enrichments

List all enrichments with optional filtering.

Parameters

NameTypeRequiredDescription
enrichment_typeFalseFilter by enrichment type
enrichment_subtypeFalseFilter by enrichment subtype
pageintegerFalsePage number, starting from 1
page_sizeintegerFalseItems per page

Responses

  • 200: Successful Response

EnrichmentListResponse

  • 500: Internal server error

  • 401: Unauthorized

  • 422: Invalid request

GET /api/v1/enrichments/{enrichment_id}

Get a specific enrichment by ID.

Parameters

NameTypeRequiredDescription
enrichment_idstringTrue

Responses

  • 200: Successful Response

EnrichmentResponse

  • 500: Internal server error

  • 401: Unauthorized

  • 422: Invalid request

  • 404: Enrichment not found

PATCH /api/v1/enrichments/{enrichment_id}

Update an enrichment’s content.

Parameters

NameTypeRequiredDescription
enrichment_idstringTrue

Request Body

EnrichmentUpdateRequest

Responses

  • 200: Successful Response

EnrichmentResponse

  • 500: Internal server error

  • 401: Unauthorized

  • 422: Invalid request

  • 404: Enrichment not found

DELETE /api/v1/enrichments/{enrichment_id}

Delete an enrichment.

Parameters

NameTypeRequiredDescription
enrichment_idstringTrue

Responses

  • 204: Successful Response

  • 500: Internal server error

  • 401: Unauthorized

  • 422: Invalid request

  • 404: Enrichment not found

Components

CommitAttributes

Commit attributes following JSON-API spec.

FieldTypeDescription
commit_shastring
datestring
messagestring
parent_commit_shastring
authorstring

CommitData

Commit data following JSON-API spec.

FieldTypeDescription
typestring
idstring
attributes

CommitListResponse

Commit list response following JSON-API spec.

FieldTypeDescription
dataarray

CommitResponse

Single commit response following JSON-API spec.

FieldTypeDescription
data

EmbeddingAttributes

Embedding attributes following JSON-API spec.

FieldTypeDescription
snippet_shastring
embedding_typestring
embeddingarray

EmbeddingData

Embedding data following JSON-API spec.

FieldTypeDescription
typestring
idstring
attributes

EmbeddingListResponse

Embedding list response following JSON-API spec.

FieldTypeDescription
dataarray

EnrichmentAssociationData

Enrichment association data for JSON-API spec.

FieldTypeDescription
idstring
typestring

EnrichmentAttributes

Enrichment attributes following JSON-API spec.

FieldTypeDescription
typestring
subtype
contentstring
created_at
updated_at

EnrichmentData

Enrichment data following JSON-API spec.

FieldTypeDescription
typestring
idstring
attributes
relationships
links

EnrichmentLinks

Links following JSON-API spec.

FieldTypeDescription
selfstring

EnrichmentListResponse

Enrichment list response following JSON-API spec.

FieldTypeDescription
dataarray

EnrichmentRelationships

Enrichment relationships for JSON-API spec.

FieldTypeDescription
associations
commit

EnrichmentResponse

Single enrichment response following JSON-API spec.

FieldTypeDescription
data

EnrichmentSchema

Enrichment schema following JSON-API spec.

FieldTypeDescription
typestring
contentstring

EnrichmentUpdateAttributes

Attributes for updating an enrichment.

FieldTypeDescription
contentstring

EnrichmentUpdateData

Data for updating an enrichment.

FieldTypeDescription
typestring
attributes

EnrichmentUpdateRequest

Request to update an enrichment.

FieldTypeDescription
data

FileAttributes

File attributes following JSON-API spec.

FieldTypeDescription
blob_shastring
pathstring
mime_typestring
sizeinteger
extensionstring

FileData

File data following JSON-API spec.

FieldTypeDescription
typestring
idstring
attributes

FileListResponse

File list response following JSON-API spec.

FieldTypeDescription
dataarray

FileResponse

Single file response following JSON-API spec.

FieldTypeDescription
data

GitFileSchema

Git file schema following JSON-API spec.

FieldTypeDescription
blob_shastring
pathstring
mime_typestring
sizeinteger

HTTPValidationError

FieldTypeDescription
detailarray

Relationship

A JSON:API relationship.

FieldTypeDescription
links
data

RelationshipData

Data for a single relationship.

FieldTypeDescription
typestring
idstring

RepositoryAttributes

Repository attributes following JSON-API spec.

FieldTypeDescription
remote_uristring
created_at
updated_at
last_scanned_at
cloned_path
tracking_branch
num_commitsinteger
num_branchesinteger
num_tagsinteger

RepositoryBranchData

Repository branch data.

FieldTypeDescription
namestring
is_defaultboolean
commit_countinteger

RepositoryCommitData

Repository commit data for repository details.

FieldTypeDescription
shastring
messagestring
authorstring
timestampstring

RepositoryCreateAttributes

Repository creation attributes.

FieldTypeDescription
remote_uristring

RepositoryCreateData

Repository creation data.

FieldTypeDescription
typestring
attributes

RepositoryCreateRequest

Repository creation request.

FieldTypeDescription
data

RepositoryData

Repository data following JSON-API spec.

FieldTypeDescription
typestring
idstring
attributes

RepositoryDetailsResponse

Repository details response with branches and commits.

FieldTypeDescription
data
branchesarray
recent_commitsarray

RepositoryListResponse

Repository list response following JSON-API spec.

FieldTypeDescription
dataarray

RepositoryResponse

Single repository response following JSON-API spec.

FieldTypeDescription
data

RepositoryStatusSummaryAttributes

Attributes for repository status summary.

FieldTypeDescription
statusstringOverall indexing status
messagestringError message if failed
updated_atstringMost recent activity timestamp

RepositoryStatusSummaryData

Data for repository status summary response.

FieldTypeDescription
typestring
idstring
attributes

RepositoryStatusSummaryResponse

JSON:API response for repository status summary.

FieldTypeDescription
data

SearchAttributes

Search attributes for JSON:API requests.

FieldTypeDescription
keywordsSearch keywords
codeCode search query
textText search query
limitMaximum number of results to return
filtersSearch filters

SearchData

Search data for JSON:API requests.

FieldTypeDescription
typestring
attributes

SearchFilters

Search filters for JSON:API requests.

FieldTypeDescription
languagesProgramming languages to filter by
authorsAuthors to filter by
start_dateFilter snippets created after this date
end_dateFilter snippets created before this date
sourcesSource repositories to filter by
file_patternsFile path patterns to filter by
enrichment_typesEnrichment types to filter by (e.g., ‘development’, ‘usage’)
enrichment_subtypesEnrichment subtypes to filter by (e.g., ‘snippet’, ’example’, ‘snippet_summary’, ’example_summary’)
commit_shaFilter snippets by commit SHAs

SearchRequest

JSON:API request for searching snippets.

FieldTypeDescription
data

SearchResponse

JSON:API response for search results.

FieldTypeDescription
dataarray

SnippetAttributes

Snippet attributes for JSON:API responses.

FieldTypeDescription
created_at
updated_at
derives_fromarray
content
enrichmentsarray
original_scoresarray

SnippetContentSchema

Snippet content schema following JSON-API spec.

FieldTypeDescription
valuestring
languagestring

SnippetData

Snippet data for JSON:API responses.

FieldTypeDescription
typestring
idstring
attributes

TagAttributes

Tag attributes following JSON-API spec.

FieldTypeDescription
namestring
target_commit_shastring
is_version_tagboolean

TagData

Tag data following JSON-API spec.

FieldTypeDescription
typestring
idstring
attributes

TagListResponse

Tag list response following JSON-API spec.

FieldTypeDescription
dataarray

TagResponse

Single tag response following JSON-API spec.

FieldTypeDescription
data

TaskAttributes

Task attributes for JSON:API responses.

FieldTypeDescription
typestring
priorityinteger
payloadobject
created_at
updated_at

TaskData

Task data for JSON:API responses.

FieldTypeDescription
typestring
idstring
attributes

TaskListResponse

JSON:API response for task list.

FieldTypeDescription
dataarray

TaskOperation

Task operation.

TaskResponse

JSON:API response for single task.

FieldTypeDescription
data

TaskStatusAttributes

Task status attributes for JSON:API responses.

FieldTypeDescription
stepstringName of the task/operation
statestringCurrent state of the task
progressnumberProgress percentage (0-100)
totalintegerTotal number of items to process
currentintegerCurrent number of items processed
created_atTask start time
updated_atLast update time
errorstringError message
messagestringMessage

TaskStatusData

Task status data for JSON:API responses.

FieldTypeDescription
typestring
idstring
attributes

TaskStatusListResponse

JSON:API response for task status list.

FieldTypeDescription
dataarray

ValidationError

FieldTypeDescription
locarray
msgstring
typestring