---
url: https://docs.app-in.io/operations/indexContent.md
---

# Index content

`POST https://api.app-in.io/v1/index/{collection}`

Index a single document into the specified collection. Returns `202 Accepted` — the document is queued for processing and becomes searchable shortly after.

Use `X-Platform: woocommerce` header for WooCommerce-specific fields.

## OpenAPI operation

```json
{
  "operationId": "indexContent",
  "summary": "Index content",
  "description": "Index a single document into the specified collection. Returns `202 Accepted` — the document is queued for processing and becomes searchable shortly after.\n\nUse `X-Platform: woocommerce` header for WooCommerce-specific fields.",
  "tags": [
    "Indexing"
  ],
  "parameters": [
    {
      "name": "collection",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "enum": [
          "products",
          "pages",
          "docs"
        ]
      }
    },
    {
      "name": "X-Platform",
      "in": "header",
      "required": false,
      "schema": {
        "type": "string",
        "enum": [
          "product",
          "page",
          "doc",
          "woocommerce"
        ]
      },
      "description": "Platform type. Defaults automatically based on collection. Set to `woocommerce` when indexing WooCommerce products."
    },
    {
      "name": "X-Site-Language",
      "in": "header",
      "required": false,
      "schema": {
        "type": "string",
        "example": "nl"
      },
      "description": "Optional. The store's default language as an ISO 639-1 code (2-3 letters, optional region, max 5 characters). The API stores it as the site's default language only when none is set. The API never overwrites a value an admin set. An invalid value is ignored."
    }
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "oneOf": [
            {
              "$ref": "#/components/schemas/IndexProductRequest"
            },
            {
              "$ref": "#/components/schemas/IndexPageRequest"
            },
            {
              "$ref": "#/components/schemas/IndexDocRequest"
            }
          ]
        },
        "examples": {
          "product": {
            "summary": "Index a product",
            "value": {
              "id": "prod_001",
              "url": "/products/red-shoes",
              "title": "Red Running Shoes",
              "content": "Comfortable lightweight running shoes with air cushioning.",
              "price": 99.99,
              "compare_at_price": 129.99,
              "currency": "USD",
              "image_url": "https://example.com/shoes.jpg",
              "in_stock": true,
              "category": "footwear",
              "brand": "Nike",
              "sku": "NK-RS-001",
              "tags": [
                "running",
                "sale"
              ],
              "rating": 4.5,
              "reviews_count": 42,
              "attributes": [
                {
                  "name": "Size",
                  "value": "42"
                },
                {
                  "name": "Weight",
                  "value": "300",
                  "unit": "g"
                }
              ]
            }
          },
          "page": {
            "summary": "Index a page",
            "value": {
              "id": "page_about",
              "url": "/about",
              "title": "About Us",
              "content": "We are a company that sells shoes...",
              "lang": "en",
              "tags": [
                "company"
              ]
            }
          },
          "woocommerce": {
            "summary": "WooCommerce product (X-Platform: woocommerce)",
            "value": {
              "id": "32",
              "url": "/product/t-shirt",
              "title": "T-Shirt",
              "content": "Cotton t-shirt in multiple colors.",
              "price": 18,
              "sku": "woo-tshirt",
              "on_sale": false,
              "product_type": "simple",
              "category": "Tshirts",
              "attributes": [
                {
                  "name": "color",
                  "value": "Gray"
                }
              ]
            }
          }
        }
      }
    }
  },
  "responses": {
    "202": {
      "description": "Content queued for indexing",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "example": "queued"
              },
              "id": {
                "type": "string",
                "example": "prod_001"
              },
              "collection": {
                "type": "string",
                "example": "products"
              }
            }
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "403": {
      "description": "Collection not allowed, or the site is paused (the site is beyond the number of sites the plan allows — nothing is deleted, raising the plan unpauses it)"
    },
    "422": {
      "$ref": "#/components/responses/ValidationError"
    },
    "429": {
      "$ref": "#/components/responses/RateLimited"
    }
  }
}
```

## Referenced components

```json
{
  "#/components/schemas/IndexProductRequest": {
    "type": "object",
    "required": [
      "id",
      "url",
      "title",
      "content"
    ],
    "properties": {
      "id": {
        "type": "string"
      },
      "url": {
        "type": "string"
      },
      "title": {
        "type": "string"
      },
      "content": {
        "type": "string"
      },
      "lang": {
        "type": "string",
        "maxLength": 5,
        "description": "The document language, as an ISO 639-1 code. Optional. Without it, the document gets the site's default language when one is set; otherwise the language is detected from the text.",
        "example": "en"
      },
      "price": {
        "type": "number"
      },
      "compare_at_price": {
        "type": "number",
        "nullable": true
      },
      "currency": {
        "type": "string",
        "example": "USD"
      },
      "image_url": {
        "type": "string",
        "nullable": true
      },
      "in_stock": {
        "type": "boolean"
      },
      "category": {
        "type": "string",
        "nullable": true
      },
      "brand": {
        "type": "string",
        "nullable": true
      },
      "sku": {
        "type": "string",
        "nullable": true
      },
      "tags": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "rating": {
        "type": "number",
        "nullable": true
      },
      "reviews_count": {
        "type": "integer",
        "nullable": true
      },
      "attributes": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/Attribute"
        }
      }
    }
  },
  "#/components/schemas/Attribute": {
    "type": "object",
    "required": [
      "name",
      "value"
    ],
    "properties": {
      "name": {
        "type": "string"
      },
      "value": {
        "type": "string"
      },
      "unit": {
        "type": "string",
        "nullable": true
      }
    }
  },
  "#/components/schemas/IndexPageRequest": {
    "type": "object",
    "required": [
      "id",
      "url",
      "title",
      "content"
    ],
    "properties": {
      "id": {
        "type": "string"
      },
      "url": {
        "type": "string"
      },
      "title": {
        "type": "string"
      },
      "content": {
        "type": "string"
      },
      "lang": {
        "type": "string",
        "maxLength": 5,
        "description": "The document language, as an ISO 639-1 code. Optional. Without it, the document gets the site's default language when one is set; otherwise the language is detected from the text.",
        "example": "en"
      },
      "image_url": {
        "type": "string",
        "nullable": true
      },
      "published_at": {
        "type": "string",
        "format": "date"
      },
      "tags": {
        "type": "array",
        "items": {
          "type": "string"
        }
      }
    }
  },
  "#/components/schemas/IndexDocRequest": {
    "type": "object",
    "required": [
      "id",
      "url",
      "title",
      "content"
    ],
    "properties": {
      "id": {
        "type": "string"
      },
      "url": {
        "type": "string"
      },
      "title": {
        "type": "string"
      },
      "content": {
        "type": "string"
      },
      "lang": {
        "type": "string",
        "maxLength": 5,
        "description": "The document language, as an ISO 639-1 code. Optional. Without it, the document gets the site's default language when one is set; otherwise the language is detected from the text.",
        "example": "en"
      },
      "category": {
        "type": "string",
        "nullable": true
      },
      "tags": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "updated_at": {
        "type": "string",
        "format": "date"
      }
    }
  },
  "#/components/responses/Unauthorized": {
    "description": "Missing or invalid API key",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorResponse"
        },
        "example": {
          "error": "Invalid API key."
        }
      }
    }
  },
  "#/components/schemas/ErrorResponse": {
    "type": "object",
    "description": "Error body for authentication (401), authorization (403), and service (502) errors.",
    "properties": {
      "error": {
        "type": "string",
        "description": "Human-readable error message"
      }
    }
  },
  "#/components/responses/ValidationError": {
    "description": "Validation error",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ValidationErrorResponse"
        },
        "example": {
          "message": "The query field is required.",
          "errors": {
            "query": [
              "The query field is required."
            ]
          }
        }
      }
    }
  },
  "#/components/schemas/ValidationErrorResponse": {
    "type": "object",
    "description": "Validation error body (422).",
    "properties": {
      "message": {
        "type": "string"
      },
      "errors": {
        "type": "object",
        "description": "Map of field name to an array of error messages"
      }
    }
  },
  "#/components/responses/RateLimited": {
    "description": "Rate limit exceeded",
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "message": {
              "type": "string"
            }
          }
        },
        "example": {
          "message": "Too many requests. Please try again later."
        }
      }
    }
  }
}
```

Full specification: https://docs.app-in.io/openapi.json
