# query:execute resulting in a 404

**URL:** <https://community.dynatrace.com/t/query-execute-resulting-in-a-404/56997>\
**Category:** Developer Q&A Forum\
**Tags:** grail\
**Created:** [September 22, 2026, 1:45pm UTC](https://community.dynatrace.com/t/query-execute-resulting-in-a-404/56997 "2026-09-22T13:45:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![coder33](https://avatars.discourse-cdn.com/v4/letter/c/8e8cbc/32.png) [@coder33](https://community.dynatrace.com/u/coder33)\
**Post date:** [September 22, 2026, 1:45pm UTC](https://community.dynatrace.com/t/query-execute-resulting-in-a-404/56997/1 "2026-09-22T13:45:51Z")

</div>

I am trying to query the logs using Grail.&nbsp; I am calling “https://{environmentid}.apps.dynatrace.com/platform/storage/query/v1/query:execute”&nbsp;and the response is a 404.&nbsp; I am using the same request body that works just fine from swagger.&nbsp; Also, the access token that gives 404 for “query:execute” seems to be working fine for “api/v2/logs/ingest”.&nbsp; Any ideas what I am doing wrong?

```javascript
{"error":{"code":404,"message":"Not found","errorDetails":[]}}

```

---

<div class="post-metadata">

**Author:** ![julsgs](https://avatars.discourse-cdn.com/v4/letter/j/858c86/32.png) [@julsgs](https://community.dynatrace.com/u/julsgs)\
**Post date:** [September 22, 2026, 5:43pm UTC](https://community.dynatrace.com/t/query-execute-resulting-in-a-404/56997/2 "2026-09-22T17:43:41Z")

</div>

Hi coder33, This is a common gotcha: query:execute lives under /platform/… on [apps.dynatrace.com](http://apps.dynatrace.com), which is a “Platform API,” and Platform APIs only accept an OAuth2 Bearer token from an OAuth client — they do not accept a classic API-Token, even though the Api-Token scheme works fine for classic environment APIs like api/v2/logs/ingest.

So the fact that your token works for logs/ingest but not for query:execute is expected, not a bug: those two endpoints are on different API layers with different auth requirements.

To fix it:

1. Create an OAuth client (Account Management \> Identity & access management \> OAuth clients, or in some tenants under Settings).
2. Grant it the IAM permissions your query needs, for example storage:buckets:read and storage:logs:read (add others depending on what you are querying, such as storage:events:read or storage:metrics:read).
3. Get an access token via the client\_credentials grant from the SSO token endpoint.
4. Call query:execute with “Authorization: Bearer \<access\_token\>” instead of “Authorization: Api-Token \<token\>”.

There’s a similar solved thread here that confirms the exact same pattern for the OpenPipeline API, which is architecturally the same kind of platform endpoint: [community.dynatrace.com/t5/Dynatrace-API/Platform-API-authentication-with-access-tokens-support/td-p/264055](http://community.dynatrace.com/t5/Dynatrace-API/Platform-API-authentication-with-access-tokens-support/td-p/264055)

One thing worth double-checking on your side: some platform gateways return 404 rather than 401 when the token type/scheme is wrong on that route, so a 404 here doesn’t necessarily mean the URL is wrong — it can also mean auth is being rejected before it even reaches the query service. Worth checking the raw response body/headers to see if there’s a message like “Unsupported authorization scheme” hiding in there.

Hope that helps!
