---
title: "Merge profile stacks into a call tree"
method: POST
path: "/api/{org_id}/{stream_name}/profiles/merge"
tags: ["Profiles"]
---

# Merge profile stacks into a call tree

`POST /api/{org_id}/{stream_name}/profiles/merge`

## 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}/{stream_name}/profiles/merge`
- Auth: API key in header `Authorization`
- TypeScript: <https://skmtc.dev/openobserve/apis/openobserve-api-http/docs/api/:org_id/:stream_name/profiles/merge/post.ts> (a function with typed inputs; its response is checked against the schema)

Aggregates matching profile samples by stack and returns a call tree suitable for Flame Graph, Call Tree, and Top Table views. `profile_type` and `profile_unit` are required.

## Path parameters

- `org_id` string, required
- `stream_name` string, required

## Request body

- ProfilesQueryBody
  - `data_source` string, nullable
  - `end_time` integer
  - `filters` ProfileFilter[]
    - `key` string, required
    - `op` string
    - `value` string, required
  - `group_by` string, nullable: Label column that splits `series` into `groups` (series endpoint only).
  - `group_limit` integer, nullable: Groups returned before the rest fold into one `others` group: 1..=50, default 10.
  - `max_nodes` integer, nullable
  - `profile_type` string, nullable
  - `profile_unit` string, nullable
  - `service_name` string, nullable
  - `start_time` integer: Missing reads as 0 so `parse_required_time_range` reports it, not the JSON parser.
  - `step` string, nullable
  - `timeout` integer, nullable

## Response `200`

Success

- ProfilesMergeResponse
  - `merged_total` integer, required: Sample weight represented in `root` / `top` after the unique-stack cap.
  - `profile_type` string, required
  - `root` object, required: Call tree root (`name` / `self` / `total` / `children`).
  - `took` integer, required
  - `top` object[], required: Flattened top functions by exclusive (`self`) value (pre-truncation).
  - `total` integer, required: Full sample weight in scope (from `sum(value)` when stacks were capped).
  - `tree_truncated` boolean, required: True when the call tree was cut to `max_nodes` and light nodes folded into `other`.
  - `truncated` boolean, required: True when unique stacks exceeded the query size limit.
  - `unit` string, required

## Other responses

- `400`: Invalid request
- `403`: Forbidden
- `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)
