Sign Up
Home Getting Started SDK Guides AI Product Guide API Reference
Open in ChatGPT Open in Claude Open in Perplexity

POST /api/v1/events/query

POST/api/v1/events/query

Authenticate with Authorization: Bearer YOUR_API_KEY and X-Project-Id: YOUR_PROJECT_ID. Replace path placeholders and example values with your project's values.

Parameters

NameLocationTypePresenceDescription
X-Project-Idheaderstring (uuid)RequiredProject UUID. Use the project associated with your API key.

Request Body

Create request.json with the fields this operation requires. The examples read that file.

FieldTypePresenceDescription
environmentstringOptional
fromstringOptional
include_attributesbooleanOptional
limitintegerOptional
querystringOptional
servicestringOptional
sincestringOptional
sourcestringOptional
tostringOptional
with_childrenbooleanOptional
JSON schema
{
  "properties": {
    "environment": {
      "type": "string"
    },
    "from": {
      "type": "string"
    },
    "include_attributes": {
      "type": "boolean"
    },
    "limit": {
      "maximum": 9223372036854776000,
      "minimum": -9223372036854776000,
      "type": "integer"
    },
    "query": {
      "type": "string"
    },
    "service": {
      "type": "string"
    },
    "since": {
      "type": "string"
    },
    "source": {
      "type": "string"
    },
    "to": {
      "type": "string"
    },
    "with_children": {
      "type": "boolean"
    }
  },
  "type": "object"
}

Examples

curl --request POST 'https://api.monoscope.tech/api/v1/events/query' \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'X-Project-Id: YOUR_PROJECT_ID' \
  --header 'Content-Type: application/json' \
  --data-binary @request.json
import requests
import json

with open("request.json") as body_file:
  payload = json.load(body_file)

response = requests.post(
  "https://api.monoscope.tech/api/v1/events/query",
  headers={
  "Authorization": "Bearer YOUR_API_KEY",
  "X-Project-Id": "YOUR_PROJECT_ID",
  "Content-Type": "application/json"
},
  json=payload,
  timeout=30,
)
response.raise_for_status()
print(response.text)
import { readFile } from "node:fs/promises";
const payload = await readFile("request.json", "utf8");

const response = await fetch("https://api.monoscope.tech/api/v1/events/query", {
  method: "POST",
  headers: {
  "Authorization": "Bearer YOUR_API_KEY",
  "X-Project-Id": "YOUR_PROJECT_ID",
  "Content-Type": "application/json"
},
  body: payload,
});
if (!response.ok) throw new Error(`HTTP ${response.status}: ${await response.text()}`);
console.log(await response.text());

Responses

HTTP 200

Response defined by the API schema.

FieldTypePresenceDescription
colIdxMapobjectRequired
colsstring[]Required
countintegerRequired
cursorstringOptional
errorstringOptional
hasMorebooleanRequired
logsDataobject[][]Required
nextUrlstringRequired
queryResultCountintegerRequired
recentUrlstringRequired
resetLogsUrlstringRequired
serviceColorsobjectRequired
tracesobject[]Required
vizlogs | timeseries | timeseries_line | top_list | heatmap | patterns | sessionsOptional
JSON schema
{
  "properties": {
    "colIdxMap": {
      "additionalProperties": {
        "maximum": 9223372036854776000,
        "minimum": -9223372036854776000,
        "type": "integer"
      },
      "type": "object"
    },
    "cols": {
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "count": {
      "maximum": 9223372036854776000,
      "minimum": -9223372036854776000,
      "type": "integer"
    },
    "cursor": {
      "type": "string"
    },
    "error": {
      "type": "string"
    },
    "hasMore": {
      "type": "boolean"
    },
    "logsData": {
      "items": {
        "items": {
          "$ref": "#/components/schemas/JSONValue"
        },
        "type": "array"
      },
      "type": "array"
    },
    "nextUrl": {
      "type": "string"
    },
    "queryResultCount": {
      "maximum": 9223372036854776000,
      "minimum": -9223372036854776000,
      "type": "integer"
    },
    "recentUrl": {
      "type": "string"
    },
    "resetLogsUrl": {
      "type": "string"
    },
    "serviceColors": {
      "additionalProperties": {
        "type": "string"
      },
      "type": "object"
    },
    "traces": {
      "items": {
        "$ref": "#/components/schemas/TraceTreeEntry"
      },
      "type": "array"
    },
    "viz": {
      "enum": [
        "logs",
        "timeseries",
        "timeseries_line",
        "top_list",
        "heatmap",
        "patterns",
        "sessions"
      ],
      "type": "string"
    }
  },
  "required": [
    "logsData",
    "cols",
    "colIdxMap",
    "nextUrl",
    "resetLogsUrl",
    "recentUrl",
    "serviceColors",
    "queryResultCount",
    "count",
    "hasMore",
    "traces"
  ],
  "type": "object"
}

HTTP 400

Refused; error.code says why

FieldTypePresenceDescription
errorobjectRequired
JSON schema
{
  "properties": {
    "error": {
      "$ref": "#/components/schemas/ApiProblem"
    }
  },
  "required": [
    "error"
  ],
  "type": "object"
}

HTTP 401

Refused; error.code says why

FieldTypePresenceDescription
errorobjectRequired
JSON schema
{
  "properties": {
    "error": {
      "$ref": "#/components/schemas/ApiProblem"
    }
  },
  "required": [
    "error"
  ],
  "type": "object"
}

Authentication · Errors and retries · OpenAPI specification