Skip to main content

Ingest

Upsert a contact/rep registry entry

POST
/ingest/contacts
AuthorizationBearer <token>

API key issued to a Sonzai project. Format: Bearer sk_....

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/problem+json

curl -X POST "https://loading/api/v1/ingest/contacts" \  -H "Content-Type: application/json" \  -d '{    "contact_ref": "string",    "kind": "rep"  }'
{
  "$schema": "/api/v1/schemas/IngestContact.json",
  "contact_ref": "string",
  "created_at": "2019-08-24T14:15:22Z",
  "crm_owner_id": "string",
  "display_name": "string",
  "email": "string",
  "id": "string",
  "kind": "string",
  "metadata": {
    "property1": null,
    "property2": null
  },
  "phone_e164": "string",
  "project_id": "string",
  "tenant_id": "string",
  "updated_at": "2019-08-24T14:15:22Z"
}
{
  "$schema": "/api/v1/schemas/ErrorModel.json",
  "detail": "Property foo is required but is missing.",
  "errors": [
    {
      "location": "string",
      "message": "string",
      "value": null
    }
  ],
  "instance": "https://example.com/error-log/abc123",
  "status": 400,
  "title": "Bad Request",
  "type": "https://example.com/errors/example"
}

List recent DomainEvents (reconcile gap check)

GET
/ingest/events
AuthorizationBearer <token>

API key issued to a Sonzai project. Format: Bearer sk_....

In: header

Query Parameters

since*string

RFC 3339 lower bound: return events stored at/after this time

Formatdate-time
limit?integer

Max events per page

Default200
Formatint64
Range1 <= value <= 1000
cursor?string

Opaque pagination cursor from a prior page's next_cursor (overrides since when set)

Response Body

application/json

application/problem+json

curl -X GET "https://loading/api/v1/ingest/events?since=2019-08-24T14%3A15%3A22Z"
{
  "$schema": "/api/v1/schemas/ListEventsOutputBody.json",
  "events": [
    {
      "contact_ref": "string",
      "created_at": "2019-08-24T14:15:22Z",
      "event_id": "string",
      "lead_ref": "string",
      "occurred_at": "2019-08-24T14:15:22Z",
      "type": "string"
    }
  ],
  "next_cursor": "string"
}
{
  "$schema": "/api/v1/schemas/ErrorModel.json",
  "detail": "Property foo is required but is missing.",
  "errors": [
    {
      "location": "string",
      "message": "string",
      "value": null
    }
  ],
  "instance": "https://example.com/error-log/abc123",
  "status": 400,
  "title": "Bad Request",
  "type": "https://example.com/errors/example"
}

Ingest a DomainEvent v1

POST
/ingest/events
AuthorizationBearer <token>

API key issued to a Sonzai project. Format: Bearer sk_....

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/problem+json

curl -X POST "https://loading/api/v1/ingest/events" \  -H "Content-Type: application/json" \  -d '{    "event_id": "a7a26ff2-e851-45b6-9634-d595f45458b7",    "occurred_at": "2019-08-24T14:15:22Z",    "type": "lead.created"  }'
{
  "$schema": "/api/v1/schemas/IngestEventOutputBody.json",
  "duplicate": true,
  "event_id": "string",
  "type": "string"
}
{
  "$schema": "/api/v1/schemas/ErrorModel.json",
  "detail": "Property foo is required but is missing.",
  "errors": [
    {
      "location": "string",
      "message": "string",
      "value": null
    }
  ],
  "instance": "https://example.com/error-log/abc123",
  "status": 400,
  "title": "Bad Request",
  "type": "https://example.com/errors/example"
}