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

# Record a knowledge gap signal

> Tell Plain a thread revealed a question your knowledge sources do not answer, so it can group it into a knowledge gap.

Record a signal when your own AI agent can't answer a customer and hands the thread to your team, or when your team finds a question your docs should answer. Plain checks the signal the same way it checks [Customer Agent](https://www.plain.com/docs/product/agents/ari.md) signals, groups it into a [knowledge gap](https://www.plain.com/docs/graphql/knowledge-gaps.md), and raises a task once the gap has 2 signals.

> [!NOTE]
>
> Knowledge gaps are in beta. The mutation and fields on this page may change without a deprecation period.

<Snippet file="graphql/sdk-note.mdx" />

This operation requires the following permissions:

* `knowledgeGapSignal:create`
* `knowledgeGapSignal:read`
* `thread:read`
* `timeline:read`
* `helpCenterArticle:read` if you send a `helpCenterArticleId`
* `indexedDocument:read` if you send an `indexedDocumentId`

Knowledge gaps and Plain AI must be on for your workspace.

## What to send

Only `threadId` is required. Plain reads the thread's conversation to decide whether it's a gap and which gap it belongs to.

* `searchQueries`: what your agent searched for, up to 20 queries of at most 500 characters each
* `referencedDocuments`: the documents your agent found, up to 20. Set exactly one of `helpCenterArticleId` or `indexedDocumentId` on each, using the IDs that `searchKnowledgeSources` returns.

Sending what your agent searched for and found helps Plain tell a real gap from a question your docs already answer.

<Snippet file="graphql/create-knowledge-gap-signal.mdx" />

## Calling it again for the same thread

A signal is tied to the latest message in the thread. Calling the mutation again before a new message arrives returns the existing signal and records nothing new, so retries are safe. Once a new message arrives, the next call records a new signal, which counts toward the gap.

## Errors

| Code | Cause |
| - | - |
| `knowledge_gaps_not_enabled` | Knowledge gaps aren't on for your workspace |
| `plain_ai_must_be_enabled` | Plain AI is off for your workspace |
| `not_found` | The thread or a referenced document doesn't exist |
| `input_validation` | Too many queries or documents, both IDs set on one document, or the thread has no messages |
| `forbidden` | The API key is missing a required permission |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.