Backend Events
Send durable server-side product events to SafetyKit.
Beta.
SafetyKit uses backend events to understand meaningful product actions such as account creation, account updates, user-to-user contact, and content uploads. Send events from your backend after the action has happened in your system. Do not send backend events directly from a browser or mobile client.
Use the Events API reference for the full request schema, SDK examples, and response fields.
Quick Start
Section titled “Quick Start”Send one event, or an ordered batch of events, to:
POST https://api.safetykit.com/v1/eventsAuthorization: Bearer <SAFETYKIT_API_KEY>Content-Type: application/jsonSingle event:
{ "type": "user_contact", "event_name": "message_sent", "user_id": "user_123", "target_user_id": "user_456", "timestamp": "2026-05-21T00:15:15.000Z", "content": [ { "type": "text", "key": "body", "text": "Hey, is this still available?" } ], "metadata": { "conversation_id": "conversation_789", "channel": "marketplace_dm" }}Response:
{ "status": "ok", "event_id": "01KSR4C8JN1SA9X63T6P368K6W"}Batch event request:
[ { "type": "update_account", "event_name": "profile_updated", "user_id": "user_123", "timestamp": "2026-05-21T00:15:10.000Z", "metadata": { "changed_fields": ["bio"] } }, { "type": "user_contact", "event_name": "message_sent", "user_id": "user_123", "target_user_id": "user_456", "timestamp": "2026-05-21T00:15:15.000Z" }]Response:
{ "status": "ok", "event_ids": ["01KSR4C8JN1SA9X63T6P368K6W", "01KSR4CB1MFVX1TAYM46YQXZ3E"]}SafetyKit ingests every event in a batch before returning a response.
Event Shape
Section titled “Event Shape”Every event is a JSON object:
{ "type": "user_contact", "event_name": "message_sent", "user_id": "user_123", "target_user_id": "user_456", "timestamp": "2026-05-21T00:15:15.000Z", "content": [], "resources_used": [], "metadata": {}}Required base fields:
type: one ofuser_contact,content_uploaded,create_account, orupdate_accountevent_name: a stable, low-cardinality snake_case name for the product actiontimestamp: the time the event occurred in your system, as an ISO 8601 datetime stringuser_id: your canonical stable identifier for the user or account performing the action
Use stable event names like message_sent or profile_updated. Put dynamic values in typed fields, content, resources_used, or metadata.
Event Types
Section titled “Event Types”user_contact
Section titled “user_contact”Use when one user contacts, transacts with, or otherwise interacts with another user.
Required fields:
user_idtarget_user_id
Recommended fields:
content, if the interaction includes a message or user-authored notemetadata, for conversation IDs, transaction IDs, channel names, or similar context
Example:
{ "type": "user_contact", "event_name": "message_sent", "user_id": "sender_123", "target_user_id": "recipient_456", "timestamp": "2026-05-21T00:15:15.000Z", "metadata": { "conversation_id": "conversation_789" }}create_account
Section titled “create_account”Use when a user creates an account.
Required fields:
user_id
Recommended fields:
resources_used, for signup emails, phones, names, addresses, URLs, or social handlescontent, for public bio or profile textmetadata, for signup source, cohort, or other event-local context
update_account
Section titled “update_account”Use when a user updates account or profile information.
Required fields:
user_id
Recommended fields:
resources_used, for changed emails, phones, social handles, addresses, URLs, or payment identifierscontent, for changed public bio or profile textmetadata, for changed field names, visibility state, or other event-local context
content_uploaded
Section titled “content_uploaded”Use when a user posts, uploads, publishes, edits, or replaces content.
Required fields:
user_idcontent
Recommended fields:
metadata, for listing IDs, post IDs, visibility state, category, or similar product context
Content
Section titled “Content”Use content for user-authored or user-uploaded content SafetyKit should compare or analyze.
Text part:
{ "type": "text", "key": "body", "text": "Hey, is this still available?"}Image part:
{ "type": "image", "key": "profile_photo", "source": { "type": "url", "url": "https://cdn.example.com/images/profile.jpg" }}Guidelines:
- Split structured content into meaningful parts.
- Use stable
keyvalues such asbody,title,description,bio, orprimary_photo. - Send original user-authored text rather than rendered HTML when possible.
- Send canonical media URLs when available.
Resources
Section titled “Resources”Use resources_used for reusable identifiers associated with the event.
[ { "type": "email", "value": "user@example.com" }, { "type": "phone", "value": "+12069406843" }, { "type": "url", "value": "https://example.com/profile/user_123" }]Common resource types include email, phone, name, address, url, facebook, instagram, x, tiktok, youtube, linkedin, and payment_instrument.
Guidelines:
- Send values exactly as your backend receives or stores them.
- Prefer E.164 phone numbers if your system already has them.
- Prefer canonical URLs if your system already has them.
- Do not put multiple resources in one string.
- Do not duplicate the same value in both
resources_usedandmetadata.
Metadata
Section titled “Metadata”Use metadata for freeform non-PII product context for filtering, segmentation, debugging, and investigation.
{ "conversation_id": "conversation_789", "channel": "marketplace_dm", "is_first_message": true, "message_count_24h": 12}Metadata values may be strings, numbers, booleans, or arrays of strings, numbers, or booleans. Metadata keys should be stable snake_case strings.
Do not put raw PII, message bodies, bios, addresses, image URLs, or reusable identifiers in metadata. Use content or resources_used.
Operational Guidance
Section titled “Operational Guidance”- Send events after durable writes in your own system.
- For high-volume systems, write events to your own outbox or queue and have a worker send them to SafetyKit.
- Retry transient network errors and 5xx responses with exponential backoff.
- Do not retry 4xx responses without changing the request.
- Store your own source event identifier in
metadataif you need replay or reconciliation.