How do I request inline citation markers from Perplexity's Agent API?

The Citead team, updated

In short. Ask explicitly for separate bracketed inline markers, then resolve each number using the search results' id and url fields.

Definition: Inline citation markers are bracketed source references within an answer, such as [1][2]. As of October 2026, Perplexity documents an explicit prompt request for these markers in its Agent API, with each number referring to a search result's id.

Key facts

  • Perplexity's Web Search documentation says marker inclusion depends on the prompt and recommends requesting separate brackets for each source.
  • The Agent API quickstart documents response.output_text as the SDK property that combines response text.
  • The Streaming Citation Parsing cookbook instructs applications to collect every batch of search results, which share a citation identifier space.

What should the request contain?

The Web Search guide enables search through the tools array. The model decides when to search based on the prompt and instructions. This Python example adapts the documented request and appends Perplexity's suggested citation instruction to input:

from perplexity import Perplexity

client = Perplexity()
response = client.responses.create(
    model="openai/gpt-5.6-sol",
    input=(
        "Explain supervised learning. "
        "Cite your sources inline using bracketed markers, "
        "one source per bracket, like [1][2]."
    ),
    tools=[{"type": "web_search"}],
    instructions="Search for current, source-grounded information before answering.",
)
print(response.output_text)

The quickstart installs this SDK with pip install perplexityai. It reads the PERPLEXITY_API_KEY environment variable automatically. The documented HTTP endpoint is POST https://api.perplexity.ai/v1/agent.

Which fields identify the sources?

Perplexity's response shape reference places search evidence in an output item whose type is search_results, with sources inside its results array.

FieldDocumented meaning
idStable integer identifier used in citations.
urlCanonical source page URL.
titlePage title returned by the source.
snippetText excerpt extracted during search.
dateOriginal publication date.
last_updatedPage update date.
sourceResult origin, such as web.

The reference treats id and url as authoritative citation data, including when the answer omits markers.

The citation parsing cookbook builds a lookup from result identifiers to URLs, then replaces matching markers with clickable links. Its non-streaming example collects results from every search_results item in response.output. Keeping only the initial batch can leave later markers unresolved.

For streaming implementations, the same cookbook collects sources from response.reasoning.search_results events and answer text from response.output_text.delta events. It accumulates sources across events before resolving references.

FAQ

Can I use the answer text as the source list?

The quickstart describes output_text as aggregated text. For source links, use the structured results in response.output, as shown in the citation parsing cookbook.

What should I retain if markers are absent?

Keep the returned result identifiers and URLs. Perplexity's Web Search documentation explicitly identifies those fields as the citation reference regardless of marker output.

Sources

  1. Perplexity, "Web Search", undated
  2. Perplexity, "Agent API", undated
  3. Perplexity, "Streaming Citation Parsing", undated

Check how a page reads to answer engines. Open the GEO score analyzer

Test a page and see what to fix first

The analysis usually takes less than 10 seconds and needs no account.

400,000+ pages scored in the public benchmark