Create an event type

POST
/v1/hooks/event_types

Adds a type to the catalog your applications' users subscribe from (in the portal, or the filter_types of an endpoint), with a description, a JSON Schema and examples to show them. Messages can be sent with any type, registered or not. Hooks resources belong to the API key's own environment: a coss_test_… key only ever sees sandbox ones, a coss_live_… key only production ones.

Authorization

bearerAuth
headerAuthorizationBearer <token>

A secret API key from the dashboard: coss_live_… for production environments, coss_test_… for sandbox environments.

Header Parameters

Coss-Version?"2026-10-10"

The API version (a date) to use for this request. Defaults to your organization's version, pinned to the latest one when it first used the API and upgraded from the dashboard. The SDK always sends the version it was built for.

Value in"2026-10-10"

Request Body

application/json
  1. body
name*string
Match^[A-Za-z0-9_.-]{1,64}$
description?string
Lengthlength <= 256
schema?

A JSON Schema of the payload, shown to your users (not enforced).

examples?array<>

Up to 5 example payloads; the first is what a test send delivers.

Itemsitems <= 5

Response Body

The event type.

application/json
  1. response
object*"hook_event_type"
Value in"hook_event_type"
name*string
description*string|null
schema*|null
examples*array<>
archived*boolean

Archived types are hidden from the portal and can't be subscribed to; messages of the type are still delivered to endpoints that subscribed before.

created_at*string
Formatdate-time
updated_at*string
Formatdate-time
import { Coss } from "coss";const coss = new Coss({  apiKey: process.env.COSS_API_KEY,  baseUrl: "https://api.coss.com",});const { data, error } = await coss.hooks.eventTypes.create({  name: "invoice.paid",  description: "An invoice was paid in full.",  examples: [    {      invoice_id: "in_1042",      amount: 4200,      currency: "usd",    },  ],});
{  "object": "hook_event_type",  "name": "invoice.paid",  "description": "An invoice was paid in full.",  "schema": {    "type": "object",    "properties": {      "invoice_id": {        "type": "string"      },      "amount": {        "type": "integer"      }    }  },  "examples": [    {      "invoice_id": "in_1042",      "amount": 4200,      "currency": "usd"    }  ],  "archived": false,  "created_at": "2026-01-15T09:30:00.000Z",  "updated_at": "2026-01-15T09:30:00.000Z"}