Back to top

API Documentation

Deal Triggers

Brand-level deal automation defaults. Each rule is defined on a brand and applied to that brand’s deals (resolved across the brand’s ancestry).

A rule has a trigger, an action, and a wait_for offset:

  • trigger — what schedules it: deal_created, offer_checklist_added, or context_date_arrived (which also requires a context deal-context key, e.g. closing_date).

  • action — what it does. The only action today is send_email, which requires an email (a brand email template id) and emails the deal’s client(s).

  • wait_for — a Postgres interval offset (e.g. -3 days to fire three days before a context date, 0 to fire immediately).

Endpoints

Create a brand deal trigger

Create a brand deal trigger
POST/brands/:id/deals/triggers

Example URI

POST /brands/:id/deals/triggers
URI Parameters
HideShow
id
string (required) Example: 3a6f8884-32e4-4196-b685-ce4ab07e3cae
Request
HideShow
Body
{
  "trigger": "context_date_arrived",
  "context": "review_date",
  "action": "send_email",
  "email": "18737f08-fe14-4fee-b2ef-847051ad8259",
  "wait_for": "-3 days",
  "brand": "3a6f8884-32e4-4196-b685-ce4ab07e3cae",
  "created_by": "6647df20-116d-499d-8d3c-58bc36c60537"
}
Response  200
HideShow
Body
{
  "code": "OK",
  "data": {
    "id": "17d49e54-30c3-4b0b-91f2-c9ee5f609022",
    "created_at": 1787792056,
    "updated_at": 1787792056,
    "deleted_at": null,
    "created_by": "6647df20-116d-499d-8d3c-58bc36c60537",
    "brand": "3a6f8884-32e4-4196-b685-ce4ab07e3cae",
    "trigger": "context_date_arrived",
    "context": "review_date",
    "wait_for": {
      "days": -3
    },
    "action": "send_email",
    "type": "brand_deal_trigger"
  }
}

Get a brand's deal triggers

Get a brand's deal triggers
GET/brands/:id/deals/triggers

Example URI

GET /brands/:id/deals/triggers
URI Parameters
HideShow
id
string (required) Example: 3a6f8884-32e4-4196-b685-ce4ab07e3cae
Response  200
HideShow
Body
{
  "code": "OK",
  "data": [
    {
      "id": "17d49e54-30c3-4b0b-91f2-c9ee5f609022",
      "created_at": 1787792056,
      "updated_at": 1787792056,
      "deleted_at": null,
      "created_by": "6647df20-116d-499d-8d3c-58bc36c60537",
      "brand": "3a6f8884-32e4-4196-b685-ce4ab07e3cae",
      "trigger": "context_date_arrived",
      "context": "review_date",
      "wait_for": {
        "days": -3
      },
      "action": "send_email",
      "type": "brand_deal_trigger"
    }
  ],
  "info": {
    "count": 1,
    "total": 0
  }
}

Update a brand deal trigger

Update a brand deal trigger
PUT/brands/:id/deals/triggers/:tid

Example URI

PUT /brands/:id/deals/triggers/:tid
URI Parameters
HideShow
id
string (required) Example: 3a6f8884-32e4-4196-b685-ce4ab07e3cae
tid
string (required) Example: 17d49e54-30c3-4b0b-91f2-c9ee5f609022
Request
HideShow
Body
{
  "trigger": "deal_created",
  "action": "send_email",
  "email": "18737f08-fe14-4fee-b2ef-847051ad8259",
  "wait_for": "0",
  "id": "17d49e54-30c3-4b0b-91f2-c9ee5f609022"
}
Response  200
HideShow
Body
{
  "code": "OK",
  "data": {
    "id": "17d49e54-30c3-4b0b-91f2-c9ee5f609022",
    "created_at": 1787792056,
    "updated_at": 1787792056,
    "deleted_at": null,
    "created_by": "6647df20-116d-499d-8d3c-58bc36c60537",
    "brand": "3a6f8884-32e4-4196-b685-ce4ab07e3cae",
    "trigger": "deal_created",
    "context": null,
    "wait_for": {},
    "action": "send_email",
    "type": "brand_deal_trigger"
  }
}

Delete a brand deal trigger

Delete a brand deal trigger
DELETE/brands/:id/deals/triggers/:tid

Example URI

DELETE /brands/:id/deals/triggers/:tid
URI Parameters
HideShow
id
string (required) Example: 3a6f8884-32e4-4196-b685-ce4ab07e3cae
tid
string (required) Example: 17d49e54-30c3-4b0b-91f2-c9ee5f609022
Response  204
HideShow
Body
Brand defaults are materialized onto each deal as scheduled instances. All of a
deal's triggers are exposed via the `deal.triggers` association; the context-date
subset is additionally grouped per context key under `deal_context.triggers`
(event triggers like `deal_created` have no context, so they only appear under
`deal.triggers`). Either can be rescheduled or cancelled for the individual deal.

Get a deal's scheduled triggers

Get a deal's scheduled triggers
GET/deals/:id?associations[]=deal.triggers

Example URI

GET /deals/:id?associations[]=deal.triggers
URI Parameters
HideShow
id
string (required) Example: 91af2336-cc52-4ebd-b1b5-f034a2bb825d
associations
string (required) Example: deal.triggers
Response  200
HideShow
Body
{
  "code": "OK",
  "data": {
    "id": "91af2336-cc52-4ebd-b1b5-f034a2bb825d",
    "created_at": 1787792057.172007,
    "updated_at": 1787792057.172007,
    "deleted_at": null,
    "listing": null,
    "deal_type": "Buying",
    "brokerwolf_tier_id": null,
    "brokerwolf_id": null,
    "brokerwolf_row_version": null,
    "number": 7,
    "faired_at": null,
    "title": "[Draft]",
    "type": "deal",
    "attention_requested_at": null,
    "is_draft": true,
    "roles": null,
    "context": {
      "property_type": {
        "id": null,
        "type": "deal_context_item",
        "created_at": null,
        "created_by": null,
        "approved_by": null,
        "approved_at": null,
        "key": "property_type",
        "text": "Residential Lease",
        "number": null,
        "date": null,
        "data_type": "Text",
        "deal": "91af2336-cc52-4ebd-b1b5-f034a2bb825d",
        "checklist": null,
        "source": "PropertyType",
        "definition": "116ffd2b-3e6d-4a57-97cc-0e5eb5cb24e3",
        "searchable": "'leas':2 'residenti':1",
        "deleted_at": null
      },
      "review_date": {
        "id": "e4635cb1-ea59-48e1-945a-eebdcf3ab506",
        "type": "deal_context_item",
        "created_at": "2026-08-27T00:54:16.174283+00:00",
        "created_by": "6647df20-116d-499d-8d3c-58bc36c60537",
        "approved_by": null,
        "approved_at": null,
        "key": "review_date",
        "text": "2017/12/06",
        "number": null,
        "date": 1512518400,
        "data_type": "Date",
        "deal": "91af2336-cc52-4ebd-b1b5-f034a2bb825d",
        "checklist": "892fad3f-7f4d-4e20-8464-f9d0c66c73c6",
        "source": "Provided",
        "definition": "44273925-a498-4c1e-94fe-3018d089fbe3",
        "searchable": "'2017/12/06':1",
        "deleted_at": null
      },
      "type": "deal_context"
    },
    "new_notifications": null,
    "attention_requests": 0,
    "has_active_offer": true,
    "triggers": [
      {
        "id": "55bdbe58-b430-4fb7-8438-1a57d76e0e01",
        "created_at": 1787792056,
        "updated_at": 1787792056,
        "deleted_at": null,
        "created_by": "6647df20-116d-499d-8d3c-58bc36c60537",
        "deal": "91af2336-cc52-4ebd-b1b5-f034a2bb825d",
        "brand_deal_trigger": "17d49e54-30c3-4b0b-91f2-c9ee5f609022",
        "trigger": "context_date_arrived",
        "context": "review_date",
        "action": "send_email",
        "email": "18737f08-fe14-4fee-b2ef-847051ad8259",
        "wait_for": {
          "days": -3
        },
        "effective_at": 1787792056,
        "due_at": 1512259200,
        "executed_at": null,
        "failed_at": null,
        "failure": null,
        "email_campaign": null,
        "type": "deal_trigger"
      }
    ],
    "email": "[email protected]"
  }
}

Reschedule / retarget a scheduled trigger

Reschedule / retarget a scheduled trigger
PUT/deals/:id/triggers/:tid

Body accepts wait_for (interval offset) and/or email (brand email template id).

Example URI

PUT /deals/:id/triggers/:tid
URI Parameters
HideShow
id
string (required) Example: 91af2336-cc52-4ebd-b1b5-f034a2bb825d
tid
string (required) Example: 55bdbe58-b430-4fb7-8438-1a57d76e0e01
Request
HideShow
Body
{
  "wait_for": "-1 day",
  "email": "18737f08-fe14-4fee-b2ef-847051ad8259"
}
Response  200
HideShow
Body
{
  "code": "OK",
  "data": {
    "id": "55bdbe58-b430-4fb7-8438-1a57d76e0e01",
    "created_at": 1787792056,
    "updated_at": 1787792056,
    "deleted_at": null,
    "created_by": "6647df20-116d-499d-8d3c-58bc36c60537",
    "deal": "91af2336-cc52-4ebd-b1b5-f034a2bb825d",
    "brand_deal_trigger": "17d49e54-30c3-4b0b-91f2-c9ee5f609022",
    "trigger": "context_date_arrived",
    "context": "review_date",
    "action": "send_email",
    "email": "18737f08-fe14-4fee-b2ef-847051ad8259",
    "wait_for": {
      "days": -1
    },
    "effective_at": 1787792056,
    "due_at": 1512432000,
    "executed_at": null,
    "failed_at": null,
    "failure": null,
    "email_campaign": null,
    "type": "deal_trigger"
  }
}

Cancel a scheduled trigger

Cancel a scheduled trigger
DELETE/deals/:id/triggers/:tid

Example URI

DELETE /deals/:id/triggers/:tid
URI Parameters
HideShow
id
string (required) Example: 91af2336-cc52-4ebd-b1b5-f034a2bb825d
tid
string (required) Example: 55bdbe58-b430-4fb7-8438-1a57d76e0e01
Response  204

Generated by aglio on 27 Aug 2026