CloudQuery notifications API
The notifications API from CloudQuery — 1 operation(s) for notifications.
The notifications API from CloudQuery — 1 operation(s) for notifications.
openapi: 3.1.0
info:
contact:
email: support@cloudquery.io
name: CloudQuery Support Team
url: https://cloudquery.io
description: 'Welcome to the CloudQuery Platform API documentation! This API can be used to interact with the CloudQuery platform. As a user, the API allows you to search the CloudQuery asset inventory, run SQL queries against the data warehouse, save and load searches, and much more. As an administrator, it allows you to manage your teams, syncs, and other objects.
### Authentication
The API is secured using bearer tokens. To get started, you can generate an API key for your Platform deployment from your platform dashboard. For a step-by-step guide, see: https://www.cloudquery.io/docs/cli/managing-cloudquery/deployments/generate-api-key.
The base URL for the API depends on where your CloudQuery Platform is hosted. If running locally, this is usually http://localhost:3000/api. In a production deployment it should be an HTTPS URL. For purposes of illustration, we will assume the platform instance is available at https://cloudquery.mycompany.com. In this case, the base API endpoint will be https://cloudquery.mycompany.com/api.
### Example Request
To test your connection to the API, we can use the `/plugins` endpoint. For example:
`curl -v -H "Authorization: Bearer $CLOUDQUERY_API_KEY" \ https://cloudquery.mycompany.com/api/plugins`
'
license:
name: MIT
url: https://spdx.org/licenses/MIT
termsOfService: https://www.cloudquery.io/terms
title: CloudQuery Platform OpenAPI Spec admin notifications API
version: 1.0.0
security:
- bearerAuth: []
- cookieAuth: []
tags:
- name: notifications
paths:
/notifications:
get:
description: List all notifications for triggered, enabled, policy-bound alerts
operationId: PlatformListNotifications
parameters:
- $ref: '#/components/parameters/platform_per_page'
- $ref: '#/components/parameters/platform_page'
- in: query
name: severities
required: false
schema:
type: array
items:
$ref: '#/components/schemas/PlatformPolicySeverity'
style: form
explode: true
description: Filter by policy severities (policy matches any)
- in: query
name: policy_group_ids
required: false
schema:
type: array
items:
$ref: '#/components/schemas/PlatformPolicyGroupID'
style: form
explode: true
description: Filter by policy groups (policy matches any)
responses:
'200':
description: Response
content:
application/json:
schema:
required:
- items
- metadata
properties:
items:
items:
$ref: '#/components/schemas/PlatformNotificationDetail'
type: array
metadata:
$ref: '#/components/schemas/PlatformListMetadata'
'401':
$ref: '#/components/responses/PlatformRequiresAuthentication'
'403':
$ref: '#/components/responses/PlatformForbidden'
'404':
$ref: '#/components/responses/PlatformNotFound'
'422':
$ref: '#/components/responses/PlatformUnprocessableEntity'
'500':
$ref: '#/components/responses/PlatformInternalError'
tags:
- notifications
components:
responses:
PlatformInternalError:
content:
application/json:
schema:
$ref: '#/components/schemas/PlatformBasicError'
description: Internal Error
PlatformNotFound:
content:
application/json:
schema:
$ref: '#/components/schemas/PlatformBasicError'
description: Resource not found
PlatformRequiresAuthentication:
content:
application/json:
schema:
$ref: '#/components/schemas/PlatformBasicError'
description: Requires authentication
PlatformForbidden:
content:
application/json:
schema:
$ref: '#/components/schemas/PlatformFieldError'
description: Forbidden
PlatformUnprocessableEntity:
content:
application/json:
schema:
$ref: '#/components/schemas/PlatformFieldError'
description: UnprocessableEntity
schemas:
PlatformNotificationDestinationID:
description: The unique ID for the notification destination.
type: string
format: uuid
x-go-name: NotificationDestinationID
PlatformListMetadata:
required:
- page_size
properties:
total_count:
type: integer
last_page:
type: integer
page_size:
type: integer
time_ms:
type: integer
PlatformFieldError:
allOf:
- $ref: '#/components/schemas/PlatformBasicError'
- properties:
errors:
items:
type: string
type: array
field_errors:
additionalProperties:
type: string
type: object
type: object
PlatformPolicySeverity:
description: Policy severity
type: string
enum:
- low
- medium
- high
- critical
x-go-name: PolicySeverity
PlatformAlertSeverity:
type: string
enum:
- low
- medium
- high
- critical
PlatformBasicError:
additionalProperties: false
description: Basic Error
required:
- message
- status
properties:
message:
type: string
status:
type: integer
title: Basic Error
type: object
PlatformAlertState:
type: string
enum:
- unknown
- pending
- inactive
- triggered
PlatformNotificationDetail:
title: Notification Detail
type: object
description: A notification instance for a triggered alert, including one notification destination. Each notification destination for an alert will result in a separate notification item.
additionalProperties: false
required:
- id
- query_id
- policy_id
- message
- severity
- state
- total_violations
- created_at
- updated_at
properties:
id:
type: string
format: uuid
description: Unique identifier for the alert
x-go-name: ID
query_id:
type: string
format: uuid
description: Reference to the associated query
x-go-name: QueryID
policy_id:
type: string
format: uuid
description: Reference to the associated policy
x-go-name: PolicyID
message:
type: string
description: Alert message content
severity:
$ref: '#/components/schemas/PlatformAlertSeverity'
state:
$ref: '#/components/schemas/PlatformAlertState'
total_violations:
type: integer
format: int64
description: Number of violations that triggered the alert
last_evaluated_at:
type: string
format: date-time
description: Timestamp when the alert was last evaluated
triggered_at:
type: string
format: date-time
description: Timestamp when the alert was triggered
created_at:
type: string
format: date-time
description: Timestamp when the alert was created
updated_at:
type: string
format: date-time
description: Timestamp when the alert was last updated
notification_destination:
$ref: '#/components/schemas/PlatformNotificationDestinationListItem'
description: The notification destination for this notification item (null if no destinations configured)
nullable: true
PlatformNotificationDestinationListItem:
title: Notification Destination List Item
type: object
description: Notification Destination List Item
additionalProperties: false
required:
- id
- name
- enabled
- type
- url
- created_at
- updated_at
properties:
id:
$ref: '#/components/schemas/PlatformNotificationDestinationID'
name:
type: string
example: Send to Slack
enabled:
type: boolean
type:
type: string
enum:
- webhook
- slack
description: Type of notification destination
url:
type: string
example: https://hooks.slack.com/services/EXAMPLE_T/EXAMPLE_B/EXAMPLE_SECRET_REDACTED
x-go-name: URL
slack_channels:
type: array
items:
type: string
description: List of Slack channel names (only for slack type)
x-go-name: SlackChannels
created_at:
example: '2017-07-14T16:53:42Z'
format: date-time
type: string
updated_at:
example: '2017-07-14T16:53:42Z'
format: date-time
type: string
PlatformPolicyGroupID:
title: Policy Group ID
type: string
format: uuid
x-go-name: PolicyGroupID
parameters:
platform_page:
description: Page number of the results to fetch
in: query
name: page
required: false
schema:
default: 1
minimum: 1
type: integer
format: int64
platform_per_page:
description: The number of results per page (max 1000).
in: query
name: per_page
required: false
schema:
default: 100
maximum: 1000
minimum: 1
type: integer
format: int64
securitySchemes:
bearerAuth:
scheme: bearer
type: http
basicAuth:
scheme: basic
type: http
cookieAuth:
scheme: cookie
type: http