Skip to main content
POST
/
v1
/
namespaces
/
{namespace}
/
search
JavaScript
import Charcoal from 'charcoal';

const client = new Charcoal({
  apiKey: process.env['CHARCOAL_API_KEY'], // This is the default and can be omitted
});

const searchResponse = await client.namespaces.search.create('namespace', {
  high_level_goal: 'high_level_goal',
  search_query: 'search_query',
});

console.log(searchResponse.session_id);
{
  "session_id": "<string>",
  "status": "pending",
  "synthesis": "<string>",
  "results": [
    {
      "finding": "<string>",
      "id": "<string>",
      "excerpts": [
        "<string>"
      ]
    }
  ],
  "clarification_needed": {
    "question": "<string>",
    "options": [
      "<string>"
    ]
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

namespace
string
required

Namespace identifier. Alphanumeric characters, hyphens, underscores, and dots. Max 128 characters.

Maximum string length: 128

Body

application/json
high_level_goal
string
required

The overarching goal for the search session.

search_query
string
required

The initial search query.

filters
And Condition · object

Recursive filter object. One of: { $and: [Filter, ...] } (all must match), { $or: [Filter, ...] } (any must match), or { field_name: FieldCondition } (field-level condition).

max_results
integer

Upper bound on the number of results to return.

stream
boolean
default:false

Whether to stream the response as server-sent events.

Response

200 - application/json

Successful response

session_id
string
required
status
enum<string>
required
Available options:
pending,
running,
clarification_needed,
completed,
failed,
expired
synthesis
string
required

Synthesized summary of all findings.

results
object[]
required
clarification_needed
object