---
updatedAt: 2025-08-26T08:35:50.000Z
agentTools:
  projectIndex: https://docs.ducky.ai/llms.txt
---

# Index a document from an image and text content

Index a document into the specified index by providing the image and text content as a JSON object.

# OpenAPI definition

```json
{
  "openapi": "3.0.3",
  "info": {
    "contact": {
      "email": "support@ducky.ai",
      "name": "Ducky Developer Support"
    },
    "description": "API for managing and retrieving data from Ducky.",
    "title": "Ducky API",
    "version": "1.0.1"
  },
  "servers": [
    {
      "url": "https://api.ducky.ai"
    }
  ],
  "security": [
    {
      "api_key": []
    }
  ],
  "paths": {
    "/v1/documents/index-multimodal": {
      "post": {
        "description": "Index a document into the specified index by providing the image and text content as a JSON object.",
        "operationId": "indexMultimodal",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IndexMultimodalRequest"
              }
            }
          },
          "description": "The request payload containing the image and text content to be indexed.",
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentIndexedResponse"
                }
              }
            },
            "description": "Document indexing request accepted. Ducky will index the document asynchronously."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Invalid request (e.g., missing or invalid fields)"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Index not found"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Invalid request (e.g., missing or invalid fields)"
          }
        },
        "summary": "Index a document from an image and text content",
        "tags": [
          "documents"
        ],
        "x-speakeasy-name-override": "indexMultimodal",
        "x-speakeasy-usage-example": true,
        "x-code-samples": [
          {
            "language": "python",
            "label": "indexMultimodal",
            "code": "from duckyai import DuckyAI import os\nclient = DuckyAI(\n    api_key=os.getenv(\"DUCKYAI_API_KEY\", \"\"),\n)\nres = client.documents.index_multimodal(\n    index_name=\"index-name\", \n    content=\"content\", \n    doc_id=\"doc_id\", \n    title=\"title\", \n    url=\"url\", \n    metadata={\"key\": \"value\"},\n    image={\"url\": \"https://example.com/image.jpg\"}\n) print(res.doc_id)",
            "install": "pip install duckyai"
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "DocumentIndexedResponse": {
        "example": {
          "doc_id": "doc_id"
        },
        "properties": {
          "doc_id": {
            "description": "The ID of the indexed document",
            "title": "doc_id",
            "type": "string"
          }
        },
        "title": "DocumentIndexedResponse",
        "type": "object"
      },
      "IndexMultimodalRequest": {
        "example": {
          "image": {
            "mime_type": "mime_type",
            "base64": "base64",
            "url": "https://openapi-generator.tech"
          },
          "metadata": {
            "key": ""
          },
          "title": "title",
          "index_name": "index_name",
          "doc_id": "doc_id",
          "content": "content",
          "url": "url"
        },
        "properties": {
          "index_name": {
            "description": "The name of the index to add the document to",
            "title": "index_name",
            "type": "string"
          },
          "doc_id": {
            "description": "The ID of the document. If not provided, a unique document ID will be automatically generated by the server.",
            "title": "doc_id",
            "type": "string"
          },
          "image": {
            "$ref": "#/components/schemas/IndexMultimodalRequestImage"
          },
          "content": {
            "description": "The text content of the document to be indexed",
            "title": "content",
            "type": "string"
          },
          "title": {
            "description": "Title of the document to be indexed",
            "title": "title",
            "type": "string"
          },
          "url": {
            "description": "URL associated with the document to be indexed",
            "title": "url",
            "type": "string"
          },
          "metadata": {
            "additionalProperties": true,
            "description": "Metadata associated with the document. Accepts key value pairs where the value can be a string, number, boolean, or list of strings.",
            "title": "DocumentMetadata",
            "type": "object"
          }
        },
        "required": [
          "index_name"
        ],
        "title": "IndexMultimodalRequest",
        "type": "object"
      },
      "IndexMultimodalRequestImage": {
        "description": "Image data that can be provided as either a URL or base64 encoded data, but not both",
        "example": {
          "mime_type": "mime_type",
          "base64": "base64",
          "url": "https://openapi-generator.tech"
        },
        "properties": {
          "url": {
            "description": "HTTP(S) URL to an image",
            "format": "uri",
            "title": "url",
            "type": "string"
          },
          "base64": {
            "description": "Base64-encoded image bytes. Data-URL prefix allowed.",
            "format": "byte",
            "title": "base64",
            "type": "string"
          },
          "mime_type": {
            "description": "Optional MIME type hint (e.g. image/png)",
            "title": "mime_type",
            "type": "string"
          }
        },
        "title": "IndexMultimodalRequestImage",
        "type": "object"
      },
      "ErrorResponse": {
        "example": {
          "error": "error"
        },
        "properties": {
          "error": {
            "description": "Error message explaining the issue",
            "title": "error",
            "type": "string"
          }
        },
        "title": "ErrorResponse",
        "type": "object"
      }
    },
    "securitySchemes": {
      "api_key": {
        "description": "API key providing access to a project.",
        "in": "header",
        "name": "x-api-key",
        "type": "apiKey"
      }
    }
  },
  "x-google-backend": {
    "address": "api.ducky.ai"
  },
  "x-samples-languages": [
    "python",
    "shell"
  ]
}
```