Send an API event for a contact (triggers, goals and branches listen to it)
POST
/api/v1/workspaces/{workspace}/automations/events
# REPUTECAST_API_KEY: an API key (rc_live_…) with subscribers:edit.# Replace reputecast.example.com with your public URL and your-workspace with your workspace slug.curl --request POST \ --url https://reputecast.example.com/api/v1/workspaces/your-workspace/automations/events \ --header "Authorization: Bearer $REPUTECAST_API_KEY" \ --header 'Content-Type: application/json' \ --data '{ "event": "trial.started", "email": "sam.rivera@outlook.com", "properties": { "plan": "team", "trial_days": 14 } }'// REPUTECAST_API_KEY: an API key (rc_live_…) with subscribers:edit.// Replace reputecast.example.com with your public URL and your-workspace with your workspace slug.const response = await fetch('https://reputecast.example.com/api/v1/workspaces/your-workspace/automations/events', { method: 'POST', headers: { Authorization: `Bearer ${process.env.REPUTECAST_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ event: 'trial.started', // letters, numbers and . _ : - email: 'sam.rivera@outlook.com', // or contactId properties: { plan: 'team', trial_days: 14 }, // under 16 KB }),})const result = await response.json()// 404: no contact with that address; add the contact first, then send the event.if (!response.ok) throw new Error(`${response.status} ${result.code}: ${result.detail}`)console.log(`Recorded for ${result.contactId}; ${result.flows} live automations start from it`)// REPUTECAST_API_KEY: an API key (rc_live_…) with subscribers:edit.// Replace reputecast.example.com with your public URL and your-workspace with your workspace slug.package main
import ( "bytes" "encoding/json" "fmt" "log" "net/http" "os")
func main() { body, err := json.Marshal(map[string]any{ "event": "trial.started", // letters, numbers and . _ : - "email": "sam.rivera@outlook.com", // or contactId "properties": map[string]any{"plan": "team", "trial_days": 14}, // under 16 KB }) if err != nil { log.Fatal(err) } req, err := http.NewRequest(http.MethodPost, "https://reputecast.example.com/api/v1/workspaces/your-workspace/automations/events", bytes.NewReader(body)) if err != nil { log.Fatal(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("REPUTECAST_API_KEY")) req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req) if err != nil { log.Fatal(err) } defer resp.Body.Close()
var result struct { ContactID string `json:"contactId"` Flows int `json:"flows"` Code string `json:"code"` Detail string `json:"detail"` } if err := json.NewDecoder(resp.Body).Decode(&result); err != nil { log.Fatal(err) } // 404: no contact with that address; add the contact first, then send the event. if resp.StatusCode >= 300 { log.Fatalf("%d %s: %s", resp.StatusCode, result.Code, result.Detail) } fmt.Printf("Recorded for %s; %d live automations start from it\n", result.ContactID, result.Flows)}# REPUTECAST_API_KEY: an API key (rc_live_…) with subscribers:edit.# Replace reputecast.example.com with your public URL and your-workspace with your workspace slug.import os
import requests
response = requests.post( "https://reputecast.example.com/api/v1/workspaces/your-workspace/automations/events", headers={"Authorization": f"Bearer {os.environ['REPUTECAST_API_KEY']}"}, json={ "event": "trial.started", # letters, numbers and . _ : - "email": "sam.rivera@outlook.com", # or contactId "properties": {"plan": "team", "trial_days": 14}, # under 16 KB }, timeout=10,)result = response.json()# 404: no contact with that address; add the contact first, then send the event.if not response.ok: raise RuntimeError(f"{response.status_code} {result.get('code')}: {result.get('detail')}")print(f"Recorded for {result['contactId']}; {result['flows']} live automations start from it")<?php// REPUTECAST_API_KEY: an API key (rc_live_…) with subscribers:edit.// Replace reputecast.example.com with your public URL and your-workspace with your workspace slug.$payload = [ 'event' => 'trial.started', // letters, numbers and . _ : - 'email' => 'sam.rivera@outlook.com', // or contactId 'properties' => ['plan' => 'team', 'trial_days' => 14], // under 16 KB];
$ch = curl_init('https://reputecast.example.com/api/v1/workspaces/your-workspace/automations/events');curl_setopt_array($ch, [ CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ 'Authorization: Bearer ' . getenv('REPUTECAST_API_KEY'), 'Content-Type: application/json', ], CURLOPT_POSTFIELDS => json_encode($payload, JSON_THROW_ON_ERROR),]);$body = curl_exec($ch);if ($body === false) { throw new RuntimeException(curl_error($ch));}$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);$result = json_decode($body, true, flags: JSON_THROW_ON_ERROR);// 404: no contact with that address; add the contact first, then send the event.if ($status >= 300) { throw new RuntimeException("{$status} {$result['code']}: {$result['detail']}");}echo "Recorded for {$result['contactId']}; {$result['flows']} live automations start from it", PHP_EOL;Permission: subscribers:edit
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”workspace
required
Workspace slug
string
Workspace slug
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
contactId
string
email
string format: email
event
required
string
properties
object
key
additional properties
Responses
Section titled “Responses”Accepted
Media typeapplication/json
object
accepted
required
boolean
contactId
required
string
flows
required
Live automations triggered by this event
integer format: int64
Example generated
{ "accepted": true, "contactId": "example", "flows": 1}default
Section titled “default”Error
Media typeapplication/problem+json
object
code
Stable error code, e.g. permission_denied
string
detail
A human-readable explanation specific to this occurrence of the problem.
string
errors
Optional list of individual error details
Array<object>
object
location
Where the error occurred, e.g. ‘body.items[3].tags’ or ‘path.thing-id’
string
message
Error message text
string
value
The value at the given location
helpers
Members who hold the missing permission
Array<string>
instance
A URI reference that identifies the specific occurrence of the problem.
string format: uri
meta
object
key
additional properties
permission
The missing permission key
string
status
HTTP status code
integer format: int64
title
A short, human-readable summary of the problem type. This value should not change between occurrences of the error.
string
type
A URI reference to human-readable documentation for the error.
string format: uri
Example
{ "detail": "Property foo is required but is missing.", "instance": "https://example.com/error-log/abc123", "status": 400, "title": "Bad Request", "type": "about:blank"}