Events API

Canvas can receive events data pushed from your event stream directly.

0. Ask the Canvas team to enable the API

Before proceeding, ask the Canvas team to enable the Events API for your team.

1. Create an API key

This step can only be done by a user with Owner permissions. Navigate to the Settings page and scroll to the Events API section. Click the Create token button, then copy the generated key. This key is only generated one time and is not recoverable. You can create new keys.

Important: this key has permission to populate tables in your warehouse. Control access to the key as such.

2. Configure the API call

Configure your event stream to post the events data to Here's code with an example payload:

POST /v1/event HTTP/1.1
Content-Type: application/json
X-Auth-Token: [your api token]
Content-Length: 237

  "version": 1,
  "type": "event",
  "event": "Purchased an Item",
  "properties": {
    "revenue": "39.95",
    "shippingMethod": "2-day"
  "timestamp": "2012-12-02T00:30:08.276Z"

For Python:

import requests

url = ""

payload="{\"version\": 1,\"type\": \"event\",\"event\": \"Purchased an Item\",\"properties\" : {\"revenue\": \"39.95\",\"shippingMethod\" : \"2-day\"},\"timestamp\" : \"2012-12-02T00:30:08.276Z\"}"
headers = {
  'Content-Type': 'application/json',
  'X-Auth-Token': '[your_api_token]'

response = requests.request("POST", url, headers=headers, data=payload)


For NodeJS:

var axios = require('axios');
var data = JSON.stringify({
  version: 1,
  type: 'event',
  event: 'Purchased an Item',
  properties: { revenue: '39.95', shippingMethod: '2-day' },
  timestamp: '2012-12-02T00:30:08.276Z',

var config = {
  method: 'post',
  url: '',
  headers: {
    'Content-Type': 'application/json',
    'X-Auth-Token': '[your_api_token]',
  data: data,

  .then(function (response) {
  .catch(function (error) {
© 2024 Infinite Canvas Inc.
Twitter logo
LinkedIn logo
Spotify logo