Create event type
Create a new event type with optional JSON Schema for validation.
POST
/event-types
Create a new event type with optional JSON Schema for validation.
Authentication
API Key (header: X-API-Key) API Key (cookie: better-auth.session_token)
Request Body required
Request body
application/jsonorg_id
string
REQUIRED
Organization ID
env_id
string
REQUIRED
Environment ID
name
string
REQUIRED
Dot-notation event type name
description
string
Human-readable description
json_schema
string
JSON Schema for payload validation
Responses
201
Event type created
application/jsonevent_type
unknown
REQUIRED
400
Bad request
401
Unauthorized
403
Plan limit reached
409
Event type name already exists
curl -X POST 'https://hookstream.io/v1/event-types' \ -H 'Authorization: Bearer YOUR_API_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "org_id": "string", "env_id": "string", "name": "invoice.paid", "description": "string", "json_schema": "string"}'
const response = await fetch('https://hookstream.io/v1/event-types', { method: 'POST', headers: { "Authorization": "Bearer YOUR_API_TOKEN", "Content-Type": "application/json" }, body: JSON.stringify({ "org_id": "string", "env_id": "string", "name": "invoice.paid", "description": "string", "json_schema": "string" })});const data = await response.json();console.log(data);
import requestsheaders = { 'Authorization': 'Bearer YOUR_API_TOKEN'}response = requests.post('https://hookstream.io/v1/event-types', headers=headers, json={ "org_id": "string", "env_id": "string", "name": "invoice.paid", "description": "string", "json_schema": "string"})print(response.json())
package mainimport ( "fmt" "io" "net/http" "strings")func main() { body := strings.NewReader(`{ "org_id": "string", "env_id": "string", "name": "invoice.paid", "description": "string", "json_schema": "string"}`) req, _ := http.NewRequest("POST", "https://hookstream.io/v1/event-types", body) req.Header.Set("Authorization", "Bearer YOUR_API_TOKEN") req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() result, _ := io.ReadAll(resp.Body) fmt.Println(string(result))}
201
Response
{ "event_type": { "id": "<string>", "org_id": "<string>", "env_id": "<string>", "name": "<string>", "description": "<string>", "json_schema": "<string>", "status": "<string>", "created_at": "<string>", "updated_at": "<string>" }}
API Playground
Try this endpoint
POST
/event-types