{
 "openapi": "3.1.0",
 "info": {
  "title": "Broadcasts (CRM)",
  "version": "20261030b",
  "description": "Every send, with what became of it. The rates are over what was DELIVERED rather than what was sent: an open rate over sends counts the bounces as people who did not open, which flatters a bad list and punishes a clean one."
 },
 "servers": [
  {
   "url": "https://{tenant}.tranxact.ai",
   "variables": {
    "tenant": {
     "default": "demo"
    }
   }
  }
 ],
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer"
   }
  },
  "schemas": {
   "broadcasts": {
    "type": "object",
    "required": [
     "code",
     "name"
    ],
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid",
      "description": "Id",
      "readOnly": true
     },
     "org_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org id",
      "readOnly": true
     },
     "org_unit_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org unit id",
      "readOnly": true
     },
     "broadcast_no": {
      "type": "string",
      "description": "Broadcast no",
      "readOnly": true
     },
     "campaign_id": {
      "type": "string",
      "format": "uuid",
      "description": "Campaign"
     },
     "code": {
      "type": "string",
      "description": "Code"
     },
     "name": {
      "type": "string",
      "description": "Name"
     },
     "name_local": {
      "type": "string",
      "description": "Local name"
     },
     "purpose": {
      "type": "string",
      "description": "What it is for"
     },
     "subject": {
      "type": "string",
      "description": "Subject"
     },
     "subject_local": {
      "type": "string",
      "description": "Local subject"
     },
     "preheader": {
      "type": "string",
      "description": "Preview text"
     },
     "body_html": {
      "type": "string",
      "description": "Message"
     },
     "body_text": {
      "type": "string",
      "description": "Plain text version"
     },
     "body_local": {
      "type": "string",
      "description": "Local message"
     },
     "template_id": {
      "type": "string",
      "format": "uuid",
      "description": "Template"
     },
     "media_urls": {
      "type": "array",
      "items": {
       "type": "string"
      },
      "description": "Picture or video"
     },
     "link_url": {
      "type": "string",
      "description": "Link"
     },
     "segment_id": {
      "type": "string",
      "format": "uuid",
      "description": "Audience"
     },
     "audience_filter": {
      "type": "object",
      "description": "Audience filter"
     },
     "audience_size": {
      "type": "integer",
      "description": "Audience size",
      "readOnly": true
     },
     "consent_purpose": {
      "type": "string",
      "description": "Consent purpose"
     },
     "suppressed_count": {
      "type": "integer",
      "description": "Suppressed count",
      "readOnly": true
     },
     "scheduled_for": {
      "type": "string",
      "format": "date-time",
      "description": "Send at"
     },
     "timezone": {
      "type": "string",
      "description": "Time zone"
     },
     "throttle_per_minute": {
      "type": "integer",
      "description": "Most a minute"
     },
     "status": {
      "type": "string",
      "description": "Status",
      "readOnly": true
     },
     "approved_by": {
      "type": "string",
      "format": "uuid",
      "description": "Approved by",
      "readOnly": true
     },
     "approved_at": {
      "type": "string",
      "format": "date-time",
      "description": "Approved at",
      "readOnly": true
     },
     "started_at": {
      "type": "string",
      "format": "date-time",
      "description": "Started at",
      "readOnly": true
     },
     "finished_at": {
      "type": "string",
      "format": "date-time",
      "description": "Finished at",
      "readOnly": true
     },
     "sent_count": {
      "type": "integer",
      "description": "Sent count",
      "readOnly": true
     },
     "delivered_count": {
      "type": "integer",
      "description": "Delivered count",
      "readOnly": true
     },
     "bounced_count": {
      "type": "integer",
      "description": "Bounced count",
      "readOnly": true
     },
     "opened_count": {
      "type": "integer",
      "description": "Opened count",
      "readOnly": true
     },
     "clicked_count": {
      "type": "integer",
      "description": "Clicked count",
      "readOnly": true
     },
     "replied_count": {
      "type": "integer",
      "description": "Replied count",
      "readOnly": true
     },
     "unsubscribed_count": {
      "type": "integer",
      "description": "Unsubscribed count",
      "readOnly": true
     },
     "complained_count": {
      "type": "integer",
      "description": "Complained count",
      "readOnly": true
     },
     "failed_count": {
      "type": "integer",
      "description": "Failed count",
      "readOnly": true
     },
     "social_reach": {
      "type": "integer",
      "description": "Social reach",
      "readOnly": true
     },
     "social_engagements": {
      "type": "integer",
      "description": "Social engagements",
      "readOnly": true
     },
     "cost": {
      "type": "string",
      "format": "decimal",
      "description": "Cost",
      "readOnly": true
     },
     "currency": {
      "type": "string",
      "description": "Currency",
      "readOnly": true
     },
     "notes": {
      "type": "string",
      "description": "Notes"
     },
     "is_active": {
      "type": "boolean",
      "description": "Active"
     },
     "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "Created at",
      "readOnly": true
     },
     "created_by": {
      "type": "string",
      "format": "uuid",
      "description": "Created by",
      "readOnly": true
     },
     "xf_text_1": {
      "type": "string",
      "description": "Xf text 1",
      "readOnly": true
     },
     "xf_text_2": {
      "type": "string",
      "description": "Xf text 2",
      "readOnly": true
     },
     "xf_text_3": {
      "type": "string",
      "description": "Xf text 3",
      "readOnly": true
     },
     "xf_text_4": {
      "type": "string",
      "description": "Xf text 4",
      "readOnly": true
     },
     "xf_text_5": {
      "type": "string",
      "description": "Xf text 5",
      "readOnly": true
     },
     "xf_num_1": {
      "type": "string",
      "format": "decimal",
      "description": "Xf num 1",
      "readOnly": true
     },
     "xf_num_2": {
      "type": "string",
      "format": "decimal",
      "description": "Xf num 2",
      "readOnly": true
     },
     "xf_num_3": {
      "type": "string",
      "format": "decimal",
      "description": "Xf num 3",
      "readOnly": true
     },
     "xf_date_1": {
      "type": "string",
      "format": "date",
      "description": "Xf date 1",
      "readOnly": true
     },
     "xf_date_2": {
      "type": "string",
      "format": "date",
      "description": "Xf date 2",
      "readOnly": true
     },
     "updated_at": {
      "type": "string",
      "format": "date-time",
      "description": "Updated at",
      "readOnly": true
     },
     "updated_by": {
      "type": "string",
      "format": "uuid",
      "description": "Updated by",
      "readOnly": true
     },
     "scheduled_by": {
      "type": "string",
      "format": "uuid",
      "description": "Scheduled by",
      "readOnly": true
     }
    }
   }
  }
 },
 "security": [
  {
   "bearer": []
  }
 ],
 "paths": {
  "/api/crm/broadcasts": {
   "get": {
    "summary": "list broadcasts",
    "operationId": "list_broadcasts_0_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "create broadcasts",
    "operationId": "create_broadcasts_1_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/crm/broadcasts/{id}": {
   "get": {
    "summary": "get broadcasts",
    "operationId": "get_broadcasts_0_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "put": {
    "summary": "change broadcasts",
    "operationId": "change_broadcasts_1_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "delete broadcasts",
    "operationId": "delete_broadcasts_2_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/crm/broadcasts/{id}/build-audience": {
   "post": {
    "summary": "Build audience",
    "operationId": "action_broadcasts_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/crm/broadcasts/{id}/approve": {
   "post": {
    "summary": "Approve",
    "operationId": "action_broadcasts_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/crm/broadcasts/{id}/schedule": {
   "post": {
    "summary": "Schedule",
    "operationId": "action_broadcasts_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/crm/broadcasts/{id}/unschedule": {
   "post": {
    "summary": "Unschedule",
    "operationId": "action_broadcasts_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/crm/broadcasts/{id}/send": {
   "post": {
    "summary": "Send",
    "operationId": "action_broadcasts_0_6",
    "description": "Body keys: test",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/crm/broadcasts/{id}/test-send": {
   "post": {
    "summary": "Test send",
    "operationId": "action_broadcasts_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/crm/broadcasts/unsubscribe": {
   "post": {
    "summary": "Unsubscribe",
    "operationId": "action_broadcasts_0_5",
    "description": "Body keys: detail, address*, channel, broadcastId, reason; reason one of unsubscribed|hard_bounce|complained|manual|role_address|competitor|invalid|legal|deceased",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/crm/broadcasts/{id}/detail": {
   "get": {
    "summary": "Detail",
    "operationId": "action_broadcasts_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/crm/broadcasts/overview": {
   "get": {
    "summary": "Overview",
    "operationId": "action_broadcasts_0_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/crm/broadcasts/{id}/copy": {
   "post": {
    "summary": "Copy",
    "operationId": "action_broadcasts_0_6",
    "description": "Body keys: overrides, preview, withLines",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  }
 }
}