Marqo REST API

The Marqo REST API is the HTTP surface exposed by the open-source engine (default `http://localhost:8882`). It provides index lifecycle management, document add/update/get/delete, lexical/tensor/hybrid search, recommendations, embedding generation, model lifecycle, telemetry, and health endpoints. The same surface is served by Marqo Cloud at `https://api.marqo.ai`, and the live OpenAPI schema is published by the running engine at `/openapi.json` with Swagger UI at `/docs`.

OpenAPI Specification

marqo-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Marqo REST API
  version: '2.26'
  summary: Open-source multimodal vector search engine REST API.
  description: |
    Marqo is an open-source vector search engine that bundles index storage
    (Vespa) and embedding inference (Sentence Transformers, OpenCLIP, ONNX)
    behind a single FastAPI HTTP surface. The engine is reachable at
    `http://{host}:8882` by default and publishes its live OpenAPI schema at
    `/openapi.json` with interactive Swagger UI at `/docs`. The same surface
    is exposed by the hosted Marqo Cloud product at `https://api.marqo.ai`
    with bearer-token authentication.

    This profile is a hand-curated, best-effort companion spec covering the
    most-used operations across indexes, documents, search, embeddings,
    models, and telemetry. For the canonical, version-pinned specification
    of a deployment, fetch `/openapi.json` directly from the running engine.
  contact:
    name: Marqo
    url: https://www.marqo.ai
  license:
    name: Apache 2.0
    url: https://github.com/marqo-ai/marqo/blob/mainline/LICENSE
servers:
  - url: http://localhost:8882
    description: Default Marqo open-source engine endpoint
  - url: https://api.marqo.ai
    description: Marqo Cloud endpoint (bearer authentication)
security: []
tags:
  - name: Indexes
    description: Create, list, inspect, and delete tensor / lexical indexes.
  - name: Documents
    description: Add, update, get, and delete documents in an index.
  - name: Search
    description: Tensor, lexical, and hybrid search across an index.
  - name: Embeddings
    description: Generate embedding vectors using engine-loaded models.
  - name: Models
    description: Inspect, load, and eject embedding models from the engine.
  - name: Recommendations
    description: Return documents similar to one or more reference documents.
  - name: Telemetry
    description: Health, readiness, and engine-level metadata.
paths:
  /:
    get:
      tags: [Telemetry]
      summary: Root Health Check
      operationId: root
      responses:
        '200':
          description: Engine is up.
  /health:
    get:
      tags: [Telemetry]
      summary: Health Check
      operationId: health
      responses:
        '200':
          description: Engine and backing Vespa are healthy.
  /memory:
    get:
      tags: [Telemetry]
      summary: Memory Usage
      operationId: memory
      responses:
        '200':
          description: Process memory snapshot.
  /models:
    get:
      tags: [Models]
      summary: List Loaded Models
      operationId: listModels
      responses:
        '200':
          description: Currently loaded embedding models.
  /models/eject:
    delete:
      tags: [Models]
      summary: Eject Model
      operationId: ejectModel
      parameters:
        - in: query
          name: model_name
          required: true
          schema: { type: string }
        - in: query
          name: model_device
          required: false
          schema: { type: string, enum: [cpu, cuda] }
      responses:
        '200':
          description: Model ejected from memory.
  /indexes:
    get:
      tags: [Indexes]
      summary: List Indexes
      operationId: listIndexes
      responses:
        '200':
          description: Indexes in this engine.
  /indexes/{index_name}:
    post:
      tags: [Indexes]
      summary: Create Index
      operationId: createIndex
      parameters:
        - $ref: '#/components/parameters/IndexName'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IndexSettings'
      responses:
        '200':
          description: Index created.
    delete:
      tags: [Indexes]
      summary: Delete Index
      operationId: deleteIndex
      parameters:
        - $ref: '#/components/parameters/IndexName'
      responses:
        '200':
          description: Index deleted.
  /indexes/{index_name}/settings:
    get:
      tags: [Indexes]
      summary: Get Index Settings
      operationId: getIndexSettings
      parameters:
        - $ref: '#/components/parameters/IndexName'
      responses:
        '200':
          description: Index settings document.
  /indexes/{index_name}/stats:
    get:
      tags: [Indexes]
      summary: Get Index Stats
      operationId: getIndexStats
      parameters:
        - $ref: '#/components/parameters/IndexName'
      responses:
        '200':
          description: Document count and storage stats.
  /indexes/{index_name}/documents:
    post:
      tags: [Documents]
      summary: Add Or Update Documents
      operationId: addDocuments
      parameters:
        - $ref: '#/components/parameters/IndexName'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddDocumentsRequest'
      responses:
        '200':
          description: Documents accepted for indexing.
    delete:
      tags: [Documents]
      summary: Delete Documents
      operationId: deleteDocuments
      parameters:
        - $ref: '#/components/parameters/IndexName'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [ids]
              properties:
                ids:
                  type: array
                  items: { type: string }
      responses:
        '200':
          description: Deletion accepted.
  /indexes/{index_name}/documents/{document_id}:
    get:
      tags: [Documents]
      summary: Get Document By Id
      operationId: getDocument
      parameters:
        - $ref: '#/components/parameters/IndexName'
        - in: path
          name: document_id
          required: true
          schema: { type: string }
        - in: query
          name: expose_facets
          required: false
          schema: { type: boolean }
      responses:
        '200':
          description: Document body.
  /indexes/{index_name}/search:
    post:
      tags: [Search]
      summary: Search Index
      operationId: search
      parameters:
        - $ref: '#/components/parameters/IndexName'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SearchRequest'
      responses:
        '200':
          description: Ranked search results.
  /indexes/{index_name}/recommend:
    post:
      tags: [Recommendations]
      summary: Recommend Similar Documents
      operationId: recommend
      parameters:
        - $ref: '#/components/parameters/IndexName'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [documents]
              properties:
                documents:
                  type: array
                  items: { type: string }
                  description: IDs of seed documents.
                limit:
                  type: integer
                  minimum: 1
                  default: 10
      responses:
        '200':
          description: Recommended documents.
  /indexes/{index_name}/embed:
    post:
      tags: [Embeddings]
      summary: Generate Embeddings
      operationId: embed
      parameters:
        - $ref: '#/components/parameters/IndexName'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [content]
              properties:
                content:
                  oneOf:
                    - type: string
                    - type: array
                      items: { type: string }
                  description: Text and/or image URLs to embed using the index model.
      responses:
        '200':
          description: Embedding vectors.
components:
  parameters:
    IndexName:
      in: path
      name: index_name
      required: true
      schema:
        type: string
      description: Name of the Marqo index.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: |
        Marqo Cloud API key passed as `Authorization: Bearer {api_key}`.
        The open-source engine accepts unauthenticated requests by default.
  schemas:
    IndexSettings:
      type: object
      description: |
        Subset of index configuration. The full settings schema is published
        by the live engine at `/openapi.json` and varies by Marqo version.
      properties:
        type:
          type: string
          enum: [structured, unstructured]
        model:
          type: string
          description: Embedding model loaded into the index (e.g. `hf/e5-base-v2`).
        normalizeEmbeddings:
          type: boolean
        textPreprocessing:
          type: object
        imagePreprocessing:
          type: object
        vectorNumericType:
          type: string
          enum: [float, bfloat16]
        annParameters:
          type: object
          properties:
            spaceType:
              type: string
              enum: [angular, dotproduct, euclidean, prenormalized-angular]
            parameters:
              type: object
    AddDocumentsRequest:
      type: object
      required: [documents]
      properties:
        documents:
          type: array
          description: Array of arbitrary JSON documents to index.
          items:
            type: object
            additionalProperties: true
            properties:
              _id:
                type: string
                description: Optional client-supplied document identifier.
        tensorFields:
          type: array
          description: Field names to embed into tensor vectors.
          items: { type: string }
        mappings:
          type: object
          description: Per-field overrides for multimodal combination weights.
    SearchRequest:
      type: object
      properties:
        q:
          oneOf:
            - type: string
            - type: object
              additionalProperties:
                type: number
              description: Weighted multi-query map (term -> weight).
          description: Query text, image URL, or weighted multi-query.
        searchMethod:
          type: string
          enum: [TENSOR, LEXICAL, HYBRID]
          default: TENSOR
        limit:
          type: integer
          minimum: 1
          default: 10
        offset:
          type: integer
          minimum: 0
          default: 0
        filter:
          type: string
          description: Filter expression evaluated against structured fields.
        showHighlights:
          type: boolean
          default: true
        attributesToRetrieve:
          type: array
          items: { type: string }
        searchableAttributes:
          type: array
          items: { type: string }
        rerankDepth:
          type: integer
          minimum: 0
        hybridParameters:
          type: object
          description: Tuning knobs for HYBRID search (alpha, retrieval method, ranking method).