This page contains the information about Baselime API endpoints, types of requests that can be made to them and the expected responses.


# Application resources

Endpoint: go.baselime.io/v1

This endpoint enables the client to interact with resources on Baselime platform, such as queries, alerts or dashboards.

# Authentication Headers

  • content-type: application/json
  • x-api-key: <api key> - get your admin API key from Baselime console

# Dashboards

Description: Lists all dashboards in the environment.

Response

Body
{
  "data": Array<{
    "id": string
    "parameters": {
      "widgets": Array<{
        "type": "table" | "timeseries" | "statistic" | "timeseries_bar" // literal
        "queryId": string
      }>
    }
  }>
}

Description: Gets a dashboard by ID.

Request

  • {id} - The ID of the dashboard.

Response

Body
{
  "data": {
    "id": string
    "parameters": {
      "widgets": Array<{
        "type": "table" | "timeseries" | "statistic" | "timeseries_bar" // literal
        "queryId": string
      }>
    }
  }
}

Description: Creates a new dashboard.

Request

Body
{
  "id": string
  "parameters": {
    "widgets": Array<{
      "type": "table" | "timeseries" | "statistic" | "timeseries_bar" // literal
      "queryId": string
    }>
  }
}

Response

Body
{
  "data": {
    "id": string
    "parameters": {
      "widgets": Array<{
        "type": "table" | "timeseries" | "statistic" | "timeseries_bar" // literal
        "queryId": string
      }>
    }
  }
}

Description: Updates a dashboard.

Request

Body
{
  "id": string
  "parameters": {
    "widgets": Array<{
      "type": "table" | "timeseries" | "statistic" | "timeseries_bar" // literal
      "queryId": string
    }>
  }
}

Response

Body
{
  "data": {
    "id": string
    "parameters": {
      "widgets": Array<{
        "type": "table" | "timeseries" | "statistic" | "timeseries_bar" // literal
        "queryId": string
      }>
    }
  }
}

Description: Deletes a dashboard.

Request

  • {id} - The ID of the dashboard.

Response

Body
{
  "message": "Dashboard deleted",
}

# Queries

Description: Lists all queries in the environment.

Response

Body
{
  "data": Array<{
    "workspaceId": string
    "environmentId": string
    "id": string
    "parameters": {
      "datasets": Array<string>
      "calculations": Array<{
        "key": string
        "operator": string
        "alias": string
      }>
      "filters": Array<{
        "type": "string" | "number" | "boolean" // literal
        "key": string
        "operation": string
        "value": string | number | boolean
      }>
      "groupBys": Array<{
        "type": "string" | "number" | "boolean"
        "value": string | number | boolean
      }>
      "needle": {
        "value": string | number | boolean
        "isRegex": boolean
      }
      "filterCombination": "AND" | "OR" // literal
    }
  }>
}

Description: Gets a query by ID.

Request

  • {id} - The ID of the query.

Response

Body
{
  "data": {
    "workspaceId": string
    "environmentId": string
    "id": string
    "parameters": {
      "datasets": Array<string>
      "calculations": Array<{
        "key": string
        "operator": string
        "alias": string
      }>
      "filters": Array<{
        "type": "string" | "number" | "boolean" // literal
        "key": string
        "operation": string
        "value": string | number | boolean
      }>
      "groupBys": Array<{
        "type": "string" | "number" | "boolean"
        "value": string | number | boolean
      }>
      "needle": {
        "value": string | number | boolean
        "isRegex": boolean
      }
      "filterCombination": "AND" | "OR" // literal
    }
  }
}

Description: Creates a new query.

Request

Body
{
  "workspaceId": string
  "environmentId": string
  "id": string
  "parameters": {
    "datasets": Array<string>
    "calculations": Array<{
      "key": string
      "operator": string
      "alias": string
    }>
    "filters": Array<{
      "type": "string" | "number" | "boolean" // literal
      "key": string
      "operation": string
      "value": string | number | boolean
    }>
    "groupBys": Array<{
      "type": "string" | "number" | "boolean"
      "value": string | number | boolean
    }>
    "needle": {
      "value": string | number | boolean
      "isRegex": boolean
    }
    "filterCombination": "AND" | "OR" // literal
  }
}

Response

Body
{
  "data": {
    "workspaceId": string
    "environmentId": string
    "id": string
    "parameters": {
      "datasets": Array<string>
      "calculations": Array<{
        "key": string
        "operator": string
        "alias": string
      }>
      "filters": Array<{
        "type": "string" | "number" | "boolean" // literal
        "key": string
        "operation": string
        "value": string | number | boolean
      }>
      "groupBys": Array<{
        "type": "string" | "number" | "boolean"
        "value": string | number | boolean
      }>
      "needle": {
        "value": string | number | boolean
        "isRegex": boolean
      }
      "filterCombination": "AND" | "OR" // literal
    }
  }
}

Description: Updates a query.

Request

Body
{
  "workspaceId": string
  "environmentId": string
  "id": string
  "parameters": {
    "datasets": Array<string>
    "calculations": Array<{
      "key": string
      "operator": string
      "alias": string
    }>
    "filters": Array<{
      "type": "string" | "number" | "boolean" // literal
      "key": string
      "operation": string
      "value": string | number | boolean
    }>
    "groupBys": Array<{
      "type": "string" | "number" | "boolean" // literal
      "value": string | number | boolean
    }>
    "needle": {
      "value": string | number | boolean
      "isRegex": boolean
    }
    "filterCombination": "AND" | "OR" // literal
  }
}

Response

Body
{
  "data": {
    "workspaceId": string
    "environmentId": string
    "id": string
    "parameters": {
      "datasets": Array<string>
      "calculations": Array<{
        "key": string
        "operator": string
        "alias": string
      }>
      "filters": Array<{
        "type": "string" | "number" | "boolean" // literal
        "key": string
        "operation": string
        "value": string | number | boolean
      }>
      "groupBys": Array<{
        "type": "string" | "number" | "boolean"
        "value": string | number | boolean
      }>
      "needle": {
        "value": string | number | boolean
        "isRegex": boolean
      }
      "filterCombination": "AND" | "OR" // literal
    }
  }
}

Description: Deletes a query.

Request

  • {id} - The ID of the query.

Response

Body
{
  "message": "Query deleted"
}

# Alerts

Description: Lists all alerts in the environment.

Response

Body
{
  "data": Array<{
    "workspaceId": string
    "environmentId": string
    "id": string
    "name": string
    "description": string
    "enabled": boolean
    "generated": boolean
    "generatedType": string
    "channels": Array<{
      "type": "email" | "slack" | "webhook" // literal
      "targets": Array<string>
    }>
    "parameters": {
      "queryId": string
      "threshold": {
        "operation": string
        "value": number
      },
      "frequency": string
      "window": string
    },
    "snoozed": {
      "value": boleean
      "until": number
      "userId": string
    }
  }>
}

Description: Gets an alert by ID.

Request

  • {id} - The ID of the alert.

Response

Body
{
  "data": {
    "workspaceId": string
    "environmentId": string
    "id": string
    "name": string
    "description": string
    "enabled": boolean
    "generated": boolean
    "generatedType": string
    "channels": Array<{
      "type": "email" | "slack" | "webhook" // literal
      "targets": Array<string>
    }>
    "parameters": {
      "queryId": string
      "threshold": {
        "operation": string
        "value": number
      },
      "frequency": string
      "window": string
    },
    "snoozed": {
      "value": boleean
      "until": number
      "userId": string
    }
  }
}

Description: Creates a new alert.

Request

Body
{
  "workspaceId": string
  "environmentId": string
  "id": string
  "name": string
  "description": string
  "enabled": boolean
  "generated": boolean
  "generatedType": string
  "channels": Array<{
    "type": "email" | "slack" | "webhook" // literal
    "targets": Array<string>
  }>
  "parameters": {
    "queryId": string
    "threshold": {
      "operation": string
      "value": number
    },
    "frequency": string
    "window": string
  },
  "snoozed": {
    "value": boleean
    "until": number
    "userId": string
  }
}

Response

Body
{
  "data": {
    "workspaceId": string
    "environmentId": string
    "id": string
    "name": string
    "description": string
    "enabled": boolean
    "generated": boolean
    "generatedType": string
    "channels": Array<{
      "type": "email" | "slack" | "webhook" // literal
      "targets": Array<string>
    }>
    "parameters": {
      "queryId": string
      "threshold": {
        "operation": string
        "value": number
      },
      "frequency": string
      "window": string
    },
    "snoozed": {
      "value": boleean
      "until": number
      "userId": string
    }
  }
}

Description: Updates an alert.

Request

Body
{
  "workspaceId": string
  "environmentId": string
  "id": string
  "name": string
  "description": string
  "enabled": boolean
  "generated": boolean
  "generatedType": string
  "channels": Array<{
    "type": "email" | "slack" | "webhook" // literal
    "targets": Array<string>
  }>
  "parameters": {
    "queryId": string
    "threshold": {
      "operation": string
      "value": number
    },
    "frequency": string
    "window": string
  },
  "snoozed": {
    "value": boleean
    "until": number
    "userId": string
  }
}

Response

Body
{
  "data": {
    "workspaceId": string
    "environmentId": string
    "id": string
    "name": string
    "description": string
    "enabled": boolean
    "generated": boolean
    "generatedType": string
    "channels": Array<{
      "type": "email" | "slack" | "webhook" // literal
      "targets": Array<string>
    }>
    "parameters": {
      "queryId": string
      "threshold": {
        "operation": string
        "value": number
      }
      "frequency": string
      "window": string
      "filters": Array<{
        "type": "string" | "number" | "boolean" // literal
        "key": string
        "operation": string
        "value": string | number | boolean
      }>
      "groupBys": Array<{
        "type": "string" | "number" | "boolean"
        "value": string | number | boolean
      }>
      "needle": {
        "value": string | number | boolean
        "isRegex": boolean
      }
    }
    "snoozed": {
      "value": boleean
      "until": number
      "userId": string
    }
  }
}

Description: Deletes an alert.

Request

  • {id} - The ID of the alert.

Response

Body
{
  "message": "Alert deleted"
}

# Services

Description: Lists all services in the environment.

Response

Body
{
  "data": Array<{
    "name": string
    "workspaceId": string
    "environmentId": string
    "userId": string
    "generated": boolean
    "created": string
    "updated": string
    "metadata": Record<string, any>
  }>
}

Description: Gets a service by name.

Request

  • {id} - The name of the service.

Response

Body
{
  "data": {
    "name": string
    "workspaceId": string
    "environmentId": string
    "userId": string
    "generated": boolean
    "created": string
    "updated": string
    "metadata": Record<string, any>
  }
}

Description: Deletes a service.

Request

  • {name} - The name of the service.

Response

Body
{
  "message": "Service deleted",
}

# Telemetry data

Endpoint data.baselime.io

This endpoint enables you to query your telemetry data.

# Authentication

  • content-type: application/json
  • x-api-key: <api key> - get your admin API key from Baselime console

Description: Creates a new query run and returns its results.


Request

Body
{
  "workspaceId": string
  "environmentId": string
  "queryId": string
  "parameters": {
    "datasets": Array<string>
    "calculations": Array<{
      "key": string
      "operator": CalculationOperator
    }>
    "filters": Array<{
      "type": string
      "operation": FilterOperator
      "value": string | number | boolean
      "key": string
    }>
    "groupBys": Array<{
        "type": "string" | "number" | "boolean" // literal
        "value": string | number | boolean
    }>
    "orderBy": {
      "value": string,
      "order": "ASC" | "DESC"
    }
    "needle": {
        "value": string | number | boolean
        "isRegex": boolean
        "matchCase": boolean
    }
    "limit": number
  }
  "timeframe": {
    "from": number // unix milliseconds
    "to": number // unix milliseconds
  }
  "granularity": number // milliseconds
  "limit": number
  "view": "traces" | "events" | "calculations" | "invocations" | "requests"  | "patterns" // literal
  "patternType": "message" | "error"
}

Response

Body
{
  "message": "Success",
  "data": {
    "calculations": {
      "aggregates": Array<{
        "values": QueryDependent
      }>
      "series": Array<{
        "time": string
        "data": Array<{
          "aggregates": QueryDependent
        }>
      }>
    }
    "queryRun": {
      "id": number
      "workspaceId": string
      "environmentId": string
      "timeframe": {
        "from": number
        "to": number
      }
      "userId": string
      "status": string
      "granularity": number // milliseconds
      "query": Query
      "statistics": {
        "elapsed": number
        "rows_read": number
        "bytes_read": number
      }
    }
    "events": Array<Event>
    "patterns": Array<EventPatterns>
    "invocations": Record<string, Invocation>
    "rootSpans": Array<Span>
    "fields": Array<Field>
    "statistics": {
      "elapsed": number
      "rows_read": number
      "bytes_read": number
    }
  }
}

# Query data types

enum CalculationOperator {
  COUNT_DISTINCT = "COUNT_DISTINCT",
  COUNT = "COUNT",
  MAX = "MAX",
  MIN = "MIN",
  SUM = "SUM",
  AVG = "AVG",
  MEDIAN = "MEDIAN",
  P001 = "P001",
  P01 = "P01",
  P05 = "P05",
  P10 = "P10",
  P25 = "P25",
  P75 = "P75",
  P90 = "P90",
  P95 = "P95",
  P99 = "P99",
  P999 = "P999",
  STDDEV = "STDDEV",
  VARIANCE = "VARIANCE",
}
enum FilterOperator {
  EQUAL = "=",
  DIFFERENT = "!=",
  GREATER_THAN = ">",
  GREATER_THAN_EQUAL = ">=",
  LOWER_THAN = "<",
  LOWER_THAN_EQUAL = "<=",
  LIKE = "LIKE",
  NOT_LIKE = "NOT_LIKE",
  INCLUDES = "INCLUDES",
  DOES_NOT_INCLUDE = "DOES_NOT_INCLUDE",
  MATCH_REGEX = "MATCH_REGEX",
  EXISTS = "EXISTS",
  DOES_NOT_EXIST = "DOES_NOT_EXIST",
  IN = "IN",
  NOT_IN = "NOT_IN",
  STARTS_WITH = "STARTS_WITH",
}