Skip to content

GraphQL Queries

All queries require an Authorization: Bearer <token> header. Every query is scoped to the authenticated user’s data.

Semantic search across your knowledge base. Uses vector similarity to find documents matching the meaning of your query, not just keywords.

search(
query: String!
connectorId: ID
connectorType: String
author: String
after: DateTime
before: DateTime
contentType: String
tags: [String!]
limit: Int = 10
): SearchResults!
ParameterTypeDefaultDescription
queryString!requiredThe search query. Interpreted semantically, not as exact keyword match.
connectorIdIDnullFilter results to a specific connector.
connectorTypeStringnullFilter by connector type (e.g., "rss", "hacker-news").
authorStringnullFilter by document author.
afterDateTimenullOnly include documents dated after this timestamp.
beforeDateTimenullOnly include documents dated before this timestamp.
contentTypeStringnullFilter by content type (e.g., "text", "transcript").
tags[String!]nullFilter to documents matching all specified tags.
limitInt10Number of results to return. Maximum 50.

Returns SearchResults containing an array of ranked results, each with a document, snippet, and relevance score.

Terminal window
curl -X POST https://api.ontrove.sh/graphql \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"query": "query Search($q: String!, $limit: Int) { search(query: $q, limit: $limit) { totalMatches queryTimeMs results { relevanceScore snippet document { id title url author contentDate } } } }",
"variables": { "q": "distributed systems consensus", "limit": 5 }
}'

Thematic exploration of your knowledge base. Similar to search but optimized for browsing a topic rather than answering a specific question.

discover(
topic: String!
connectorId: ID
connectorType: String
limit: Int = 10
): SearchResults!
ParameterTypeDefaultDescription
topicString!requiredThe topic to explore.
connectorIdIDnullFilter results to a specific connector.
connectorTypeStringnullFilter by connector type.
limitInt10Number of results to return. Maximum 50.

Returns SearchResults, the same structure as search.

Terminal window
curl -X POST https://api.ontrove.sh/graphql \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"query": "query Discover($topic: String!) { discover(topic: $topic, limit: 10) { totalMatches results { relevanceScore snippet document { id title url author } } } }",
"variables": { "topic": "machine learning infrastructure" }
}'

Chronological listing of your most recently indexed documents, newest first.

recent(
connectorId: ID
connectorType: String
author: String
since: DateTime
limit: Int = 15
): [Document!]!
ParameterTypeDefaultDescription
connectorIdIDnullFilter to a specific connector.
connectorTypeStringnullFilter by connector type.
authorStringnullFilter by document author.
sinceDateTimenullOnly include documents indexed after this timestamp.
limitInt15Number of documents to return. Maximum 50.

Returns an array of Document objects.

Terminal window
curl -X POST https://api.ontrove.sh/graphql \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"query": "query Recent { recent(limit: 5) { id title author contentDate connector { connectorType } } }"
}'

Retrieve a single document by its ID. This is the only query that returns the full document text.

document(id: ID!): Document
ParameterTypeDefaultDescription
idID!requiredThe document ID.

Returns a Document or null if not found.

The fullText field is lazy-loaded from R2 storage on demand. Only request it when you need the complete document content. Use previewText for summaries and listings.

Terminal window
curl -X POST https://api.ontrove.sh/graphql \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"query": "query GetDocument($id: ID!) { document(id: $id) { id title url author contentDate previewText fullText wordCount contentType tags metadata } }",
"variables": { "id": "doc_abc123" }
}'

Paginated document listing with filtering and sorting. Use this for building document browsers, filtered views, and data exports.

documents(
connectorId: ID
connectorType: String
author: String
contentType: String
tags: [String!]
after: DateTime
before: DateTime
search: String
sortBy: DocumentSortField = INDEXED_AT
sortOrder: SortOrder = DESC
limit: Int = 25
offset: Int = 0
): DocumentConnection!
ParameterTypeDefaultDescription
connectorIdIDnullFilter to a specific connector.
connectorTypeStringnullFilter by connector type.
authorStringnullFilter by document author.
contentTypeStringnullFilter by content type.
tags[String!]nullFilter to documents matching all specified tags.
afterDateTimenullOnly include documents dated after this timestamp.
beforeDateTimenullOnly include documents dated before this timestamp.
searchStringnullText search filter (keyword match, not semantic).
sortByDocumentSortFieldINDEXED_ATSort field. One of: INDEXED_AT, CONTENT_DATE, TITLE, AUTHOR.
sortOrderSortOrderDESCSort direction. ASC or DESC.
limitInt25Page size. Maximum 100.
offsetInt0Number of documents to skip (offset-based pagination).

Returns DocumentConnection with nodes, totalCount, and hasMore.

Note: Avoid requesting fullText in paginated queries. Each fullText field triggers a read from object storage. Use previewText for listings and fetch full text via the document query for individual documents.

Terminal window
curl -X POST https://api.ontrove.sh/graphql \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"query": "query ListDocs($type: String, $limit: Int, $offset: Int) { documents(connectorType: $type, sortBy: CONTENT_DATE, sortOrder: DESC, limit: $limit, offset: $offset) { totalCount hasMore nodes { id title author contentDate contentType tags } } }",
"variables": { "type": "rss", "limit": 20, "offset": 0 }
}'

Retrieve a single connector by ID, including its nested statistics and recent activity.

connector(id: ID!): Connector
ParameterTypeDefaultDescription
idID!requiredThe connector ID.

Returns a Connector or null if not found. The connector type includes nested fields queryable in the same request:

  • recentDocuments(limit: 5): Latest documents from this connector.
  • topAuthors(limit: 5): Most prolific authors in this connector.
  • dateRange: Earliest and latest document dates.
  • syncRuns(limit: 5): Recent sync history.
Terminal window
curl -X POST https://api.ontrove.sh/graphql \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"query": "query GetConnector($id: ID!) { connector(id: $id) { id connectorType name status execution documentCount lastSyncedAt nextSyncAt recentDocuments(limit: 3) { id title contentDate } topAuthors(limit: 3) { author documentCount } dateRange { earliest latest } syncRuns(limit: 3) { id status startedAt documentsSynced } } }",
"variables": { "id": "conn_abc123" }
}'

List all connectors with optional filters by type, status, or execution mode.

connectors(
connectorType: String
status: ConnectorStatus
execution: ExecutionMode
): [Connector!]!
ParameterTypeDefaultDescription
connectorTypeStringnullFilter by connector type (e.g., "rss", "hacker-news").
statusConnectorStatusnullFilter by status: ACTIVE, PAUSED, ERROR, or SETUP.
executionExecutionModenullFilter by execution mode: CLOUD or LOCAL.

Returns an array of Connector objects.

Terminal window
curl -X POST https://api.ontrove.sh/graphql \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"query": "query ListConnectors($status: ConnectorStatus) { connectors(status: $status) { id connectorType name status execution documentCount lastSyncedAt } }",
"variables": { "status": "ACTIVE" }
}'

Query sync run history across all connectors or for a specific connector.

syncRuns(
connectorId: ID
status: SyncRunStatus
limit: Int = 20
offset: Int = 0
): [SyncRun!]!
ParameterTypeDefaultDescription
connectorIdIDnullFilter to a specific connector.
statusSyncRunStatusnullFilter by status: RUNNING, SUCCESS, ERROR, or CANCELLED.
limitInt20Number of results.
offsetInt0Offset for pagination.

Returns an array of SyncRun objects.

Terminal window
curl -X POST https://api.ontrove.sh/graphql \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"query": "query SyncHistory($connectorId: ID) { syncRuns(connectorId: $connectorId, limit: 10) { id status source documentsSynced startedAt completedAt durationMs errorMessage connector { id name } } }",
"variables": { "connectorId": "conn_abc123" }
}'

Account-level aggregates: total documents, total connectors, breakdowns by type, and upcoming sync information.

stats: UserStats!

None.

Returns UserStats.

Terminal window
curl -X POST https://api.ontrove.sh/graphql \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"query": "{ stats { totalDocuments totalConnectors activeConnectors documentsByConnectorType { connectorType documentCount } documentsByContentType { contentType documentCount } recentSyncRuns(limit: 3) { id status startedAt connector { name } } nextScheduledSync { id name nextSyncAt } } }"
}'