> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://www.comet.com/docs/opik/llms.txt.

# Run a project's topics now

POST http://localhost:5173/api/v1/internal/topics/projects/{projectId}/run

Queues the project's discovery run and returns its run id; any pod runs it. The run's outcome is on the project's topic_projects row while it is the project's latest run, and in the run's logs. The window ends at the start of the night date (UTC; default today, at most tomorrow, at least the vectors backfill window ago). The workspace is opted in to topics at stage build or later, the window holds topics.run.minVectors vectors of the project, and the project has no list and no run in flight. The project's vectors backfill must have drained: ignore_backfill=true builds it from the vectors it has so far. A failed discovery run's retry wait and topics.runs.maxInFlight do not apply.

Reference: https://www.comet.com/docs/opik/reference/rest-api/topics/run-project-topics

## Servers

- `http://localhost:5173/api` (Local server, default)
- `https://www.comet.com/opik/api` (Opik Cloud)

## Request

### Path parameters

- `projectId` (string, required)

### Query parameters

- `workspace_id` (string, required)
- `night` (string, optional)
- `ignore_backfill` (boolean, optional, default: false)

## Response

### 202

The run is queued

## Errors

### 400 Bad Request Error

The night is not a date, is after tomorrow, or is longer ago than the vectors backfill window

- `any`

### 409 Conflict Error

The workspace is not opted in at stage build or later, or topics are off, the window is too small, a run is in flight, the project has a list, or its vectors backfill has not drained

- `any`

### 503 Service Unavailable Error

The run could not be started; nothing is queued, try again

- `any`

## Examples

**Response**

```json
{}
```

**SDK Code**

```python
import requests

url = "http://localhost:5173/api/v1/internal/topics/projects/projectId/run"

querystring = {"workspace_id":"workspace_id"}

response = requests.post(url, params=querystring)

print(response.json())
```

```javascript
const url = 'http://localhost:5173/api/v1/internal/topics/projects/projectId/run?workspace_id=workspace_id';
const options = {method: 'POST'};

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

```go
package main

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

func main() {

	url := "http://localhost:5173/api/v1/internal/topics/projects/projectId/run?workspace_id=workspace_id"

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

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

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

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

}
```

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

url = URI("http://localhost:5173/api/v1/internal/topics/projects/projectId/run?workspace_id=workspace_id")

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

request = Net::HTTP::Post.new(url)

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

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

HttpResponse<String> response = Unirest.post("http://localhost:5173/api/v1/internal/topics/projects/projectId/run?workspace_id=workspace_id")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'http://localhost:5173/api/v1/internal/topics/projects/projectId/run?workspace_id=workspace_id');

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

```csharp
using RestSharp;

var client = new RestClient("http://localhost:5173/api/v1/internal/topics/projects/projectId/run?workspace_id=workspace_id");
var request = new RestRequest(Method.POST);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "http://localhost:5173/api/v1/internal/topics/projects/projectId/run?workspace_id=workspace_id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"

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()
```