# Get index state

- Operation ID: `getIndexStateV2`
- HTTP method: `GET`
- Path: `/search/v2/indices/{indexId}/state`
- [Human-readable API reference](https://hub.synerise.com/api-reference/ai-search#tag/Search-Configuration/operation/getIndexStateV2)

## Self-contained OpenAPI method

The fenced document below contains this method's documentation and all of its local references. It is self-contained; no category or master specification fetch is required.

```yaml
openapi: 3.0.0
info:
  title: Synerise Public API
  version: 1.9.1
paths:
  /search/v2/indices/{indexId}/state:
    get:
      summary: Get index state
      description: |
        Retrieve the state of a single index.

        ---

        **API consumers:** <a href="/api-reference/authorization?tag=Authorization&amp;operationId=profileLogin" target="_blank" rel="noopener">Workspace (Business Profile)</a>, <a href="/api-reference/authorization?tag=Authorization&amp;operationId=userLogin" target="_blank" rel="noopener">Synerise User</a>

        **API key permission required:** `ITEMS_SEARCH_CONFIG_SEARCH_READ`

        **User role permission required:** `assets_search: read`
      operationId: getIndexStateV2
      tags:
        - Search Configuration
      security:
        - JWT: []
      parameters:
        - in: path
          name: indexId
          required: true
          description: ID of the index
          schema:
            type: string
      responses:
        "200":
          description: State returned
          content:
            application/json:
              schema:
                type: object
                description: State of a single index
                properties:
                  indexId:
                    type: string
                    description: ID of the index
                  state:
                    type: string
                    enum:
                      - NotReady
                      - ReadyUpToDate
                      - ReadyNotUpToDate
                    description: State of the index
                  lastConfigChange:
                    type: string
                    format: date-time
                    description: Last update time in YYYY-MM-DDThh:mm:ssZ format (ISO 8601, UTC)
                  lastSuccessfulBuildDate:
                    type: string
                    format: date-time
                    description: Completion time of the most recent successful build
                  indexMetadata:
                    type: object
                    description: Free-form metadata reported by the build
                  errorReason:
                    type: string
                    description: Reason why index was not rebuild successfully
                  log:
                    type: string
                    description: Error log with additional information
                  dynamicRerankerStatus:
                    type: string
                    enum:
                      - NotReady
                      - Ready
                    description: Whether the dynamic reranker index is built. Absent for suggestion indices
                  canEnableDynamicReranker:
                    type: boolean
                    description: Whether the workspace meets the data requirements for the dynamic reranker. Absent for suggestion indices
                  queryClassificationStatus:
                    type: string
                    enum:
                      - NotReady
                      - Ready
                    description: Whether the query classification model is built. Absent for suggestion indices
                  canEnableQueryClassification:
                    type: boolean
                    description: Whether the workspace meets the data requirements for query classification. Absent for suggestion indices
                  canEnableTargetOptimization:
                    type: boolean
                    description: Whether the workspace meets the data requirements for ranking target optimization. Absent for suggestion indices
                  queryTaggerStatus:
                    type: string
                    enum:
                      - NotTrained
                      - Training
                      - Ready
                      - Error
                    description: Lifecycle of the query-tagger model. Absent for suggestion indices
                  queryTaggerModelVersion:
                    type: string
                    description: Version of the published query-tagger model
                  queryTaggerTrainedAt:
                    type: string
                    format: date-time
                    description: Training time of the published query-tagger model
        "500":
          description: Service not available
          content:
            application/json:
              schema:
                type: object
                properties:
                  timestamp:
                    type: string
                    format: date-time
                    description: Time when the error occurred
                  status:
                    type: integer
                    description: Status code
                  error:
                    type: string
                    description: Summary of the error
                  message:
                    type: string
                    description: Description of the problem
                  path:
                    type: string
                    description: URL of the requested resource
                required:
                  - timestamp
                  - status
                  - message
      x-snr-doc-urls:
        - /api-reference/ai-search#tag/Search-Configuration/operation/getIndexStateV2
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl --request GET \
              --url https://api.synerise.com/search/v2/indices/%7BindexId%7D/state \
              --header 'Authorization: Bearer REPLACE_BEARER_TOKEN'
        - lang: Python
          label: Python
          source: |-
            import http.client

            conn = http.client.HTTPSConnection("api.synerise.com")

            headers = { 'Authorization': "Bearer REPLACE_BEARER_TOKEN" }

            conn.request("GET", "/search/v2/indices/%7BindexId%7D/state", headers=headers)

            res = conn.getresponse()
            data = res.read()

            print(data.decode("utf-8"))
        - lang: JavaScript
          label: JavaScript
          source: |-
            const data = null;

            const xhr = new XMLHttpRequest();
            xhr.withCredentials = true;

            xhr.addEventListener("readystatechange", function () {
              if (this.readyState === this.DONE) {
                console.log(this.responseText);
              }
            });

            xhr.open("GET", "https://api.synerise.com/search/v2/indices/%7BindexId%7D/state");
            xhr.setRequestHeader("Authorization", "Bearer REPLACE_BEARER_TOKEN");

            xhr.send(data);
        - lang: Node.js
          label: Node.js
          source: |-
            const http = require("https");

            const options = {
              "method": "GET",
              "hostname": "api.synerise.com",
              "port": null,
              "path": "/search/v2/indices/%7BindexId%7D/state",
              "headers": {
                "Authorization": "Bearer REPLACE_BEARER_TOKEN"
              }
            };

            const req = http.request(options, function (res) {
              const chunks = [];

              res.on("data", function (chunk) {
                chunks.push(chunk);
              });

              res.on("end", function () {
                const body = Buffer.concat(chunks);
                console.log(body.toString());
              });
            });

            req.end();
        - lang: PHP
          label: PHP
          source: |-
            <?php

            $request = new HttpRequest();
            $request->setUrl('https://api.synerise.com/search/v2/indices/%7BindexId%7D/state');
            $request->setMethod(HTTP_METH_GET);

            $request->setHeaders([
              'Authorization' => 'Bearer REPLACE_BEARER_TOKEN'
            ]);

            try {
              $response = $request->send();

              echo $response->getBody();
            } catch (HttpException $ex) {
              echo $ex;
            }
        - lang: Java
          label: Java
          source: |-
            HttpResponse<String> response = Unirest.get("https://api.synerise.com/search/v2/indices/%7BindexId%7D/state")
              .header("Authorization", "Bearer REPLACE_BEARER_TOKEN")
              .asString();
servers:
  - description: Microsoft Azure EU
    url: https://api.synerise.com
  - description: Microsoft Azure USA
    url: https://api.azu.synerise.com
  - description: Google Cloud Platform
    url: https://api.geb.synerise.com
tags:
  - name: Search Configuration
components:
  securitySchemes:
    JWT:
      type: http
      scheme: bearer
      description: |-
        JWT Bearer token. The header looks like this: `Bearer {JWT}`

        Remember to include the space between 'Bearer' and the token.

        Generate a token via the **Authorization** endpoints.
```
