---
title: "Get search result schema"
method: POST
path: "/api/{org_id}/result_schema"
tags: ["Search"]
---

# Get search result schema

`POST /api/{org_id}/result_schema`

## Request

- Base URL: `https://api.openobserve.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api.openobserve.ai/api/{org_id}/result_schema`
- Auth: API key in header `Authorization`
- TypeScript: <https://skmtc.dev/openobserve/apis/openobserve-api-http/docs/api/:org_id/result_schema/post.ts> (a function with typed inputs; its response is checked against the schema)

Returns the schema definition for search results based on query parameters

## Path parameters

- `org_id` string, required

## Query parameters

- `is_streaming` boolean
- `cross_linking` boolean

## Request body

- object
  - `agent_options` SearchAgentOptions: Agent-oriented response options. When absent the response is unchanged, so existing clients (UI) are unaffected.
    - `mode` 'default' | 'partition'
    - `output_format` 'json' | 'csv' | 'md_table'
  - `clear_cache` boolean
  - `clusters` string[]
  - `encoding` 'base64' | 'Empty'
  - `local_mode` boolean, nullable
  - `query` SearchQuery, required
    - `analyze_profile` boolean: Adds the structured `profile` column to EXPLAIN ANALYZE output.
    - `end_time` integer, required
    - `from` integer
    - `histogram_interval` integer: Seconds; 0 uses the SQL `histogram()` interval, falling back to one from the time range.
    - `query_fn` string, nullable: Base64-encoded VRL program applied to the result hits.
    - `quick_mode` boolean: For `SELECT *` on streams wider than `quick_mode_num_fields`, reads only some columns.
    - `sampling_config` object, nullable
    - `sampling_ratio` number, double, nullable: Simplified sampling API: just specify ratio (0.0-1.0), backend uses optimal defaults Takes precedence over sampling_config if both are provided
    - `size` integer
    - `skip_wal` boolean: Not read by the search path; skipping the WAL is controlled by `feature_query_skip_wal`.
    - `sql` string, required
    - `start_time` integer, required
    - `streaming_id` string, nullable
    - `streaming_output` boolean: Set with `streaming_id` by the streaming search endpoints; other callers leave both unset.
    - `timezone` string, nullable: Default fixed-offset timezone (e.g. "+08:00") applied to histogram() buckets that don't carry their own 3rd timezone argument. None / "UTC" / "" => UTC.
    - `track_total_hits` boolean: Turns the query into a `count(*)` of matching rows; also skips the cache and streaming.
    - `uses_zo_fn` boolean: Set when the SQL calls a saved VRL function, which makes the result hits get flattened.
  - `regions` string[]
  - `search_event_context` SearchEventContext
    - `alert_key` string, nullable
    - `alert_name` string, nullable
    - `dashboard_id` string, nullable
    - `dashboard_name` string, nullable
    - `derived_stream_key` string, nullable
    - `folder_id` string, nullable
    - `folder_name` string, nullable
    - `panel_id` string, nullable
    - `public_dashboard_link_id` string, nullable
    - `range_key` string, nullable
    - `report_id` string, nullable
  - `search_type` 'ui' | 'dashboards' | 'reports' | 'alerts' | 'values' | 'other' | 'rum' | 'derivedstream' | 'searchjob' | 'download' | 'insights' | 'public_dashboard'
  - `timeout` integer
  - `use_cache` boolean
  - `use_index` boolean: Set to false to skip the inverted index for this query.

## Response `200`

Success

- ResultSchemaResponse
  - `cross_links` CrossLinksResponse
    - `org_links` CrossLink[], required
      - `fields` CrossLinkField[]: Show link only when at least one field matches the record. If empty, the link is always shown.
        - `alias` string, nullable: Populated by result_schema: the alias used in the query for this field.
        - `name` string, required
      - `name` string, required: Display name for the link
      - `url` string, required: URL template with {field_name} placeholders
    - `stream_links` CrossLink[], required
      - `fields` CrossLinkField[]: Show link only when at least one field matches the record. If empty, the link is always shown.
        - `alias` string, nullable: Populated by result_schema: the alias used in the query for this field.
        - `name` string, required
      - `name` string, required: Display name for the link
      - `url` string, required: URL template with {field_name} placeholders
  - `group_by` string[], required
  - `having` object, nullable
  - `projections` string[], required
  - `timeseries_field` string, nullable
  - `where_by_stream` object
  - `where_clause` string

## Other responses

- `400`: Failure
- `500`: Failure

---

[API](https://skmtc.dev/openobserve/apis/openobserve-api-http.md) - [All operations](https://skmtc.dev/openobserve/apis/openobserve-api-http/llms.txt) - [OpenAPI document](https://skmtc.dev/openobserve/apis/openobserve-api-http/revisions/0529b8a10252?raw)
