{
  "openapi": "3.1.0",
  "info": {
    "title": "Chroma Sync Service",
    "description": "Chroma Sync Service provides APIs for managing data synchronization sources and invocations. The service supports syncing content from GitHub repositories, web scrape targets, and S3 buckets to Chroma collections.",
    "license": {
      "name": ""
    },
    "version": "0.1.0"
  },
  "servers": [
    {
      "url": "https://sync.trychroma.com"
    }
  ],
  "paths": {
    "/api/v1/invocations": {
      "get": {
        "tags": [
          "Invocation"
        ],
        "summary": "List invocations",
        "description": "Lists invocations for a source or database.",
        "operationId": "list_jobs",
        "parameters": [
          {
            "name": "source_id",
            "in": "query",
            "description": "Source ID. Cannot be provided simultaneously with database_name",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/SourceId"
            }
          },
          {
            "name": "database_name",
            "in": "query",
            "description": "Database name. Cannot be provided simultaneously with source_id",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "source_type",
            "in": "query",
            "description": "Filter invocations by source type",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/SourceTypeFilter"
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "Filter invocations by status",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/JobStatus"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Limit for pagination. Default is 100",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "Offset for pagination. Default is 0",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "order_by",
            "in": "query",
            "description": "Order results by creation time. Default is DESC",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/OrderBy"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Found invocations",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Vec"
                }
              }
            }
          },
          "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": "Source not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "x-chroma-token": []
          }
        ]
      }
    },
    "/api/v1/invocations/{invocation_id}": {
      "get": {
        "tags": [
          "Invocation"
        ],
        "summary": "Get invocation",
        "description": "Returns details of an invocation with the provided ID.",
        "operationId": "get_job",
        "parameters": [
          {
            "name": "invocation_id",
            "in": "path",
            "description": "Invocation ID",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/JobId"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Found invocation with provided ID",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            }
          },
          "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": "Invocation not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "x-chroma-token": []
          }
        ]
      },
      "put": {
        "tags": [
          "Invocation"
        ],
        "summary": "Cancel invocation",
        "description": "Cancels an invocation.",
        "operationId": "cancel_pending_job",
        "parameters": [
          {
            "name": "invocation_id",
            "in": "path",
            "description": "Invocation ID",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/JobId"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Invocation cancellation successful",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CancelJobResponse"
                }
              }
            }
          },
          "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": "Invocation not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "412": {
            "description": "Invocation is not in a cancelable state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "x-chroma-token": []
          }
        ]
      }
    },
    "/api/v1/sources": {
      "get": {
        "tags": [
          "Source"
        ],
        "summary": "List sources",
        "description": "Lists sources owned by a tenant.",
        "operationId": "list_sources",
        "parameters": [
          {
            "name": "database_name",
            "in": "query",
            "description": "Database name",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "source_type",
            "in": "query",
            "description": "Filter sources by type",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/SourceTypeFilter"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Limit for pagination. Default is 100",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "Offset for pagination. Default is 0",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "order_by",
            "in": "query",
            "description": "Order results by creation time. Default is DESC",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/OrderBy"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Found sources",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Vec"
                }
              }
            }
          },
          "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": "Source not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "x-chroma-token": []
          }
        ]
      },
      "post": {
        "tags": [
          "Source"
        ],
        "summary": "Create source",
        "description": "Creates a new sync source.",
        "operationId": "create_source",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSourcePayload"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Source creation successful",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateSourceResponse"
                }
              }
            }
          },
          "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"
                }
              }
            }
          },
          "409": {
            "description": "Source exists",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "x-chroma-token": []
          }
        ]
      }
    },
    "/api/v1/sources/{source_id}": {
      "get": {
        "tags": [
          "Source"
        ],
        "summary": "Get source",
        "description": "Returns details of a source with the provided ID.",
        "operationId": "get_source",
        "parameters": [
          {
            "name": "source_id",
            "in": "path",
            "description": "Source ID",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/SourceId"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Found source with provided ID",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Source"
                }
              }
            }
          },
          "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"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "x-chroma-token": []
          }
        ]
      },
      "delete": {
        "tags": [
          "Source"
        ],
        "summary": "Delete source",
        "description": "Deletes a source with the provided ID.",
        "operationId": "delete_source",
        "parameters": [
          {
            "name": "source_id",
            "in": "path",
            "description": "Source ID",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/SourceId"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Source deletion successful"
          },
          "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": "Source not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "x-chroma-token": []
          }
        ]
      }
    },
    "/api/v1/sources/{source_id}/invocations": {
      "post": {
        "tags": [
          "Invocation"
        ],
        "summary": "Create invocation",
        "description": "Creates a new invocation for a source.",
        "operationId": "create_job",
        "parameters": [
          {
            "name": "source_id",
            "in": "path",
            "description": "Source ID",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/SourceId"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateJobPayload"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Invocation creation successful",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateJobResponse"
                }
              }
            }
          },
          "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": "Source not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Invocation exists",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "x-chroma-token": []
          }
        ]
      }
    },
    "/health": {
      "get": {
        "tags": [
          "System"
        ],
        "summary": "Get service health status",
        "description": "Returns the health status of the sync service.",
        "operationId": "health_check",
        "responses": {
          "200": {
            "description": "Health check successful"
          },
          "503": {
            "description": "Service is unavailable"
          }
        }
      }
    },
    "/api/v1/add-file": {
      "post": {
        "tags": [
          "File Upload"
        ],
        "summary": "Upload and index a file",
        "description": "Uploads a file and creates an invocation to index it into the specified collection.\n\nThe first time this endpoint is called for a database, a `file_upload` source is created automatically; subsequent calls reuse that source. The collection is created on the first invocation if it does not already exist.\n\n**Multipart field ordering:** `database_name` and `collection_name` MUST appear before `file`. The server uses these to authorize the request before streaming file bytes to storage.\n\n**Size limits:** maximum 200 MiB per file. The declared size in `x-upload-content-length` is enforced.",
        "operationId": "add_file",
        "parameters": [
          {
            "name": "x-upload-content-length",
            "in": "header",
            "description": "Declared file size in bytes. Must be greater than 0 and not exceed 200 MiB (209,715,200 bytes).",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 1,
              "maximum": 209715200
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "database_name",
                  "collection_name",
                  "file"
                ],
                "properties": {
                  "database_name": {
                    "type": "string",
                    "description": "Database in which to index the file. Must appear before the `file` field."
                  },
                  "collection_name": {
                    "type": "string",
                    "description": "Target collection. Created on first use. Must appear before the `file` field."
                  },
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "File content. Maximum 200 MiB. The filename in the part header is used as the document name."
                  },
                  "custom_id": {
                    "type": "string",
                    "maxLength": 120,
                    "description": "Optional custom document ID. Chunk IDs become `custom_id-{chunk}` instead of `sha256(filename)-{chunk}`."
                  },
                  "metadata": {
                    "type": "string",
                    "description": "Optional JSON object of additional metadata to merge with chunk metadata. Maximum 16 KiB. Reserved keys (e.g. `chroma_*`) are rejected."
                  },
                  "embedding": {
                    "type": "string",
                    "description": "Optional JSON `SourceEmbeddingConfig`. Defaults to Qwen3-Embedding-0.6B with `generic_retrieval` task and Splade sparse embeddings."
                  },
                  "chunking": {
                    "type": "string",
                    "description": "Optional JSON `SourceChunkingConfig`. Defaults to tree-sitter syntax-aware chunking with markdown/line-based fallbacks."
                  },
                  "content_type": {
                    "type": "string",
                    "maxLength": 512,
                    "description": "Optional MIME type override. Otherwise inferred from the file part header (if not `application/octet-stream`) or the filename extension."
                  }
                }
              },
              "encoding": {
                "file": {
                  "contentType": "application/octet-stream"
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "File accepted and invocation created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AddFileResponse"
                }
              }
            }
          },
          "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": "Database not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Too many concurrent uploads",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "x-chroma-token": []
          }
        ]
      }
    },
    "/api/v1/sources/{source_id}/invocations/latest-by-keys": {
      "post": {
        "tags": [
          "Invocation"
        ],
        "operationId": "latest_invocations_by_keys",
        "parameters": [
          {
            "name": "source_id",
            "in": "path",
            "description": "Source ID",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/SourceId"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LatestByKeysRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Latest invocation per object key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HashMap"
                }
              }
            }
          },
          "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": "Source not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "summary": "Get latest invocations by keys",
        "description": "Returns the latest invocations for the given keys on a source."
      }
    }
  },
  "components": {
    "schemas": {
      "AddFileResponse": {
        "type": "object",
        "required": [
          "invocation_id"
        ],
        "properties": {
          "invocation_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the newly created invocation."
          }
        }
      },
      "CancelJobResponse": {
        "type": "object"
      },
      "CreateJobPayload": {
        "type": "object",
        "properties": {
          "custom_id": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 120,
            "description": "Custom ID for Chroma object IDs (optional, S3 sources only).\nIf provided, chunk IDs become \"custom_id-{chunk}\" instead of \"sha256(object_key)-{chunk}\".\nAlso stored as \"custom_id\" metadata on each chunk."
          },
          "metadata": {
            "type": [
              "object",
              "null"
            ],
            "description": "Additional metadata to merge with standard chunk metadata (optional, S3 sources only).",
            "additionalProperties": {},
            "propertyNames": {
              "type": "string"
            }
          },
          "object_key": {
            "type": [
              "string",
              "null"
            ],
            "description": "Full S3 object key to sync (required for S3 sources, not allowed for other source types).\nMust be the complete key including any path prefix configured on the source."
          },
          "ref_identifier": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/GitRefIdentifier",
                "description": "Git ref identifier for GitHub sources (optional)"
              }
            ]
          },
          "target_collection_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Target collection name (optional for S3 sources, required for others).\nFor S3 sources: if not provided, uses collection_name from source config.\nFor GitHub and WebScrape sources: required."
          }
        }
      },
      "CreateJobResponse": {
        "type": "object",
        "required": [
          "invocation_id"
        ],
        "properties": {
          "invocation_id": {
            "$ref": "#/components/schemas/JobId",
            "description": "ID of the newly created invocation"
          }
        }
      },
      "CreateSourcePayload": {
        "allOf": [
          {
            "$ref": "#/components/schemas/SourceType"
          },
          {
            "type": "object",
            "required": [
              "database_name"
            ],
            "properties": {
              "chunking": {
                "$ref": "#/components/schemas/SourceChunkingConfig",
                "description": "Optional chunking configuration for this source."
              },
              "database_name": {
                "type": "string"
              },
              "embedding": {
                "$ref": "#/components/schemas/SourceEmbeddingConfig"
              },
              "embedding_model": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/DenseEmbeddingModel"
                  }
                ]
              }
            }
          }
        ]
      },
      "CreateSourceResponse": {
        "type": "object",
        "required": [
          "source_id"
        ],
        "properties": {
          "source_id": {
            "$ref": "#/components/schemas/SourceId",
            "description": "Source ID"
          }
        }
      },
      "DenseEmbeddingConfig": {
        "allOf": [
          {
            "$ref": "#/components/schemas/DenseEmbeddingModel"
          }
        ]
      },
      "DenseEmbeddingModel": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "model"
            ],
            "properties": {
              "model": {
                "type": "string",
                "enum": [
                  "Qwen/Qwen3-Embedding-0.6B"
                ]
              },
              "task": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/Qwen3EmbeddingTask"
                  }
                ]
              }
            }
          }
        ]
      },
      "ErrorResponse": {
        "type": "object",
        "required": [
          "error",
          "message"
        ],
        "properties": {
          "error": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        }
      },
      "GitRefIdentifier": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "sha"
            ],
            "properties": {
              "sha": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "branch"
            ],
            "properties": {
              "branch": {
                "type": "string"
              }
            }
          }
        ]
      },
      "IndexJobMetadata": {
        "allOf": [
          {
            "$ref": "#/components/schemas/IndexJobMetadataKind"
          },
          {
            "type": "object",
            "required": [
              "database_name",
              "collection_name"
            ],
            "properties": {
              "collection_name": {
                "type": "string"
              },
              "database_name": {
                "type": "string"
              }
            }
          }
        ]
      },
      "IndexJobMetadataKind": {
        "oneOf": [
          {
            "type": "string",
            "enum": [
              "web_scrape"
            ]
          },
          {
            "type": "object",
            "required": [
              "github"
            ],
            "properties": {
              "github": {
                "type": "object",
                "required": [
                  "git_ref_identifier"
                ],
                "properties": {
                  "git_ref_identifier": {
                    "$ref": "#/components/schemas/GitRefIdentifier"
                  }
                }
              }
            }
          },
          {
            "type": "object",
            "required": [
              "s3"
            ],
            "properties": {
              "s3": {
                "type": "object",
                "required": [
                  "bucket_name"
                ],
                "properties": {
                  "additional_metadata": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "additionalProperties": {},
                    "propertyNames": {
                      "type": "string"
                    }
                  },
                  "bucket_name": {
                    "type": "string"
                  },
                  "custom_id": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "object_key": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                }
              }
            }
          },
          {
            "type": "string",
            "enum": [
              "Unknown"
            ]
          }
        ]
      },
      "Job": {
        "type": "object",
        "required": [
          "id",
          "status",
          "metadata",
          "created_at"
        ],
        "properties": {
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "id": {
            "$ref": "#/components/schemas/JobId"
          },
          "metadata": {
            "$ref": "#/components/schemas/IndexJobMetadata"
          },
          "source_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/SourceId"
              }
            ]
          },
          "status": {
            "$ref": "#/components/schemas/JobStatus"
          }
        }
      },
      "JobId": {
        "type": "string",
        "format": "uuid"
      },
      "JobStatus": {
        "oneOf": [
          {
            "type": "string",
            "enum": [
              "pending"
            ]
          },
          {
            "type": "string",
            "enum": [
              "processing"
            ]
          },
          {
            "type": "object",
            "required": [
              "complete"
            ],
            "properties": {
              "complete": {
                "type": "object",
                "required": [
                  "finished_at",
                  "duration_ms"
                ],
                "properties": {
                  "duration_ms": {
                    "type": "integer",
                    "format": "int64",
                    "minimum": 0
                  },
                  "finished_at": {
                    "type": "string",
                    "format": "date-time"
                  }
                }
              }
            }
          },
          {
            "type": "object",
            "required": [
              "failed"
            ],
            "properties": {
              "failed": {
                "type": "object",
                "required": [
                  "error"
                ],
                "properties": {
                  "error": {
                    "type": "string"
                  }
                }
              }
            }
          },
          {
            "type": "string",
            "enum": [
              "cancelled"
            ]
          }
        ]
      },
      "Qwen3EmbeddingTask": {
        "type": "object",
        "required": [
          "task_name"
        ],
        "properties": {
          "document_prompt": {
            "type": [
              "string",
              "null"
            ]
          },
          "query_prompt": {
            "type": [
              "string",
              "null"
            ]
          },
          "task_name": {
            "type": "string"
          }
        }
      },
      "Source": {
        "allOf": [
          {
            "$ref": "#/components/schemas/SourceType"
          },
          {
            "type": "object",
            "required": [
              "id",
              "database_name",
              "embedding_model",
              "chunking",
              "embedding",
              "created_at"
            ],
            "properties": {
              "chunking": {
                "$ref": "#/components/schemas/SourceChunkingConfig"
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              },
              "database_name": {
                "type": "string"
              },
              "embedding": {
                "$ref": "#/components/schemas/SourceEmbeddingConfig"
              },
              "embedding_model": {
                "$ref": "#/components/schemas/DenseEmbeddingModel"
              },
              "id": {
                "$ref": "#/components/schemas/SourceId"
              }
            }
          }
        ]
      },
      "SourceChunkingConfig": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "type"
            ],
            "properties": {
              "max_size_bytes": {
                "type": "integer",
                "minimum": 0
              },
              "type": {
                "type": "string",
                "enum": [
                  "tree_sitter"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "type"
            ],
            "properties": {
              "max_lines": {
                "type": "integer",
                "minimum": 0
              },
              "max_size_bytes": {
                "type": "integer",
                "minimum": 0
              },
              "type": {
                "type": "string",
                "enum": [
                  "lines"
                ]
              }
            }
          }
        ]
      },
      "SourceEmbeddingConfig": {
        "type": "object",
        "properties": {
          "dense": {
            "$ref": "#/components/schemas/DenseEmbeddingConfig"
          },
          "sparse": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/SparseEmbeddingConfig"
              }
            ]
          }
        }
      },
      "SourceId": {
        "type": "string",
        "format": "uuid"
      },
      "SourceType": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "github"
            ],
            "properties": {
              "github": {
                "type": "object",
                "required": [
                  "repository"
                ],
                "properties": {
                  "app_id": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "include_globs": {
                    "type": [
                      "array",
                      "null"
                    ],
                    "items": {
                      "type": "string"
                    },
                    "uniqueItems": true
                  },
                  "repository": {
                    "type": "string"
                  }
                }
              }
            }
          },
          {
            "type": "object",
            "required": [
              "web_scrape"
            ],
            "properties": {
              "web_scrape": {
                "type": "object",
                "required": [
                  "starting_url"
                ],
                "properties": {
                  "exclude_path_regexes": {
                    "type": [
                      "array",
                      "null"
                    ],
                    "items": {
                      "type": "string"
                    },
                    "uniqueItems": true
                  },
                  "include_path_regexes": {
                    "type": [
                      "array",
                      "null"
                    ],
                    "items": {
                      "type": "string"
                    },
                    "uniqueItems": true
                  },
                  "max_depth": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "format": "int32",
                    "minimum": 0
                  },
                  "page_limit": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "format": "int32",
                    "minimum": 0
                  },
                  "starting_url": {
                    "type": "string"
                  }
                }
              }
            }
          },
          {
            "type": "object",
            "required": [
              "s3"
            ],
            "properties": {
              "s3": {
                "type": "object",
                "required": [
                  "bucket_name",
                  "region",
                  "collection_name"
                ],
                "description": "Provide either `aws_credential_id` referencing credentials saved in the dashboard, or pass `aws_access_key_id` and `aws_secret_access_key` inline (in which case credentials are stored automatically and a credential ID is allocated for reuse).",
                "properties": {
                  "auto_sync": {
                    "oneOf": [
                      {
                        "type": "null"
                      },
                      {
                        "$ref": "#/components/schemas/AutoSync",
                        "description": "Auto sync configuration for S3 source (default: none)\nOnly 'none' is supported initially"
                      }
                    ]
                  },
                  "aws_credential_id": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "format": "int32",
                    "description": "ID of AWS credentials saved in the Chroma dashboard. Mutually exclusive with `aws_access_key_id`/`aws_secret_access_key`."
                  },
                  "aws_access_key_id": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Inline AWS access key ID. Must be provided together with `aws_secret_access_key`. The credentials are stored on your team for reuse."
                  },
                  "aws_secret_access_key": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Inline AWS secret access key. Must be provided together with `aws_access_key_id`."
                  },
                  "bucket_name": {
                    "type": "string"
                  },
                  "collection_name": {
                    "type": "string"
                  },
                  "path_prefix": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "region": {
                    "type": "string"
                  }
                }
              }
            }
          },
          {
            "type": "object",
            "required": [
              "file_upload"
            ],
            "description": "File-upload sources are created automatically by the [`POST /api/v1/add-file`](#tag/file-upload) endpoint. They cannot be created directly via this endpoint.",
            "properties": {
              "file_upload": {
                "type": "object",
                "additionalProperties": false
              }
            }
          }
        ]
      },
      "SparseEmbeddingConfig": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "model": {
            "$ref": "#/components/schemas/SparseEmbeddingModel"
          }
        }
      },
      "SparseEmbeddingModel": {
        "type": "string",
        "enum": [
          "Chroma/BM25",
          "prithivida/Splade_PP_en_v1"
        ]
      },
      "Vec": {
        "type": "array",
        "items": {
          "type": "object",
          "required": [
            "id",
            "status",
            "metadata",
            "created_at"
          ],
          "properties": {
            "created_at": {
              "type": "string",
              "format": "date-time"
            },
            "id": {
              "$ref": "#/components/schemas/JobId"
            },
            "metadata": {
              "$ref": "#/components/schemas/IndexJobMetadata"
            },
            "source_id": {
              "oneOf": [
                {
                  "type": "null"
                },
                {
                  "$ref": "#/components/schemas/SourceId"
                }
              ]
            },
            "status": {
              "$ref": "#/components/schemas/JobStatus"
            }
          }
        }
      },
      "AutoSync": {
        "type": "string",
        "description": "Auto-sync mode for S3 sources\n- `none`: Manual invocations only (default)\n- `direct`: Triggered by S3 events\n- `metadata`: Triggered by S3 events with custom metadata support",
        "enum": [
          "none",
          "direct",
          "metadata"
        ]
      },
      "LatestByKeysRequest": {
        "type": "object",
        "required": [
          "object_keys"
        ],
        "properties": {
          "object_keys": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "HashMap": {
        "type": "object",
        "additionalProperties": {
          "type": "object",
          "required": [
            "id",
            "status",
            "metadata",
            "created_at"
          ],
          "properties": {
            "created_at": {
              "type": "string",
              "format": "date-time"
            },
            "id": {
              "$ref": "#/components/schemas/JobId"
            },
            "metadata": {
              "$ref": "#/components/schemas/IndexJobMetadata"
            },
            "source_id": {
              "oneOf": [
                {
                  "type": "null"
                },
                {
                  "$ref": "#/components/schemas/SourceId"
                }
              ]
            },
            "status": {
              "$ref": "#/components/schemas/JobStatus"
            }
          }
        },
        "propertyNames": {
          "type": "string"
        }
      }
    },
    "securitySchemes": {
      "x-chroma-token": {
        "type": "apiKey",
        "in": "header",
        "name": "x-chroma-token"
      }
    }
  }
}
