Prompt Runs
A prompt run represents a single execution of a prompt against an AI provider. Each prompt run produces an answer that may contain citations (URL references) and brand mentions.
Status lifecycle
status is an AiVisibilityPromptRunStatus enum, not
free text. Prompt runs progress through these statuses:
| Status | Terminal | Description |
|---|---|---|
Pending | No | Created and waiting to be processed |
Running | No | Currently being processed by the AI provider |
Submitted | No | Sent to the provider; the answer is still being collected |
Finished | Yes | Successfully completed with results |
Failed | Yes | Processing failed (see failureReason) |
NoResponse | Yes | The provider returned no answer for the prompt |
Each run also exposes isTerminal, which is true once the run has settled and no further work is expected.
Prefer it over comparing status against a list of your own: Submitted in particular is still in progress, and
if a status is added later isTerminal keeps classifying runs correctly.
Settled is not the same as immutable. A run can move between two settled statuses: if publishing a scheduled
batch appears to fail, its runs are marked Failed, but the publish may have succeeded with only the response
lost, and those runs are corrected to Finished once they complete. isTerminal stays true throughout, so it is
safe to stop polling -- but do not treat a cached Failed as the last word if the result matters.
List prompt runs
Retrieve prompt runs for a specific prompt with brand-specific metrics:
query GetAiVisibilityPromptRuns(
$accountId: ObjectID!
$aiVisibilityPromptId: ObjectID!
$aiVisibilityBrandId: ObjectID!
$dateRange: AiVisibilityDateRangeInput
) {
getAiVisibilityPromptRuns(
accountId: $accountId
aiVisibilityPromptId: $aiVisibilityPromptId
aiVisibilityBrandId: $aiVisibilityBrandId
dateRange: $dateRange
first: 20
orderBy: [{ field: createdAt, direction: DESC }]
) {
nodes {
id
rawId
status
isTerminal
aiProviderType
brandVisible
totalBrandCitations
totalBrandMentions
bestBrandPosition
avgBrandSentiment
createdAt
}
pageInfo {
hasNextPage
endCursor
}
totalCount
}
}
Sorting
Prompt runs can be sorted by: createdAt, status, totalBrandCitations, totalBrandMentions, bestBrandPosition, avgBrandSentiment.
Default sort is createdAt DESC.
Computed fields
Each prompt run includes these brand-specific metrics (calculated for the brand specified by aiVisibilityBrandId, including any merged variants):
| Field | Description |
|---|---|
brandVisible | Whether the brand appeared in the response (citations or mentions) |
totalBrandCitations | Number of citations referencing the brand |
totalBrandMentions | Number of times the brand was mentioned |
bestBrandPosition | Best (lowest) citation position for the brand |
avgBrandSentiment | Average sentiment score for brand mentions |
Get prompt run details
Fetch the full details of a prompt run, including the AI response text, all citations, and all mentions:
query GetAiVisibilityPromptRunDetails(
$accountId: ObjectID!
$aiVisibilityPromptRunId: ObjectID!
$aiVisibilityBrandId: ObjectID!
) {
getAiVisibilityPromptRunDetails(
accountId: $accountId
aiVisibilityPromptRunId: $aiVisibilityPromptRunId
aiVisibilityBrandId: $aiVisibilityBrandId
) {
aiProviderType
promptText
topicName
fullAnswerText
brandVisible
totalBrandCitations
totalBrandMentions
bestBrandPosition
avgBrandSentiment
visibilityScore
brandCitations {
url
position
citationQualityScore
}
brandMentions {
brandName
brandType
brandMentionQualityScore
sentiment
sentimentJustification
}
otherBrandCitations {
url
position
brandName
brandType
}
createdAt
}
}
The response includes:
fullAnswerText-- The complete AI-generated responsepromptText-- The original prompt textbrandCitations-- Citations attributed to the specified brandbrandMentions-- Mentions of the specified brandotherBrandCitations-- Citations attributed to other brands, plus unattributed ones. Accepts abrandTypesargument, e.g.otherBrandCitations(brandTypes: [Own, Competitor, Other]), to leaveContextbrands (platforms such as Google or ChatGPT) out; unattributed citations are always included
Schema reference
AiVisibilityPromptRunListItem-- Prompt run list itemAiVisibilityPromptRunDetails-- Full prompt run detailsAiVisibilityPromptRunStatus-- Status enumAiVisibilityPromptRunCitation-- Citation in a runAiVisibilityPromptRunMention-- Mention in a run