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

# Index chunks

> Stores chunks, embeddings, and metadata for a collection.



## OpenAPI

````yaml POST /v1/index
openapi: 3.1.0
info:
  title: SHARC MCP Backend API
  version: 1.0.0
  description: >-
    HTTP endpoints used by the SHARC MCP server for indexing and semantic search
    workflows.
servers:
  - url: https://api.sharc.sh
    description: Production
security: []
paths:
  /v1/index:
    post:
      tags:
        - MCP backend
      summary: Index code chunks
      description: Stores chunks, embeddings, and metadata for a collection.
      operationId: indexChunks
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IndexRequest'
      responses:
        '200':
          description: Indexing accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IndexResponse'
      security:
        - apiKey: []
components:
  schemas:
    IndexRequest:
      type: object
      properties:
        collection:
          type: string
        chunks:
          type: array
          items:
            $ref: '#/components/schemas/CodeChunk'
          minItems: 1
        metadata:
          type: object
          additionalProperties: true
      required:
        - collection
        - chunks
    IndexResponse:
      type: object
      properties:
        indexed:
          type: integer
        collection:
          type: string
    CodeChunk:
      type: object
      properties:
        content:
          type: string
        relativePath:
          type: string
        startLine:
          type: integer
        endLine:
          type: integer
        metadata:
          type: object
          additionalProperties: true
      required:
        - content
        - relativePath
        - startLine
        - endLine
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: 'Pass your key in Authorization: Bearer <key>.'

````