7 endpoints of the Integrations group.
The PostHog integration
GET/v1/integrations/posthog
Sendtide forwards mail events to PostHog as sendtide_email_<type> (sent, delivered, opened, clicked, bounced, complained, unsubscribed, failed) through PostHog's batch capture API. PostHog is an optional recipient that you configure yourself with your own project; events go there only after you set it up. The project API key is never returned, only api_key_hint.
Example
curl "https://api.sendtide.ch/v1/integrations/posthog" \
-H "Authorization: Bearer sk_test_…"
Responses
| Status | Description |
200 | The integration (configured false when not set up) PostHogIntegration Response fields configured | boolean | | id | string | null | | enabled | boolean | | disabled_reason | string | null | | host | string | | api_key_hint | string | null | Example: phc_…ab12 | events | array<string> | | distinct_id | object | | distinct_id.mode | enum: hashed | plain | metadata | | distinct_id.metadata_key | string | | metadata_keys | array<string> | | success_rate_24h | number | null | | created_at | string | null (date-time) | | event_types | array<string> | | hosts | array<object> | | hosts[].id | string | | hosts[].url | string | |
|
Set up or change the PostHog integration
PUT/v1/integrations/posthog
api_key (the project API key, phc_...) is required the first time. host is https://eu.i.posthog.com (default), https://us.i.posthog.com or the https URL of a self-hosted PostHog. distinct_id.mode is hashed (default: SHA-256 of an account specific salt and the recipient address), plain (the address) or metadata (the field metadata_key of the send request's metadata, the hashed id when it is missing). Only the metadata_keys you list are sent along as metadata_<key> properties. Re-enabling clears a disable reason. Test keys cannot change it (403 test_key_forbidden).
Request body application/json
| Field | Type | Description |
api_key | string | Example: phc_abc123 |
host | string (uri) | |
events | array<enum: sent | delivered | opened | clicked | bounced | complained | unsubscribed | failed> | |
distinct_id | object | |
distinct_id.mode | enum: hashed | plain | metadata | |
distinct_id.metadata_key | string | Example: user_id |
metadata_keys | array<string> | |
enabled | boolean | |
Example
curl -X PUT "https://api.sendtide.ch/v1/integrations/posthog" \
-H "Authorization: Bearer sk_test_…" \
-H "Content-Type: application/json" \
-d '{"api_key":"phc_abc123"}'
Responses
| Status | Description |
200 | Updated PostHogIntegration Response fields configured | boolean | | id | string | null | | enabled | boolean | | disabled_reason | string | null | | host | string | | api_key_hint | string | null | Example: phc_…ab12 | events | array<string> | | distinct_id | object | | distinct_id.mode | enum: hashed | plain | metadata | | distinct_id.metadata_key | string | | metadata_keys | array<string> | | success_rate_24h | number | null | | created_at | string | null (date-time) | | event_types | array<string> | | hosts | array<object> | | hosts[].id | string | | hosts[].url | string | |
|
201 | Set up PostHogIntegration Response fields configured | boolean | | id | string | null | | enabled | boolean | | disabled_reason | string | null | | host | string | | api_key_hint | string | null | Example: phc_…ab12 | events | array<string> | | distinct_id | object | | distinct_id.mode | enum: hashed | plain | metadata | | distinct_id.metadata_key | string | | metadata_keys | array<string> | | success_rate_24h | number | null | | created_at | string | null (date-time) | | event_types | array<string> | | hosts | array<object> | | hosts[].id | string | | hosts[].url | string | |
|
422 | Error in the usual format, errors and limits |
Remove the PostHog integration
DELETE/v1/integrations/posthog
Deletes the integration with its project key and its delivery log. Events already sent stay in PostHog.
Example
curl -X DELETE "https://api.sendtide.ch/v1/integrations/posthog" \
-H "Authorization: Bearer sk_test_…"
Responses
Send a test event to PostHog now
POST/v1/integrations/posthog/test
Sends one sendtide_test event (it creates no person) and reports PostHog's answer.
Example
curl -X POST "https://api.sendtide.ch/v1/integrations/posthog/test" \
-H "Authorization: Bearer sk_test_…"
Responses
| Status | Description |
200 | Result Response fields delivered | boolean | | status | integer | | duration_ms | integer | | error | string | |
|
404 | Error in the usual format, errors and limits |
Send the events of the last days to PostHog
POST/v1/integrations/posthog/backfill
Queues the selected mail events of the last days (1 to 30, at most 50'000 events, else 422 too_many_events). An event that still has a pending delivery is skipped. PostHog drops events it already has (same event id). Unsubscribes are not part of a backfill.
Request body application/json
| Field | Type | Description |
days * | integer | |
Example
curl -X POST "https://api.sendtide.ch/v1/integrations/posthog/backfill" \
-H "Authorization: Bearer sk_test_…" \
-H "Content-Type: application/json" \
-d '{"days":1}'
Responses
Deliveries to PostHog, newest first
GET/v1/integrations/posthog/deliveries
Parameters
| Name | In | Type | Description |
status | query | enum: pending | delivered | failed | |
limit | query | integer | Page size. The default and the maximum depend on the endpoint (emails 50 up to 500, received mail 50 up to 200, audit up to 200, the others 100 up to 500 or 1000). Default: 100 |
cursor | query | string | The next_cursor of the previous page. Opaque; pass it unchanged to the same endpoint with the same filters. |
Example
curl "https://api.sendtide.ch/v1/integrations/posthog/deliveries" \
-H "Authorization: Bearer sk_test_…"
Responses
| Status | Description |
200 | Deliveries Response fields data | array<WebhookDelivery> | | data[].id | integer | | data[].event_id | string | null | Example: evt_1042 | data[].event | enum: email.queued | email.sent | email.delivered | email.delayed | email.opened | email.machine_opened | email.clicked | email.bounced | email.complained | email.rejected | email.failed | email.suppressed | email.canceled | email.held | email.unsubscribed | email.received | | data[].status | enum: pending | delivered | failed | | data[].source | enum: event | retry | replay | | data[].attempts | integer | | data[].last_status | integer | null | | data[].last_error | string | null | | data[].duration_ms | integer | null | | data[].next_attempt_at | string | null (date-time) | | data[].created_at | string (date-time) | | next_cursor | string | null | |
|
Send the event of a delivery to PostHog again
POST/v1/integrations/posthog/deliveries/{delivery_id}/retry
Parameters
| Name | In | Type | Description |
delivery_id * | path | integer | |
Example
curl -X POST "https://api.sendtide.ch/v1/integrations/posthog/deliveries/42/retry" \
-H "Authorization: Bearer sk_test_…"
Responses
| Status | Description |
202 | Queued Response fields id | integer | | status | enum: pending | |
|
404 | Error in the usual format, errors and limits |
409 | Error in the usual format, errors and limits |