v1

latestOpenAPI 3.1.0BSD-32026-07-2471176175.5 KB
events

Post an event

When something happens in one of your engineering systems that may have an impact on your cloud costs, submit an Event to the CloudZero API to correlate the Event with your ongoing cloud costs. For example, you can send us an Event every time you do a deployment. CloudZero will then correlate those deployment Events with changing cloud costs to help you understand what is driving said costs in any given period of time.

post/events/v1/events

Headers

Authorizationstring required

Your CloudZero API Key. Note: This is not a bearer token, and should appear in the header as Authorization: <cloudzero-api-key>

Request body

titlestring required

The title of the event, which will generally be the main string shown in the UI. Must not contain HTML tags or script injection patterns (e.g., <script>, onclick=). Values containing < or > will be rejected with a 400 error. Example: production-feature-deployed

sourcestring required

The system from which the event originates. Must not contain HTML tags or script injection patterns. Values containing < or > will be rejected with a 400 error. Example: jenkins

timestampstring

An ISO date string of when the event occurred. If you do not provide the timestamp, CloudZero will automatically generate the timestamp at the time the event is POSTed. User-provided timestamps are more accurate. Note: must be in UTC Example: 2020-03-03T15:32:44.474670+00:00

linkstring

A link to a page with more information about the event (e.g. a link to the CI/CD job, or a link to the PR.)

Example: http://jenkins.com/builds/production-feature

metadataobject

An optional blob of arbitrary data containing any additional data about the event. Values must not contain HTML tags or script injection patterns (e.g., <script>, onclick=). Example: { 'user': 'sasha@company.com', 'git_sha': '923dd0037a455576561b89c2321ffc36473578c7' }

Example request

{
  "title": "production-feature-deployed",
  "source": "jenkins",
  "timestamp": "2020-03-03T15:32:44.474670+00:00",
  "filters": {
    "accounts": [
      "012093365392",
      "055595555385"
    ],
    "resource_ids": [
      "arn:aws:lambda:us-east-1:055595555385:function:my-lambda-function"
    ],
    "services": [
      "AWSLambda",
      "AmazonAthena",
      "AmazonEC2"
    ],
    "tags": {
      "feature": "my-feature",
      "team": "my-team"
    },
    "usage_families": [
      "DataTransfer-Out-Bytes",
      "Request"
    ]
  },
  "link": "http://jenkins.com/builds/production-feature",
  "metadata": {
    "user": "sasha@company.com",
    "git_sha": "923dd0037a455576561b89c2321ffc36473578c7"
  }
}

Response

Event created

Example response

{
  "event": {
    "title": "production-feature-deployed",
    "source": "jenkins",
    "timestamp": "2020-03-03T15:32:44.474670+00:00",
    "filters": {
      "accounts": [
        "012093365392",
        "055595555385"
      ],
      "resource_ids": [
        "arn:aws:lambda:us-east-1:055595555385:function:my-lambda-function"
      ],
      "services": [
        "AWSLambda",
        "AmazonAthena",
        "AmazonEC2"
      ],
      "tags": {
        "feature": "my-feature",
        "team": "my-team"
      },
      "usage_families": [
        "DataTransfer-Out-Bytes",
        "Request"
      ]
    },
    "link": "http://jenkins.com/builds/production-feature",
    "metadata": {
      "user": "sasha@company.com",
      "git_sha": "923dd0037a455576561b89c2321ffc36473578c7"
    },
    "event_id": "8ddc2bga-8e8g-499c-a5ee-cgfc4d333b22"
  }
}