← Back to APIs
RAG PIPELINE — STEP 2

Index Document

Take the JSON response from the Chunk and Perform Embedding API (Step 1) and POST it directly to the Azure AI Search Documents Index API. This uploads all chunks — with their text, metadata, and embedding vectors — into your search index, making them available for keyword, semantic, and vector queries.

POST · Azure AI Search Direct Azure API Call Variables: azureAiSearch_ResourceName, azureAISearch_IndexName, azureAISearch_Key
01

Endpoint

POST https://{{azureAiSearch_ResourceName}}.search.windows.net/indexes/{{azureAISearch_IndexName}}/docs/index?api-version=2025-05-01-preview
PropertyValue
MethodPOST
Content-Typeapplication/json
ServiceAzure AI Search (direct API call — not a Lowcademy endpoint)
API Version2025-05-01-preview
BodyThe full JSON response from the Chunk and Perform Embedding API (Step 1)
02

Postman Collection Variables Required

Set these variables in the Postman collection before calling this API azureAiSearch_ResourceName — Your Azure AI Search resource name (the subdomain, e.g. my-search-service)
azureAISearch_IndexName — The name of your Azure AI Search index
azureAISearch_Key — Your Azure AI Search admin or query API key
03

Authentication

Azure AI Search API Key

Header: api-key{{azureAISearch_Key}}
HeaderTypeRequiredDescription
api-key String Required Your Azure AI Search API key. Use an admin key for indexing operations.
Content-Type String Required Must be application/json.
04

Request Body

Use the response from Step 1 directly Copy the entire JSON response from the Chunk and Perform Embedding API and paste it as the request body here. No transformation is needed.

Request Body Structure

{
  "value": [
    {
      "@search.action" : "upload",
      "id"             : "1-42-0001",
      "tenant_id"      : 1,
      "document_id"    : 42,
      "sourceName"     : "MyDocument",
      "section"        : "Introduction",
      "content"        : "Azure AI Search is a fully managed cloud search service...",
      "embedding"      : [ 0.0023064255, -0.009327292, ... ]
    }
  ]
}
05

Sample Request

cURL

curl -X POST \
  -H "api-key: <your-azure-search-admin-key>" \
  -H "Content-Type: application/json" \
  -d '<paste Step 1 response body here>' \
  "https://<resource-name>.search.windows.net/indexes/<index-name>/docs/index?api-version=2025-05-01-preview"
06

Response — 200 OK

Successful Index Response

{
  "value": [
    {
      "key"          : "1-42-0001",
      "status"       : true,
      "errorMessage" : null,
      "statusCode"   : 201
    }
  ]
}
07

Error Responses

200
OK — Documents indexed successfully. Check each item's status field for per-document errors.
401
Unauthorized — api-key header missing or invalid.
403
Forbidden — The provided key does not have write permissions on this index.
404
Not Found — The index name does not exist in your Azure AI Search resource.
400
Bad Request — Malformed JSON body, schema mismatch (e.g. field not in index), or invalid field type.