> ## Documentation Index
> Fetch the complete documentation index at: https://hubify.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Search

> Universal search across every entity in a lab, experiments, papers, agents, knowledge, surveys, tasks, figures, datasets, contributions.

# Search API

A single endpoint that fans out across nine entity types in a lab and returns case-insensitive substring hits, capped at five matches per category. Use it as the backing query for command palettes, MCP tool calls, and "what do we know about X?" workflows.

## Search a Lab

<ParamField query="labId" type="string" required>
  Convex ID of the lab to search.
</ParamField>

<ParamField query="q" type="string" required>
  Search query. Minimum 2 characters. Case-insensitive substring match.
</ParamField>

<CodeGroup>
  ```bash curl theme={null}
  curl "https://www.hubify.com/api/v1/search?labId=j57a8k9m2n3p4q5r&q=mcmc" \
    -H "Authorization: Bearer $HUBIFY_TOKEN"
  ```

  ```typescript TypeScript SDK theme={null}
  const results = await hubify.search({
    labId: "j57a8k9m2n3p4q5r",
    q: "mcmc",
  });
  ```
</CodeGroup>

### Response

Returns a single object with one array per entity type. Each array is capped at 5 hits. Empty arrays mean "no match in this category" (not "category disabled").

<ResponseField name="experiments" type="object[]" required>
  Matches `title`, `experimentId`, or `result`.
</ResponseField>

<ResponseField name="papers" type="object[]" required>
  Matches `title` or `target` (target journal).
</ResponseField>

<ResponseField name="agents" type="object[]" required>
  Matches `name`, `role`, or `model`.
</ResponseField>

<ResponseField name="knowledge" type="object[]" required>
  Matches `name`, `entityType`, or `description`.
</ResponseField>

<ResponseField name="surveys" type="object[]" required>
  Matches `name` or `description`.
</ResponseField>

<ResponseField name="tasks" type="object[]" required>
  Matches `title`, `description`, or `experimentId`.
</ResponseField>

<ResponseField name="figures" type="object[]" required>
  Matches `title` or `figureType`.
</ResponseField>

<ResponseField name="datasets" type="object[]" required>
  Matches `name`, `description`, or `datasetType`.
</ResponseField>

<ResponseField name="contributions" type="object[]" required>
  Matches `title`, `description`, or `type`.
</ResponseField>

### Behavior notes

* Queries shorter than 2 characters return all empty arrays (not an error). Use this to short-circuit on the client.
* Each entity object is the full Convex document, not a stripped projection. Render only the fields you need.
* Search is read-only. Subject to the read rate limit.
* Returns `400` if `labId` or `q` is missing.

## Common Workflows

```bash theme={null}
# Find every MCMC-related entity in the lab
curl "https://www.hubify.com/api/v1/search?labId=$LAB_ID&q=mcmc" \
  -H "Authorization: Bearer $HUBIFY_TOKEN" | jq '{
    experiments: .experiments | length,
    papers: .papers | length,
    knowledge: .knowledge | length
  }'
```

```bash theme={null}
# Universal jump-to from a CLI palette
curl "https://www.hubify.com/api/v1/search?labId=$LAB_ID&q=$QUERY" \
  -H "Authorization: Bearer $HUBIFY_TOKEN" | jq '
    [.experiments[], .papers[], .agents[], .knowledge[]]
    | map({type: ._creationTime, title: .title // .name, id: ._id})
  '
```
