---
title: "Semantic Search"
method: POST
path: "/v0/search/semantic_search"
tags: ["V0", "Search"]
---

# Semantic Search

`POST /v0/search/semantic_search`

## Request

- Base URL: `https://api.ultralayer.ai`
- URL: `https://api.ultralayer.ai/v0/search/semantic_search`
- Auth: HTTP bearer

Point-in-time and utility-filtered passage retrieval over Ultralayer's financial corpus (1-8 queries).

## Request body

- SemanticSearchParams
  - `queries` string[], required
  - `max_tokens` integer: Snippet token budget
  - `start_timestamp` string, date-time, nullable: System timestamp; Inclusive ISO 8601
  - `end_timestamp` string, date-time, nullable: System timestamp; Inclusive ISO 8601; null=realtime
  - `min_cosine_similarity` number, nullable
  - `source_metadata_filters` PublisherSourceMetadataFilter[], nullable: Exact metadata include/exclude filters.
    - `key` 'publisher'
    - `include_any` string[], nullable
    - `exclude_any` string[], nullable
  - `entity_types` string[], nullable: Match any.
  - `min_utility_score` number, nullable: 0-.2 noise; .2-.4 low; .4-.6 mod; .6-.8 high; .8-1 critical
  - `min_sentiment_score` number, nullable: -1..1; +-.2 neutral; +-.2-.6 mod; +-.6+ strong; mutually exclusive with max_sentiment_score
  - `max_sentiment_score` number, nullable
  - `detail` 'full' | 'standard' | 'essential': essential:minimal; standard:citable; full:all.

## Response `200`

Semantic search results at detail=full.

- SemanticSearchResult[]
  - `timestamp` string, date-time, required: System imestamp of the document.
  - `document_id` integer, required: Identifier of the indexed document.
  - `title` string, nullable, required: Title of the source document, if available.
  - `snippets` string[], required: Passage texts from this document, ordered as they appear in the document.
  - `snippet_cosine_similarities` number[], required: Cosine similarity of each snippet to the query. Same length and order as snippets.
  - `o200k_base_n_tokens` integer, required: o200k_base token count of the returned snippets.
  - `canonical_entity_names` string[], required: Canonical entity names across the returned snippets.
  - `utility_score` number, required: Token-weighted utility score of the returned snippets, between 0.0 and 1.0.
  - `sentiment_score` number, required: Token-weighted sentiment score of the returned snippets, between -1.0 and 1.0.
  - `source` Source, required: Full source information to be returned to end user.
    - `source_timestamp` string, date-time, required: Timestamp of the source item.
    - `source_table` 'news' | 'x_news' | 'youtube' | 'feeds' | 'x_posts' | 'tradingview_news' | 'telegram_messages' | 'web' | 'si_factor_assessments' | 'si_stakeholder_impacts' | 'fmp_company_descriptions' | 'fi_documents', required: Table (Type) of the source item.
    - `source_id` integer, required: 'id' of the source item
    - `url` string, required: Link to the source item. External sources link to the original page; first-party and synthesis sources link to their Ultralayer source page.
    - `source_metadata` union, required: Per-source metadata.
      - NewsSourceMetadata: source_metadata for rows where source_table == "news". News always has these two, so they are required (non-nullable). Do NOT widen this model for other sources; define a sibling model and register it in SOURCE_METADATA_BY_TABLE instead.
        - `title` string, required: Title of the news article.
        - `publisher` string, required: Publisher of the news article.
      - XNewsSourceMetadata: source_metadata for rows where source_table == "x_news". Only title: source_metadata is reserved for essential or genuinely filterable fields. x_id is encoded in Source.url; post_ids live in x_news.cluster_posts_results.
        - `title` string, required: X story title.
      - YouTubeSourceMetadata: source_metadata for rows where source_table == "youtube". Fields chosen for search filtering and source presentation: publisher links related channels; video_type distinguishes VIDEO, SHORT, and PODCAST; channel_name is the internal stable channel identity from YT_CONFIG. video_type / channel_name are optional because wire-derived citations only carry title/publisher from WireItemInternal. The documents-indexing path still sets both.
        - `title` string, required: YouTube video title.
        - `publisher` string, nullable, required: Internal publisher key linking related channels, e.g. bloomberg.
        - `video_type` string, nullable: VIDEO, SHORT, or PODCAST when known.
        - `channel_name` string, nullable: Internal stable channel identity from YT_CONFIG when known.
      - FeedsSourceMetadata: source_metadata for rows where source_table == "feeds". RSS headline rows. publisher is the internal feed/publisher key (nullable when unknown).
        - `title` string, required: Feed entry title.
        - `publisher` string, nullable, required: Internal publisher/feed key when known.
      - XPostsSourceMetadata: source_metadata for rows where source_table == "x_posts". Raw first-party posts have no title column — only publisher taxonomy.
        - `publisher` string, nullable, required: Publisher/rule-tag taxonomy when known.
      - TradingviewSourceMetadata: source_metadata for rows where source_table == "tradingview_news". TradingView stories always have a title; publisher is the normalized provider id.
        - `title` string, required: TradingView story title.
        - `publisher` string, nullable, required: Normalized provider id when known.
      - TelegramMessagesSourceMetadata: source_metadata for rows where source_table == "telegram_messages". Channel posts have no title column — only channel→publisher taxonomy.
        - `publisher` string, nullable, required: Channel→publisher taxonomy when known.
      - WebSourceMetadata: source_metadata for rows where source_table == "web".
        - `title` string, required: Title of the web record.
        - `record_type` string, required: Kind of web record (e.g. exa_search, azure_grounded).
      - SiFactorAssessmentSourceMetadata: source_metadata for rows where source_table == "si_factor_assessments". Lightweight identifiers only; full assessment content is retrieved via source_id. Assessments are first-party and have no public root URL; Source.coerce_source_metadata_and_url always mints /source/si_factor_assessments/{id}/{key} onto Source.url.
        - `factor_name` string, required: Factor name from the historical assessment.
        - `stakeholder_symbol` string, required: Stakeholder ticker from the historical assessment.
      - SiStakeholderImpactSourceMetadata: source_metadata for rows where source_table == "si_stakeholder_impacts". Lightweight identifiers only; full impact content (rationale, scores) is retrieved via source_id. Impacts are first-party and have no public root URL; Source.coerce_source_metadata_and_url always mints /source/si_stakeholder_impacts/{id}/{key} onto Source.url.
        - `stakeholder_symbol` string, required: Stakeholder ticker from the historical impact.
        - `stakeholder_name` string, required: Stakeholder name from the historical impact.
      - FmpCompanySourceMetadata: source_metadata for FMP data about one company. Today: rows where source_table == "fmp_company_descriptions". Lightweight identifiers only; the cited content is retrieved via source_id. Source.coerce_source_metadata_and_url mints FMP's page for symbol onto Source.url (ultralayer_python.source_url.build_fmp_company_url) for any table registered with this model. Nothing is stored for it. Another FMP company table reuses it by registering in SOURCE_METADATA_BY_TABLE and widening Source.source_table.
        - `symbol` string, required: Listing ticker of the company.
        - `company_name` string, required: Company name.
      - FilingDocumentSourceMetadata: source_metadata for rows where source_table == "fi_documents". No title column on fi_documents — do not invent one. document_class is not here: it is already GuidanceValue.source_type. fiscal_year / fiscal_quarter are the document's completed report period, not the guided period on the series — a Q2 release guiding FY revenue has Q2 here and FY on the series. Filing: fi_filings (nullable on a guidance update or an annual quarter). Call: fi_earnings_calls (always both; Q4 is 4). url lives on Source, not here: filing exhibits keep the document url; transcripts have none and Source mints a capability URL (ultralayer_python.source_url).
        - `symbol` string, required: Listing symbol of the filer.
        - `fiscal_year` integer, nullable, required: Filer fiscal year of the completed period this document reports, when it reports one.
        - `fiscal_quarter` integer, nullable, required: Filer fiscal quarter of that completed period; null for a full-year report or a document that reports no completed period.
        - `document_type` string, required: Source-native document label, e.g. EX-99.1 or transcript.

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/ultralayer/apis/ultralayer-api.md) · [All operations](https://skmtc.dev/ultralayer/apis/ultralayer-api/llms.txt) · [OpenAPI document](https://skmtc.dev/ultralayer/apis/ultralayer-api/revisions/4185459222be?raw)
