---
title: "Retrieve a Flamegraph for an Organization"
url: https://docs.sentry.io/api/profiling/retrieve-a-flamegraph-for-an-organization/
---

# Retrieve a Flamegraph for an Organization | Sentry Docs

GET /api/0/organizations/{organization\_id\_or\_slug}/profiling/flamegraph/

Retrieve an aggregated flamegraph for the organization, built from the requested data source (transactions, profiles, functions, or spans).

Pass `expand=metrics` to include aggregated function metrics in the response.

Requires profiling to be enabled for the organization.

### Path Parameters

* `organization_id_or_slug` *(string)*

  REQUIRED

  The ID or slug of the organization the resource belongs to.

### Query Parameters:

* `project` *(array(undefined))*

  The IDs or slugs of projects to filter by. Project slugs are unique within each organization. Omit this parameter to include all accessible projects. `-1` is also accepted to include all accessible projects. For example, the following are valid parameters:

  * `/?project=1234&project=56789`
  * `/?project=android&project=javascript-react`
  * `/?project=-1`

* `environment` *(array(string))*

  The name of environments to filter by.

* `statsPeriod` *(string)*

  The period of time for the query, will override the start & end parameters, a number followed by one of:

  * `d` for days
  * `h` for hours
  * `m` for minutes
  * `s` for seconds
  * `w` for weeks

  For example, `24h`, to mean query data starting from 24 hours ago to now.

* `start` *(string)*

  The start of the period of time for the query, expected in ISO-8601 format. For example, `2001-12-14T12:34:56.7890`.

* `end` *(string)*

  The end of the period of time for the query, expected in ISO-8601 format. For example, `2001-12-14T12:34:56.7890`.

* `fingerprint` *(integer)*

  A UInt32 function fingerprint. Only valid when `dataSource=functions`.

* `dataSource` *(string)*

  **choices**:

  * `transactions
    profiles
    functions
    spans`

  Source dataset to build the flamegraph from. Defaults to `functions` when `fingerprint` is set and `transactions` otherwise.

  * `transactions`
  * `profiles`
  * `functions`
  * `spans`

* `query` *(string)*

  Sentry [search syntax](https://docs.sentry.io/concepts/search.md) to filter the candidate profiles.

* `expand` *(array(string))*

  **choices**:

  * `metrics`

  Optional expansions. Pass `metrics` to include flamegraph metric aggregates in the response.

### Scopes

You need to [authenticate via bearer auth token.](https://docs.sentry.io/api/auth.md)

`<auth_token>` requires one of the following scopes:

* `org:admin`
* `org:read`
* `org:write`

```
curl https://sentry.io/api/0/organizations/{organization_id_or_slug}/profiling/flamegraph/ \
 -H 'Authorization: Bearer <auth_token>'
```

RESPONSESCHEMA

```
Copied
{
  "activeProfileIndex": 0,
  "metadata": {
    "deviceClassification": "",
    "deviceLocale": "",
    "deviceManufacturer": "",
    "deviceModel": "",
    "deviceOSName": "",
    "deviceOSVersion": "",
    "durationNS": 0,
    "organizationID": 0,
    "platform": "python",
    "profileID": "",
    "projectID": 0,
    "received": "2026-04-15T18:22:31Z",
    "sampled": false,
    "timestamp": "2026-04-15T18:22:31Z",
    "traceID": "",
    "transactionID": "",
    "transactionName": "GET /api/0/projects/{org}/{proj}/files/dsyms/",
    "version": ""
  },
  "platform": "python",
  "transactionName": "GET /api/0/projects/{org}/{proj}/files/dsyms/",
  "projectID": 1,
  "shared": {
    "frames": [
      {
        "name": "handle_request",
        "file": "app/web.py",
        "is_application": true,
        "line": 88,
        "fingerprint": 1111111111
      },
      {
        "name": "do_work",
        "file": "app/worker.py",
        "is_application": true,
        "line": 42,
        "fingerprint": 2222222222
      },
      {
        "name": "loads",
        "file": "json/__init__.py",
        "is_application": false,
        "line": 299,
        "fingerprint": 3333333333
      }
    ],
    "frame_infos": [
      {
        "count": 40,
        "weight": 40,
        "sumDuration": 4000000000,
        "sumSelfTime": 0,
        "p75Duration": 110000000,
        "p95Duration": 180000000,
        "p99Duration": 240000000
      },
      {
        "count": 40,
        "weight": 40,
        "sumDuration": 4000000000,
        "sumSelfTime": 1000000000,
        "p75Duration": 95000000,
        "p95Duration": 150000000,
        "p99Duration": 210000000
      },
      {
        "count": 30,
        "weight": 30,
        "sumDuration": 3000000000,
        "sumSelfTime": 3000000000,
        "p75Duration": 81000000,
        "p95Duration": 120000000,
        "p99Duration": 160000000
      }
    ],
    "profiles": [
      {
        "project_id": 1,
        "profile_id": "a1b2c3d4e5f60718293a4b5c6d7e8f90",
        "start": 1780084617.323,
        "end": 1780084617.8065438
      }
    ]
  },
  "profiles": [
    {
      "endValue": 40,
      "isMainThread": true,
      "name": "MainThread",
      "samples": [
        [
          0,
          1,
          2
        ],
        [
          0,
          1
        ]
      ],
      "sample_counts": [
        30,
        10
      ],
      "samples_examples": [
        [
          0
        ],
        [
          0
        ]
      ],
      "sample_durations_ns": [
        3000000000,
        1000000000
      ],
      "startValue": 0,
      "threadID": 1,
      "type": "sampled",
      "unit": "count",
      "weights": [
        30,
        10
      ]
    }
  ],
  "metrics": null
}
```

---

Find other pages: [Sitemap](https://docs.sentry.io/sitemap.md) lists every page with a one-line summary, and [llms.txt](https://docs.sentry.io/llms.txt) gives an overview with guidance for agents.
