fork of https://github.com/sourcegraph/zoekt
1# API
2
3When running `zoekt-webserver` with the `-rpc` option there will be a JSON HTTP API available for searches at `/api/search`:
4
5```
6curl -XPOST -d '{"Q":"needle"}' 'http://127.0.0.1:6070/api/search'
7```
8
9## Filtering by repository IDs
10
11If your projects are indexed with a `repoid` (added automatically by some
12indexers) then you can filter your searches to a subset of repositories
13efficiently using the `RepoIDs` filter:
14
15```
16curl -XPOST -d '{"Q":"needle","RepoIDs":[1234,4567]}' 'http://34.120.239.98/api/search'
17```
18
19## Options
20
21There are multiple options that can be passed under `Opts` which can also be
22found at
23[SearchOptions](https://github.com/sourcegraph/zoekt/blob/58cf4748830ac0eded1517cc8c2454694c531fbd/api.go#L470).
24
25```
26curl -XPOST -d '{"Q":"needle","Opts":{"EstimateDocCount":true,"NumContextLines":10}}' 'http://34.120.239.98/api/search'
27```