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

# Search

GET https://api.flockx.io/api/v1/knowledge/{id}/search

Search the specified knowledge graph for facts (nodes and edges) based on an optional query.

Reference: https://docs.flockx.io/api-reference/knowledge/search-knowledge-graph

## Authentication

- `Authorization` header (required) — API Key authentication via header

## Request

### Path parameters

- `id` (string, required)

### Query parameters

- `query` (string, optional, default: *) — Search query to filter nodes and edges of the graph.
- `limit` (integer, optional, default: 10) — Maximum number of results per result.

## Response

### 200

Successful Response

- `total_nodes` (integer, required)
- `total_edges` (integer, required)
- `nodes` (list of KnowledgeGraphNodeSchema, required)
- `edges` (list of KnowledgeGraphEdgeSchema, required)

## Errors

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

## Types

### KnowledgeGraphNodeSchema

Schema representing a node in the knowledge graph.

- `uuid` (string, required)
- `name` (string, required)
- `summary` (string, optional, nullable)
- `labels` (list of string, optional, nullable)
- `created_at` (string, optional, nullable)

### KnowledgeGraphEdgeSchema

Schema representing an edge in the knowledge graph.

- `uuid` (string, required)
- `fact` (string, required)
- `source_node_uuid` (string, required)
- `target_node_uuid` (string, required)
- `name` (string, optional, nullable)
- `created_at` (string, optional, nullable)
- `valid_at` (string, optional, nullable)

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)
- `input` (any, optional)
- `ctx` (ValidationErrorCtx, optional)

### ValidationErrorLocItems

### ValidationErrorCtx

## Examples

**Response**

```json
{
  "total_nodes": 42,
  "total_edges": 42,
  "nodes": [
    {
      "uuid": "foo",
      "name": "foo",
      "summary": "foo",
      "labels": [
        "foo"
      ],
      "created_at": "foo"
    }
  ],
  "edges": [
    {
      "uuid": "foo",
      "fact": "foo",
      "source_node_uuid": "foo",
      "target_node_uuid": "foo",
      "name": "foo",
      "created_at": "foo",
      "valid_at": "foo"
    }
  ]
}
```

**SDK Code**

```python
import requests

url = "https://api.flockx.io/api/v1/knowledge/id/search"

headers = {"Authorization": "<apiKey>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.flockx.io/api/v1/knowledge/id/search';
const options = {method: 'GET', headers: {Authorization: '<apiKey>'}};

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 := "https://api.flockx.io/api/v1/knowledge/id/search"

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

	req.Header.Add("Authorization", "<apiKey>")

	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.flockx.io/api/v1/knowledge/id/search")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = '<apiKey>'

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.get("https://api.flockx.io/api/v1/knowledge/id/search")
  .header("Authorization", "<apiKey>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.flockx.io/api/v1/knowledge/id/search', [
  'headers' => [
    'Authorization' => '<apiKey>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.flockx.io/api/v1/knowledge/id/search");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.flockx.io/api/v1/knowledge/id/search")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

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