> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://stelltec.com/rhebok/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://stelltec.com/rhebok/docs/_mcp/server.

# Start an index run

POST http://127.0.0.1:7331/api/index
Content-Type: application/json

Starts `rhebok index` (or `rhebok index --reindex`) as a child process
whose output goes to `db.log`, and returns at once. Poll
`GET /api/progress` and `GET /api/index` to follow it.


Reference: https://stelltec.com/rhebok/docs/api/index/start-index

## Request

### Body (application/json)

This endpoint expects an IndexRequest.

- `reindex` (boolean, optional, default: false) — True runs `rhebok index --reindex`, which rebuilds from source.

## Response

### 202

The index process started.

- `started` (true, required)
- `pid` (integer, required)
- `reindex` (boolean, required)

## Errors

### 400 Bad Request Error

The body is not the JSON this route expects (it does not parse, or a required field is missing or has the wrong type).

- `error` (string, required) — What went wrong, in plain words.

### 409 Conflict Error

An index is already running (`{"error": "an index is already running"}`), or the request `Origin` is not this dashboard.

- `error` (string, required) — What went wrong, in plain words.

### 413 Content Too Large Error

The declared `Content-Length` is over 65,536 bytes.

- `error` (string, required) — What went wrong, in plain words.

### 421 Misdirected Request Error

The `Host` header does not name this dashboard (see the rules at the top of this page).

- `error` (string, required) — What went wrong, in plain words.

### 500 Internal Server Error

An unexpected server-side failure, such as failing to find the running binary, spawn a process, or read or write a file.

- `error` (string, required) — What went wrong, in plain words.

### 503 Service Unavailable Error

The rhebok binary to run is not an executable file. `fix` says how to repair it.

- `error` ("the rhebok CLI was not found", required)
- `fix` (string, required) — A command or instruction that repairs the install. Can be empty.

## Examples

**Request**

```json
{
  "reindex": false
}
```

**Response**

```json
{
  "started": true,
  "pid": 48213,
  "reindex": false
}
```

**SDK Code**

```python Index_startIndex_example
import requests

url = "http://127.0.0.1:7331/api/index"

payload = { "reindex": False }
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Index_startIndex_example
const url = 'http://127.0.0.1:7331/api/index';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"reindex":false}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Index_startIndex_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "http://127.0.0.1:7331/api/index"

	payload := strings.NewReader("{\n  \"reindex\": false\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Index_startIndex_example
require 'uri'
require 'net/http'

url = URI("http://127.0.0.1:7331/api/index")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"reindex\": false\n}"

response = http.request(request)
puts response.read_body
```

```java Index_startIndex_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("http://127.0.0.1:7331/api/index")
  .header("Content-Type", "application/json")
  .body("{\n  \"reindex\": false\n}")
  .asString();
```

```php Index_startIndex_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'http://127.0.0.1:7331/api/index', [
  'body' => '{
  "reindex": false
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Index_startIndex_example
using RestSharp;

var client = new RestClient("http://127.0.0.1:7331/api/index");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"reindex\": false\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Index_startIndex_example
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = ["reindex": false] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "http://127.0.0.1:7331/api/index")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```