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

# Replace semantic similarity batches

PUT https://api.aventure.vc/v1/content/similarity/batch
Content-Type: application/json

Replaces stored semantic similarity rows for submitted batches and returns 204 with no response body.

Reference: https://docs.aventure.vc/api-reference/a-venture-api/semantic-similarity/replace-batch

## Authentication

- `Authorization` header (bearer token, required) — User bearer token: Supabase or Clerk session JWT, Clerk OAuth access token, or Clerk personal API key
- `X-API-Key` header (required) — Admin API key for system-to-system write operations

## Request

### Body (application/json)

- `list of object`
  - `result` (list of object, required)
    - `compositeScore` (double, required) — Ranking score combining aggregate, shared sections, and coverage.
    - `cosineScore` (double, required) — Aggregate fused-vector cosine score; preserved as the compatibility score.
    - `rank` (integer, required)
    - `targetId` (string, required)
    - `aggregateCosineScore` (double, optional, nullable) — Aggregate fused-vector cosine score used for ANN candidate retrieval.
    - `coverageScore` (double, optional, nullable) — Comparable section coverage shared by the source and target records.
    - `matchedSectionWeight` (double, optional, nullable) — Matched canonical section weight shared by the source and target records.
    - `sectionScore` (double, optional, nullable) — Weighted cosine score across section vectors present on both records.
    - `sharedSectionCount` (integer, optional, nullable) — Number of canonical sections present on both records.
  - `sourceId` (string, required)
  - `sourceType` (string, required)
  - `targetType` (string, required)

## Response

### 204

No Content

## Examples

**Request**

```json
[
  {
    "result": [
      {
        "compositeScore": 1.1,
        "cosineScore": 1.1,
        "rank": 1,
        "targetId": "string"
      }
    ],
    "sourceId": "string",
    "sourceType": "string",
    "targetType": "string"
  }
]
```

**SDK Code**

```python
import requests

url = "https://api.aventure.vc/v1/content/similarity/batch"

payload = [
    {
        "result": [
            {
                "compositeScore": 1.1,
                "cosineScore": 1.1,
                "rank": 1,
                "targetId": "string"
            }
        ],
        "sourceId": "string",
        "sourceType": "string",
        "targetType": "string"
    }
]
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://api.aventure.vc/v1/content/similarity/batch';
const options = {
  method: 'PUT',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '[{"result":[{"compositeScore":1.1,"cosineScore":1.1,"rank":1,"targetId":"string"}],"sourceId":"string","sourceType":"string","targetType":"string"}]'
};

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"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.aventure.vc/v1/content/similarity/batch"

	payload := strings.NewReader("[\n  {\n    \"result\": [\n      {\n        \"compositeScore\": 1.1,\n        \"cosineScore\": 1.1,\n        \"rank\": 1,\n        \"targetId\": \"string\"\n      }\n    ],\n    \"sourceId\": \"string\",\n    \"sourceType\": \"string\",\n    \"targetType\": \"string\"\n  }\n]")

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

	req.Header.Add("Authorization", "Bearer <token>")
	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
require 'uri'
require 'net/http'

url = URI("https://api.aventure.vc/v1/content/similarity/batch")

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

request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "[\n  {\n    \"result\": [\n      {\n        \"compositeScore\": 1.1,\n        \"cosineScore\": 1.1,\n        \"rank\": 1,\n        \"targetId\": \"string\"\n      }\n    ],\n    \"sourceId\": \"string\",\n    \"sourceType\": \"string\",\n    \"targetType\": \"string\"\n  }\n]"

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.put("https://api.aventure.vc/v1/content/similarity/batch")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("[\n  {\n    \"result\": [\n      {\n        \"compositeScore\": 1.1,\n        \"cosineScore\": 1.1,\n        \"rank\": 1,\n        \"targetId\": \"string\"\n      }\n    ],\n    \"sourceId\": \"string\",\n    \"sourceType\": \"string\",\n    \"targetType\": \"string\"\n  }\n]")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.aventure.vc/v1/content/similarity/batch', [
  'body' => '[
  {
    "result": [
      {
        "compositeScore": 1.1,
        "cosineScore": 1.1,
        "rank": 1,
        "targetId": "string"
      }
    ],
    "sourceId": "string",
    "sourceType": "string",
    "targetType": "string"
  }
]',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.aventure.vc/v1/content/similarity/batch");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "[\n  {\n    \"result\": [\n      {\n        \"compositeScore\": 1.1,\n        \"cosineScore\": 1.1,\n        \"rank\": 1,\n        \"targetId\": \"string\"\n      }\n    ],\n    \"sourceId\": \"string\",\n    \"sourceType\": \"string\",\n    \"targetType\": \"string\"\n  }\n]", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  [
    "result": [
      [
        "compositeScore": 1.1,
        "cosineScore": 1.1,
        "rank": 1,
        "targetId": "string"
      ]
    ],
    "sourceId": "string",
    "sourceType": "string",
    "targetType": "string"
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.aventure.vc/v1/content/similarity/batch")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
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()
```