{
  "openapi": "3.0.1",
  "info": {
    "title": "Sendrealm API",
    "description": "API for email, push, audience resources, domains, campaign drafts, templates, events, topics, and automations",
    "license": {
      "name": "MIT"
    },
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.sendrealm.com"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/emails": {
      "post": {
        "summary": "Send an email",
        "description": "Send emails",
        "parameters": [
          {
            "$ref": "#/components/parameters/SendrealmProjectId"
          }
        ],
        "requestBody": {
          "description": "Send an email",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendEmail"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Email sent successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SendEmailResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/project": {
      "get": {
        "summary": "Get API key project",
        "description": "Return the project associated with the Bearer API key and the safe MCP capabilities available for it.",
        "parameters": [
          {
            "$ref": "#/components/parameters/SendrealmProjectId"
          }
        ],
        "responses": {
          "200": {
            "description": "Current project and capabilities",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "integer",
                      "example": 200
                    },
                    "data": {
                      "type": "object",
                      "required": [
                        "id",
                        "name",
                        "team_id",
                        "capabilities"
                      ],
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "name": {
                          "type": "string"
                        },
                        "team_id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "capabilities": {
                          "type": "object"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/domains": {
      "get": {
        "summary": "List domains",
        "description": "List non-deleted, non-transfer-preview sending domains in the API key project. This endpoint does not contact SES or change verification state.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/After"
          }
        ],
        "responses": {
          "200": {
            "description": "Domain list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "name": {
                            "type": "string"
                          },
                          "region": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string"
                          },
                          "verified_at": {
                            "type": "string",
                            "format": "date-time",
                            "nullable": true
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "updated_at": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "metadata": {
                      "$ref": "#/components/schemas/PaginationMetadata"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/domains/{id}": {
      "get": {
        "summary": "Get domain",
        "description": "Get stored domain settings and DNS records without triggering a verification refresh.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Id"
          }
        ],
        "responses": {
          "200": {
            "description": "Domain details",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "name": {
                          "type": "string"
                        },
                        "region": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        },
                        "settings": {
                          "type": "object"
                        },
                        "dns_records": {
                          "type": "array",
                          "items": {
                            "type": "object"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/campaigns": {
      "post": {
        "summary": "Create campaign draft",
        "description": "Create an email campaign in draft status. This public API cannot schedule or send campaigns.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Campaign draft created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CampaignResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      },
      "get": {
        "summary": "List campaigns",
        "description": "List email campaigns in the API key project.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/After"
          }
        ],
        "responses": {
          "200": {
            "description": "Campaign list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CampaignsListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/campaigns/{id}": {
      "get": {
        "summary": "Get campaign",
        "description": "Get a campaign's draft readiness, audiences, content, and delivery analytics.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Id"
          }
        ],
        "responses": {
          "200": {
            "description": "Campaign details",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CampaignResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "patch": {
        "summary": "Update campaign draft",
        "description": "Update metadata, sender, audiences, a published template version, tracking, or editor content. Only draft campaigns are editable; a sender must use a verified project domain.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "minProperties": 1,
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 120
                  },
                  "subject": {
                    "type": "string",
                    "maxLength": 998
                  },
                  "from": {
                    "type": "object",
                    "required": [
                      "name",
                      "address"
                    ],
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "address": {
                        "type": "string",
                        "format": "email"
                      }
                    }
                  },
                  "reply_to_address": {
                    "type": "string",
                    "format": "email",
                    "nullable": true
                  },
                  "audience_ids": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uuid"
                    }
                  },
                  "template_version_id": {
                    "type": "string",
                    "format": "uuid",
                    "nullable": true
                  },
                  "tracking": {
                    "type": "object"
                  },
                  "include_unsubscribe_link": {
                    "type": "boolean"
                  },
                  "unsubscribe_link_type": {
                    "type": "string",
                    "enum": [
                      "included_audiences",
                      "all_audiences"
                    ],
                    "nullable": true
                  },
                  "content": {
                    "type": "object",
                    "additionalProperties": {
                      "$ref": "#/components/schemas/JsonValue"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Campaign draft updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CampaignResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/push/apps": {
      "get": {
        "summary": "List push apps",
        "description": "List project push apps and redacted platform-provider readiness.",
        "responses": {
          "200": {
            "description": "Push apps returned",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PushAppsListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      },
      "post": {
        "summary": "Create a push app",
        "description": "Create a push app and default Android, iOS, and Web providers. Provider credentials remain dashboard-only.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 120
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Push app created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PushAppResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/push/apps/{id}": {
      "get": {
        "summary": "Retrieve a push app",
        "parameters": [
          {
            "$ref": "#/components/parameters/PushResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "Push app returned",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PushAppResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "patch": {
        "summary": "Update a push app",
        "description": "Rename a push app without changing provider credentials.",
        "parameters": [
          {
            "$ref": "#/components/parameters/PushResourceId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 120
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Push app updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PushAppResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/push/apps/{id}/providers": {
      "get": {
        "summary": "List push provider readiness",
        "description": "Return FCM, APNs, and Web Push readiness and public identifiers without secret credentials.",
        "parameters": [
          {
            "$ref": "#/components/parameters/PushResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "Provider readiness returned",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PushProvidersResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/push/apps/{id}/notification-channels": {
      "get": {
        "summary": "List push notification channels",
        "description": "List notification channels synchronized for a push app.",
        "parameters": [
          {
            "$ref": "#/components/parameters/PushResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "Notification channels returned",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PushNotificationChannelsResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/push/devices": {
      "get": {
        "summary": "List push devices",
        "description": "List redacted device registration and diagnostic state. Raw provider tokens are never returned.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/After"
          },
          {
            "name": "app_id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "platform",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "android",
                "ios",
                "web"
              ]
            }
          },
          {
            "name": "environment",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "development"
              ]
            }
          },
          {
            "name": "subscribed",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Push devices returned",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PushDevicesListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/push/devices/{id}": {
      "get": {
        "summary": "Retrieve push device diagnostics",
        "description": "Return one device and recent registration, permission, and client events without raw provider tokens.",
        "parameters": [
          {
            "$ref": "#/components/parameters/PushResourceId"
          }
        ],
        "responses": {
          "200": {
            "description": "Push device returned",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PushDeviceResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/push/test-notifications": {
      "post": {
        "summary": "Send a single-device push test",
        "description": "Queue one real test notification to one explicitly selected registered device. Provide campaign_id to test a saved draft, or provide title and body.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PushTestNotification"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Push test queued",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PushTestQueuedResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/push/test-notifications/{id}": {
      "get": {
        "summary": "Retrieve a push test trace",
        "description": "Poll a queued test and inspect provider and client events.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Id"
          }
        ],
        "responses": {
          "200": {
            "description": "Push test trace returned",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PushTestResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/push/campaigns": {
      "get": {
        "summary": "List push campaigns",
        "description": "List project push campaigns. Test-only delivery records are excluded.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/After"
          },
          {
            "name": "app_id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "environment",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "development"
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Push campaigns returned",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PushCampaignsListResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create a push campaign draft",
        "description": "Create a draft only. The public API does not schedule or launch push campaigns.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "app_id"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 120
                  },
                  "app_id": {
                    "type": "string"
                  },
                  "environment": {
                    "type": "string",
                    "enum": [
                      "production",
                      "development"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Push campaign draft created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PushCampaignResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/push/campaigns/{id}": {
      "get": {
        "summary": "Retrieve a push campaign",
        "parameters": [
          {
            "$ref": "#/components/parameters/Id"
          }
        ],
        "responses": {
          "200": {
            "description": "Push campaign returned",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PushCampaignDetailResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "patch": {
        "summary": "Update a push campaign draft",
        "description": "Update content, platforms, audiences, template selection, and platform configuration. Scheduling and launch are not accepted.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PushCampaignUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Push campaign draft updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PushCampaignResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/push/campaigns/{id}/audience-preview": {
      "get": {
        "summary": "Preview a push campaign audience",
        "description": "Count reachable subscribed devices by platform without sending.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Id"
          }
        ],
        "responses": {
          "200": {
            "description": "Reachable audience returned",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PushCampaignPreviewResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/push/notifications": {
      "get": {
        "summary": "List push notification delivery records",
        "description": "List direct, campaign, automation, and test notification records with redacted provider state.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/After"
          },
          {
            "name": "app_id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "platform",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "android",
                "ios",
                "web"
              ]
            }
          },
          {
            "name": "environment",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "production",
                "development"
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Push notifications returned",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PushNotificationsListResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Send a push notification",
        "description": "Send a push notification to a direct device target or to contact aliases.",
        "requestBody": {
          "description": "Push notification payload",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PushNotification"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Push notification sent successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PushNotificationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          }
        }
      }
    },
    "/push/notifications/{id}": {
      "get": {
        "summary": "Retrieve a push notification delivery trace",
        "description": "Return provider identifiers and chronological provider/client events for one notification.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Id"
          }
        ],
        "responses": {
          "200": {
            "description": "Push notification trace returned",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PushNotificationDetailResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/push/live-activities": {
      "post": {
        "summary": "Start a push Live Activity",
        "description": "Start a Live Activity session for targeted push devices.",
        "requestBody": {
          "description": "Live Activity start payload",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PushLiveActivityStart"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Live Activity start notification queued or sent",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PushLiveActivityResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          }
        }
      }
    },
    "/push/live-activities/{activity_id}/notifications": {
      "post": {
        "summary": "Send a push Live Activity notification",
        "description": "Send an update or end event to an existing Live Activity session.",
        "parameters": [
          {
            "name": "activity_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "Live Activity update or end payload",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PushLiveActivityNotification"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Live Activity notification sent",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PushLiveActivityResponse"
                }
              }
            }
          },
          "201": {
            "description": "Live Activity notification sent",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PushLiveActivityResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          }
        }
      }
    },
    "/events": {
      "post": {
        "summary": "Ingest an event",
        "description": "Submit a customer event to start or resume automations.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "event"
                ],
                "properties": {
                  "event": {
                    "type": "string",
                    "example": "order.completed"
                  },
                  "contact_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "external_id": {
                    "type": "string"
                  },
                  "payload": {
                    "type": "object",
                    "additionalProperties": {
                      "$ref": "#/components/schemas/JsonValue"
                    }
                  },
                  "correlation": {
                    "$ref": "#/components/schemas/Correlation"
                  },
                  "contact": {
                    "type": "object",
                    "properties": {
                      "mode": {
                        "type": "string",
                        "enum": [
                          "existing",
                          "upsert"
                        ]
                      },
                      "fields": {
                        "type": "object",
                        "additionalProperties": {
                          "$ref": "#/components/schemas/JsonValue"
                        }
                      }
                    }
                  },
                  "occurred_at": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "idempotency_key": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event replay deduplicated",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "event": {
                          "type": "string"
                        },
                        "deduplicated": {
                          "type": "boolean"
                        },
                        "occurred_at": {
                          "type": "string",
                          "format": "date-time"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "202": {
            "description": "Event accepted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "event": {
                          "type": "string"
                        },
                        "resolved_identity_type": {
                          "type": "string",
                          "enum": [
                            "contact_id",
                            "external_id",
                            "email"
                          ]
                        },
                        "resolved_identity_value": {
                          "type": "string"
                        },
                        "occurred_at": {
                          "type": "string",
                          "format": "date-time"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/templates": {
      "get": {
        "summary": "List templates",
        "parameters": [
          {
            "name": "channel",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "email",
                "push"
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Template list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TemplatesListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/templates/{id}": {
      "get": {
        "summary": "Retrieve a template",
        "parameters": [
          {
            "$ref": "#/components/parameters/Id"
          }
        ],
        "responses": {
          "200": {
            "description": "Template details",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TemplateResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/templates/{id}/versions": {
      "get": {
        "summary": "List template versions",
        "parameters": [
          {
            "$ref": "#/components/parameters/Id"
          }
        ],
        "responses": {
          "200": {
            "description": "Version history",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TemplateVersionsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/automations": {
      "get": {
        "summary": "List automations",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Automation list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationsListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      },
      "post": {
        "summary": "Create an automation",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string",
                    "nullable": true
                  },
                  "definition": {
                    "type": "object",
                    "additionalProperties": {
                      "$ref": "#/components/schemas/JsonValue"
                    }
                  },
                  "editor_layout": {
                    "type": "object",
                    "additionalProperties": {
                      "$ref": "#/components/schemas/JsonValue"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Automation created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationSummaryResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/automations/{id}": {
      "get": {
        "summary": "Retrieve an automation",
        "parameters": [
          {
            "$ref": "#/components/parameters/Id"
          }
        ],
        "responses": {
          "200": {
            "description": "Automation details",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationDetailResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "patch": {
        "summary": "Update an automation draft",
        "parameters": [
          {
            "$ref": "#/components/parameters/Id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": {
                  "$ref": "#/components/schemas/JsonValue"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Automation updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationSummaryResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      },
      "delete": {
        "summary": "Archive an automation",
        "parameters": [
          {
            "$ref": "#/components/parameters/Id"
          }
        ],
        "responses": {
          "200": {
            "description": "Automation archived",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationDeleteResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/automations/{id}/publish": {
      "post": {
        "summary": "Publish an automation",
        "parameters": [
          {
            "$ref": "#/components/parameters/Id"
          }
        ],
        "responses": {
          "200": {
            "description": "Automation published",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationSummaryResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/automations/{id}/pause": {
      "post": {
        "summary": "Pause an automation",
        "parameters": [
          {
            "$ref": "#/components/parameters/Id"
          }
        ],
        "responses": {
          "200": {
            "description": "Automation paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/automations/{id}/resume": {
      "post": {
        "summary": "Resume an automation",
        "parameters": [
          {
            "$ref": "#/components/parameters/Id"
          }
        ],
        "responses": {
          "200": {
            "description": "Automation resumed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/automations/{id}/runs": {
      "get": {
        "summary": "List automation runs",
        "parameters": [
          {
            "$ref": "#/components/parameters/Id"
          }
        ],
        "responses": {
          "200": {
            "description": "Run list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationRunsListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/automation-runs/{runId}": {
      "get": {
        "summary": "Retrieve an automation run",
        "parameters": [
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Run details",
            "content": {
              "application/json": {
                "example": {
                  "data": {
                    "id": "run_123",
                    "automation_id": "aut_123",
                    "trigger_event_name": "order.completed",
                    "resolved_identity_type": "email",
                    "resolved_identity_value": "olivia@example.com",
                    "status": "completed",
                    "trigger_event": {
                      "id": "evt_123",
                      "event_name": "order.completed",
                      "payload": {
                        "order_id": "ord_123"
                      },
                      "occurred_at": "2026-06-08T14:15:00.000Z"
                    },
                    "steps": [
                      {
                        "id": "step_1",
                        "step_key": "send_receipt",
                        "step_type": "send_email_template",
                        "status": "completed",
                        "linked_emails": [
                          {
                            "id": "email_123",
                            "subject": "Your receipt",
                            "status": "sent",
                            "last_event": "send",
                            "template_version_id": "tmplver_email_123",
                            "contact_id": "contact_123",
                            "created_at": "2026-06-08T14:15:01.000Z"
                          }
                        ]
                      },
                      {
                        "id": "step_2",
                        "step_key": "wait_for_open",
                        "step_type": "wait_for_event",
                        "status": "completed",
                        "branch_taken": "received",
                        "waits": [
                          {
                            "id": "wait_123",
                            "step_id": "step_2",
                            "step_key": "wait_for_open",
                            "step_type": "wait_for_event",
                            "waiting_for_event_name": "sendrealm.mail.open",
                            "status": "received",
                            "resolved_identity_value": "olivia@example.com",
                            "timeout_at": "2026-06-08T14:45:00.000Z",
                            "resumed_at": "2026-06-08T14:16:30.000Z",
                            "timed_out_at": null,
                            "outcome_branch": "received",
                            "resumed_by_event": {
                              "id": "evt_124",
                              "event_name": "sendrealm.mail.open",
                              "occurred_at": "2026-06-08T14:16:30.000Z"
                            }
                          }
                        ]
                      }
                    ],
                    "waits": [
                      {
                        "id": "wait_123",
                        "step_id": "step_2",
                        "step_key": "wait_for_open",
                        "step_type": "wait_for_event",
                        "waiting_for_event_name": "sendrealm.mail.open",
                        "status": "received",
                        "resolved_identity_value": "olivia@example.com",
                        "timeout_at": "2026-06-08T14:45:00.000Z",
                        "resumed_at": "2026-06-08T14:16:30.000Z",
                        "timed_out_at": null,
                        "outcome_branch": "received"
                      }
                    ],
                    "sent_emails": [
                      {
                        "id": "email_123",
                        "subject": "Your receipt",
                        "status": "sent",
                        "last_event": "send",
                        "automation_step_key": "send_receipt",
                        "template_version_id": "tmplver_email_123",
                        "created_at": "2026-06-08T14:15:01.000Z"
                      }
                    ]
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/AutomationRunDetailResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/topics": {
      "get": {
        "summary": "List topics",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Topic list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TopicsListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      },
      "post": {
        "summary": "Create a topic",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string",
                    "nullable": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Topic created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TopicResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/topics/{id}": {
      "get": {
        "summary": "Retrieve a topic",
        "parameters": [
          {
            "$ref": "#/components/parameters/Id"
          }
        ],
        "responses": {
          "200": {
            "description": "Topic details",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TopicDetailResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "patch": {
        "summary": "Update a topic",
        "parameters": [
          {
            "$ref": "#/components/parameters/Id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": {
                  "$ref": "#/components/schemas/JsonValue"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Topic updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TopicResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      },
      "delete": {
        "summary": "Delete a topic",
        "parameters": [
          {
            "$ref": "#/components/parameters/Id"
          }
        ],
        "responses": {
          "200": {
            "description": "Topic deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TopicDeleteResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/contacts/{contact_id}/topics/{topic_id}": {
      "put": {
        "summary": "Update a contact topic subscription",
        "parameters": [
          {
            "name": "contact_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "topic_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "is_subscribed"
                ],
                "properties": {
                  "is_subscribed": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Subscription updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TopicSubscriptionResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/audiences-properties": {
      "post": {
        "summary": "Create an audience property",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAudienceProperty"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Audience property created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AudiencePropertyResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      },
      "get": {
        "summary": "List audience properties",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/After"
          }
        ],
        "responses": {
          "200": {
            "description": "Audience properties list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AudiencePropertiesListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/audiences-properties/{id}": {
      "get": {
        "summary": "Retrieve an audience property",
        "parameters": [
          {
            "$ref": "#/components/parameters/Id"
          }
        ],
        "responses": {
          "200": {
            "description": "Audience property",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AudiencePropertyResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "patch": {
        "summary": "Update an audience property",
        "parameters": [
          {
            "$ref": "#/components/parameters/Id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateAudienceProperty"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Audience property updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AudiencePropertyResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/contacts": {
      "post": {
        "summary": "Create a contact",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateContact"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Contact created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      },
      "get": {
        "summary": "List contacts",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/After"
          }
        ],
        "responses": {
          "200": {
            "description": "Contacts list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactsListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/contacts/{id}": {
      "get": {
        "summary": "Retrieve a contact",
        "parameters": [
          {
            "$ref": "#/components/parameters/Id"
          }
        ],
        "responses": {
          "200": {
            "description": "Contact",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactWithAudiencesResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "patch": {
        "summary": "Update a contact",
        "parameters": [
          {
            "$ref": "#/components/parameters/Id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateContact"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Contact updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      },
      "delete": {
        "summary": "Delete a contact",
        "parameters": [
          {
            "$ref": "#/components/parameters/Id"
          }
        ],
        "responses": {
          "200": {
            "description": "Contact deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/audiences": {
      "post": {
        "summary": "Create a audience",
        "description": "Create an audience in the API key's project.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAudience"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Audience created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AudienceResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      },
      "get": {
        "summary": "List audiences",
        "description": "List audiences in the API key's project.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/After"
          }
        ],
        "responses": {
          "200": {
            "description": "Audiences list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AudiencesListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/audiences/{id}": {
      "get": {
        "summary": "Retrieve a audience",
        "parameters": [
          {
            "$ref": "#/components/parameters/Id"
          }
        ],
        "responses": {
          "200": {
            "description": "Audience",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AudienceResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "patch": {
        "summary": "Update a audience",
        "parameters": [
          {
            "$ref": "#/components/parameters/Id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateAudience"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Audience updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AudienceResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      },
      "delete": {
        "summary": "Delete a audience",
        "parameters": [
          {
            "$ref": "#/components/parameters/Id"
          }
        ],
        "responses": {
          "200": {
            "description": "Audience deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/contacts/{contact_id}/audiences/{audience_id}": {
      "post": {
        "summary": "Attach a contact to an audience",
        "parameters": [
          {
            "$ref": "#/components/parameters/ContactId"
          },
          {
            "$ref": "#/components/parameters/AudienceId"
          }
        ],
        "responses": {
          "201": {
            "description": "Contact attached to audience",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AudienceMembershipResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      },
      "delete": {
        "summary": "Remove a contact from an audience",
        "parameters": [
          {
            "$ref": "#/components/parameters/ContactId"
          },
          {
            "$ref": "#/components/parameters/AudienceId"
          }
        ],
        "responses": {
          "200": {
            "description": "Contact removed from audience",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteAudienceMembershipResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/contacts/lookup": {
      "post": {
        "summary": "Look up a contact by email",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "email"
                ],
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Contact or null",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactLookupResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/contacts/upsert": {
      "post": {
        "summary": "Create or merge-update a contact by email",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "email"
                ],
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "fields": {
                    "type": "object",
                    "additionalProperties": {
                      "$ref": "#/components/schemas/JsonValue"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Upserted contact",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactUpsertResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/automations/validate": {
      "post": {
        "summary": "Validate an automation definition",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "definition"
                ],
                "properties": {
                  "definition": {
                    "type": "object",
                    "additionalProperties": {
                      "$ref": "#/components/schemas/JsonValue"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Validation result with errors and structured issues",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationValidationResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/automation-runs/{runId}/cancel": {
      "post": {
        "summary": "Cancel a running or waiting automation run",
        "parameters": [
          {
            "$ref": "#/components/parameters/RunId"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "maxLength": 500
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Canceled run",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationRunCancelResponse"
                }
              }
            }
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/automation-runs/{runId}/retry": {
      "post": {
        "summary": "Retry a failed automation run",
        "parameters": [
          {
            "$ref": "#/components/parameters/RunId"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "maxLength": 500
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Retried run",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationRunRetryResponse"
                }
              }
            }
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/automations/{id}/test-runs": {
      "post": {
        "summary": "Start a no-send automation test run",
        "parameters": [
          {
            "$ref": "#/components/parameters/Id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "event"
                ],
                "properties": {
                  "event": {
                    "type": "string"
                  },
                  "contact_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "external_id": {
                    "type": "string"
                  },
                  "payload": {
                    "type": "object",
                    "additionalProperties": {
                      "$ref": "#/components/schemas/JsonValue"
                    }
                  },
                  "correlation": {
                    "$ref": "#/components/schemas/Correlation"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Test run trace",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationRunDetailResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          }
        }
      }
    },
    "/automation-test-runs/{runId}": {
      "get": {
        "summary": "Retrieve an automation test run",
        "parameters": [
          {
            "$ref": "#/components/parameters/RunId"
          }
        ],
        "responses": {
          "200": {
            "description": "Test run trace",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationRunDetailResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/automation-test-runs/{runId}/events": {
      "post": {
        "summary": "Inject a synthetic test event",
        "parameters": [
          {
            "$ref": "#/components/parameters/RunId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "event"
                ],
                "properties": {
                  "event": {
                    "type": "string"
                  },
                  "payload": {
                    "type": "object",
                    "additionalProperties": {
                      "$ref": "#/components/schemas/JsonValue"
                    }
                  },
                  "correlation": {
                    "$ref": "#/components/schemas/Correlation"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated test trace",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationRunDetailResponse"
                }
              }
            }
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/automation-test-runs/{runId}/advance": {
      "post": {
        "summary": "Advance a test run virtual clock",
        "parameters": [
          {
            "$ref": "#/components/parameters/RunId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "seconds"
                ],
                "properties": {
                  "seconds": {
                    "type": "integer",
                    "minimum": 1
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated test trace",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationRunDetailResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "parameters": {
      "SendrealmProjectId": {
        "name": "X-Sendrealm-Project-Id",
        "in": "header",
        "required": false,
        "description": "Select an authorized project for a multi-project or all-project API key. Omit it to use the key's default project.",
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "Id": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "PushResourceId": {
        "name": "id",
        "in": "path",
        "required": true,
        "description": "Public push app ID, device installation ID, or UUID resource ID.",
        "schema": {
          "type": "string"
        }
      },
      "RunId": {
        "name": "runId",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "ContactId": {
        "name": "contact_id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "Limit": {
        "name": "limit",
        "in": "query",
        "description": "Maximum number of records to return. Defaults to 20.",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100,
          "default": 20
        }
      },
      "After": {
        "name": "after",
        "in": "query",
        "description": "Opaque cursor from the previous page's metadata.next value.",
        "schema": {
          "type": "string"
        }
      },
      "AudienceId": {
        "name": "audience_id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "format": "uuid"
        },
        "description": "Audience ID"
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Bad request",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Invalid or missing API key",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "NotFound": {
        "description": "Resource not found",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Conflict": {
        "description": "Resource conflict",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "UnprocessableEntity": {
        "description": "Request could not be processed",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "schemas": {
      "SendEmail": {
        "type": "object",
        "required": [
          "from",
          "to",
          "subject",
          "text"
        ],
        "properties": {
          "from": {
            "type": "string",
            "format": "email",
            "description": "Email address of the sender"
          },
          "to": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "email"
            },
            "description": "List of recipient email addresses"
          },
          "subject": {
            "type": "string",
            "description": "Subject of the email"
          },
          "text": {
            "type": "string",
            "description": "Plain text content of the email"
          },
          "html": {
            "type": "string",
            "description": "HTML content of the email"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "value": {
                  "type": "string"
                }
              }
            },
            "description": "Tags associated with the email"
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Custom headers for the email"
          },
          "attachments": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "name",
                "type",
                "data"
              ],
              "properties": {
                "name": {
                  "type": "string",
                  "description": "Name of the attachment"
                },
                "type": {
                  "type": "string",
                  "description": "MIME type of the attachment"
                },
                "data": {
                  "type": "string",
                  "description": "Base64-encoded content of the attachment"
                }
              }
            },
            "description": "Attachments included in the email"
          }
        }
      },
      "SendEmailResponse": {
        "type": "object",
        "required": [
          "status"
        ],
        "properties": {
          "status": {
            "type": "integer",
            "description": "HTTP response status code"
          }
        }
      },
      "PushActionButton": {
        "type": "object",
        "required": [
          "id"
        ],
        "additionalProperties": false,
        "anyOf": [
          {
            "type": "object",
            "required": [
              "text"
            ]
          },
          {
            "type": "object",
            "required": [
              "title"
            ]
          }
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "text": {
            "type": "string"
          },
          "title": {
            "type": "string",
            "description": "Deprecated alias for text."
          },
          "icon": {
            "type": "string"
          },
          "launch_url": {
            "type": "string",
            "maxLength": 2048
          }
        }
      },
      "PushLiveActivityFields": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string"
          },
          "subtitle": {
            "type": "string"
          },
          "body": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "progress": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "eta": {
            "type": "string"
          },
          "image_url": {
            "type": "string",
            "format": "uri"
          },
          "accent_color": {
            "type": "string"
          },
          "launch_url": {
            "type": "string",
            "maxLength": 2048
          },
          "dismiss_at": {
            "type": "string",
            "format": "date-time"
          },
          "buttons": {
            "type": "array",
            "maxItems": 3,
            "items": {
              "$ref": "#/components/schemas/PushActionButton"
            }
          },
          "data": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/JsonValue"
            }
          }
        }
      },
      "PushLiveActivityStart": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PushLiveActivityFields"
          },
          {
            "type": "object",
            "required": [
              "app_id",
              "activity_id"
            ],
            "properties": {
              "app_id": {
                "type": "string",
                "description": "Push app short ID."
              },
              "activity_id": {
                "type": "string"
              },
              "tokens": {
                "type": "array",
                "minItems": 1,
                "items": {
                  "type": "object",
                  "required": [
                    "token",
                    "platform"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "token": {
                      "type": "string"
                    },
                    "platform": {
                      "type": "string",
                      "enum": [
                        "android",
                        "ios"
                      ]
                    }
                  }
                }
              },
              "device_ids": {
                "type": "array",
                "minItems": 1,
                "items": {
                  "type": "string"
                }
              },
              "contact_ids": {
                "type": "array",
                "minItems": 1,
                "items": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "external_ids": {
                "type": "array",
                "minItems": 1,
                "items": {
                  "type": "string"
                }
              },
              "emails": {
                "type": "array",
                "minItems": 1,
                "items": {
                  "type": "string",
                  "format": "email"
                }
              },
              "audiences": {
                "type": "array",
                "minItems": 1,
                "items": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "excluded_audiences": {
                "type": "array",
                "minItems": 1,
                "items": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "platforms": {
                "type": "array",
                "minItems": 1,
                "uniqueItems": true,
                "items": {
                  "type": "string",
                  "enum": [
                    "android",
                    "ios"
                  ]
                }
              }
            },
            "anyOf": [
              {
                "required": [
                  "tokens"
                ]
              },
              {
                "required": [
                  "device_ids"
                ]
              },
              {
                "required": [
                  "contact_ids"
                ]
              },
              {
                "required": [
                  "external_ids"
                ]
              },
              {
                "required": [
                  "emails"
                ]
              },
              {
                "required": [
                  "audiences"
                ]
              }
            ]
          }
        ]
      },
      "PushLiveActivityNotification": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PushLiveActivityFields"
          },
          {
            "type": "object",
            "required": [
              "app_id",
              "event"
            ],
            "properties": {
              "app_id": {
                "type": "string",
                "description": "Push app short ID."
              },
              "event": {
                "type": "string",
                "enum": [
                  "update",
                  "end"
                ]
              }
            }
          }
        ]
      },
      "PushLiveActivityResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Envelope"
          },
          {
            "type": "object",
            "required": [
              "data"
            ],
            "properties": {
              "data": {
                "type": "object",
                "required": [
                  "id",
                  "activity_id",
                  "event",
                  "total",
                  "sent",
                  "failed"
                ],
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "activity_id": {
                    "type": "string"
                  },
                  "event": {
                    "type": "string"
                  },
                  "total": {
                    "type": "integer"
                  },
                  "sent": {
                    "type": "integer"
                  },
                  "failed": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        ]
      },
      "PushTestNotification": {
        "type": "object",
        "required": [
          "app_id",
          "device_id"
        ],
        "properties": {
          "app_id": {
            "type": "string",
            "description": "Public push app ID or app resource ID."
          },
          "device_id": {
            "type": "string",
            "description": "One device ID returned by the push device list."
          },
          "campaign_id": {
            "type": "string",
            "format": "uuid",
            "description": "Optional saved push campaign draft to test."
          },
          "title": {
            "type": "string",
            "maxLength": 120
          },
          "body": {
            "type": "string",
            "maxLength": 240
          },
          "image_url": {
            "type": "string",
            "format": "uri"
          },
          "launch_url": {
            "type": "string",
            "maxLength": 2048
          },
          "channel_id": {
            "type": "string",
            "maxLength": 80
          }
        }
      },
      "PushCampaignUpdate": {
        "type": "object",
        "minProperties": 1,
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 120
          },
          "environment": {
            "type": "string",
            "enum": [
              "production",
              "development"
            ]
          },
          "messages": {
            "type": "array",
            "minItems": 1,
            "maxItems": 20,
            "items": {
              "type": "object",
              "required": [
                "code",
                "title",
                "body"
              ],
              "properties": {
                "code": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "title": {
                  "type": "string",
                  "maxLength": 120
                },
                "body": {
                  "type": "string",
                  "maxLength": 240
                },
                "image_url": {
                  "type": "string",
                  "format": "uri"
                },
                "launch_url": {
                  "type": "string",
                  "maxLength": 2048
                }
              }
            }
          },
          "audience": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "subscribed",
                  "audiences"
                ]
              },
              "include_audience_ids": {
                "type": "array",
                "items": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "exclude_audience_ids": {
                "type": "array",
                "items": {
                  "type": "string",
                  "format": "uuid"
                }
              }
            }
          },
          "platforms": {
            "type": "object",
            "properties": {
              "android": {
                "type": "boolean"
              },
              "ios": {
                "type": "boolean"
              },
              "web": {
                "type": "boolean"
              }
            }
          },
          "mode": {
            "type": "string",
            "enum": [
              "standard",
              "live_activity"
            ]
          },
          "buttons": {
            "type": "array",
            "maxItems": 3,
            "items": {
              "$ref": "#/components/schemas/PushActionButton"
            }
          },
          "template_version_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "android_config": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/JsonValue"
            }
          },
          "live_activity_config": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/JsonValue"
            },
            "nullable": true
          }
        }
      },
      "PushNotification": {
        "type": "object",
        "required": [
          "app_id",
          "notification"
        ],
        "additionalProperties": false,
        "properties": {
          "app_id": {
            "type": "string",
            "description": "Push app short ID."
          },
          "environment": {
            "type": "string",
            "enum": [
              "production",
              "development"
            ],
            "default": "production",
            "description": "Sendrealm push environment. Development sends only target devices registered in development mode."
          },
          "tokens": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "object",
              "required": [
                "token",
                "platform"
              ],
              "additionalProperties": false,
              "properties": {
                "token": {
                  "type": "string"
                },
                "platform": {
                  "type": "string",
                  "enum": [
                    "android",
                    "ios"
                  ]
                }
              }
            }
          },
          "web_subscriptions": {
            "type": "array",
            "minItems": 1,
            "description": "Direct browser Web Push subscriptions from PushSubscription.toJSON(). Use device, contact, external ID, email, audience, or platforms targeting for SDK-registered web devices.",
            "items": {
              "type": "object",
              "required": [
                "endpoint",
                "keys"
              ],
              "additionalProperties": false,
              "properties": {
                "endpoint": {
                  "type": "string",
                  "format": "uri"
                },
                "expirationTime": {
                  "type": "integer",
                  "nullable": true,
                  "description": "Browser subscription expiration time in milliseconds since epoch, when provided."
                },
                "keys": {
                  "type": "object",
                  "required": [
                    "p256dh",
                    "auth"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "p256dh": {
                      "type": "string"
                    },
                    "auth": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "device_ids": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string"
            }
          },
          "contact_ids": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "external_ids": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string"
            }
          },
          "emails": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "format": "email"
            }
          },
          "audiences": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "excluded_audiences": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "platforms": {
            "type": "array",
            "minItems": 1,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "enum": [
                "web",
                "android",
                "ios"
              ]
            }
          },
          "scheduled_at": {
            "type": "string",
            "format": "date-time",
            "description": "Queue an audience send for a future time."
          },
          "template_version_id": {
            "type": "string",
            "format": "uuid"
          },
          "messages": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "object",
              "required": [
                "code",
                "title",
                "body"
              ],
              "additionalProperties": false,
              "properties": {
                "code": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "title": {
                  "type": "string"
                },
                "body": {
                  "type": "string"
                },
                "image_url": {
                  "type": "string",
                  "format": "uri"
                },
                "launch_url": {
                  "type": "string",
                  "maxLength": 2048
                }
              }
            }
          },
          "notification": {
            "type": "object",
            "required": [
              "title",
              "body"
            ],
            "properties": {
              "title": {
                "type": "string"
              },
              "body": {
                "type": "string"
              },
              "image_url": {
                "type": "string",
                "format": "uri"
              },
              "launch_url": {
                "type": "string",
                "maxLength": 2048
              }
            }
          },
          "buttons": {
            "type": "array",
            "maxItems": 3,
            "items": {
              "$ref": "#/components/schemas/PushActionButton"
            }
          },
          "data": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/JsonValue"
            }
          },
          "android": {
            "type": "object",
            "properties": {
              "channel_id": {
                "type": "string"
              },
              "small_icon": {
                "type": "string"
              },
              "large_icon": {
                "type": "string"
              },
              "big_picture": {
                "type": "string",
                "format": "uri"
              },
              "category": {
                "type": "string"
              },
              "sound": {
                "type": "string"
              },
              "lockscreen_visibility": {
                "type": "string"
              },
              "led_color": {
                "type": "string"
              },
              "accent_color": {
                "type": "string"
              },
              "ttl": {
                "type": "string"
              }
            }
          },
          "ios": {
            "type": "object",
            "properties": {
              "sound": {
                "type": "string"
              },
              "badge": {
                "type": "integer",
                "minimum": 0
              },
              "category": {
                "type": "string"
              },
              "thread_id": {
                "type": "string"
              },
              "mutable_content": {
                "type": "boolean"
              },
              "apns_environment": {
                "type": "string",
                "enum": [
                  "sandbox",
                  "production"
                ],
                "description": "APNs environment override for direct token sends. Device-targeted sends default to the registered device/provider environment."
              }
            }
          }
        },
        "anyOf": [
          {
            "required": [
              "tokens"
            ]
          },
          {
            "required": [
              "web_subscriptions"
            ]
          },
          {
            "required": [
              "device_ids"
            ]
          },
          {
            "required": [
              "contact_ids"
            ]
          },
          {
            "required": [
              "external_ids"
            ]
          },
          {
            "required": [
              "emails"
            ]
          },
          {
            "required": [
              "audiences"
            ]
          }
        ]
      },
      "PushNotificationResult": {
        "type": "object",
        "required": [
          "id",
          "status",
          "platform",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "sent",
              "failed"
            ]
          },
          "platform": {
            "type": "string",
            "enum": [
              "web",
              "android",
              "ios"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "device_id": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "PushNotificationResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Envelope"
          },
          {
            "type": "object",
            "required": [
              "data"
            ],
            "properties": {
              "data": {
                "type": "object",
                "required": [
                  "total",
                  "sent",
                  "failed",
                  "notifications"
                ],
                "properties": {
                  "total": {
                    "type": "integer"
                  },
                  "sent": {
                    "type": "integer"
                  },
                  "failed": {
                    "type": "integer"
                  },
                  "notifications": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/PushNotificationResult"
                    }
                  }
                }
              }
            }
          }
        ]
      },
      "CreateAudience": {
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 50
          }
        }
      },
      "UpdateAudience": {
        "$ref": "#/components/schemas/CreateAudience"
      },
      "Audience": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CreateAudienceProperty": {
        "type": "object",
        "required": [
          "type"
        ],
        "properties": {
          "key": {
            "type": "string",
            "maxLength": 100,
            "description": "Property key. Either key or name is accepted."
          },
          "name": {
            "type": "string",
            "maxLength": 100,
            "description": "Alias for key."
          },
          "type": {
            "type": "string",
            "enum": [
              "string",
              "number"
            ]
          },
          "sdk_writable": {
            "type": "boolean",
            "description": "Allow SDK tag writes for this property. Defaults to false."
          }
        }
      },
      "UpdateAudienceProperty": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "maxLength": 100
          },
          "name": {
            "type": "string",
            "maxLength": 100,
            "description": "Alias for key."
          },
          "type": {
            "type": "string",
            "enum": [
              "string",
              "number"
            ]
          }
        }
      },
      "AudienceProperty": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "key": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "string",
              "number"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "source": {
            "type": "string",
            "enum": [
              "api",
              "sdk",
              "import",
              "system",
              "automation"
            ]
          },
          "sdk_writable": {
            "type": "boolean"
          }
        }
      },
      "CreateContact": {
        "type": "object",
        "required": [
          "email"
        ],
        "properties": {
          "email": {
            "type": "string",
            "format": "email"
          },
          "fields": {
            "$ref": "#/components/schemas/ContactFields"
          }
        }
      },
      "UpdateContact": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "format": "email"
          },
          "fields": {
            "$ref": "#/components/schemas/ContactFields"
          }
        }
      },
      "ContactFields": {
        "type": "object",
        "additionalProperties": {
          "$ref": "#/components/schemas/JsonPrimitive"
        }
      },
      "Contact": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "fields": {
            "$ref": "#/components/schemas/ContactFields"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ContactAudience": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "is_subscribed": {
            "type": "boolean"
          },
          "attached_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AudienceMembership": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "contact_id": {
            "type": "string",
            "format": "uuid"
          },
          "audience_id": {
            "type": "string",
            "format": "uuid"
          },
          "is_subscribed": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PaginationMetadata": {
        "type": "object",
        "required": [
          "total",
          "items",
          "limit",
          "after",
          "next",
          "has_more"
        ],
        "properties": {
          "total": {
            "type": "integer"
          },
          "items": {
            "type": "integer"
          },
          "limit": {
            "type": "integer"
          },
          "after": {
            "type": "string",
            "nullable": true
          },
          "next": {
            "type": "string",
            "nullable": true
          },
          "has_more": {
            "type": "boolean"
          }
        }
      },
      "AudienceResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Envelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "$ref": "#/components/schemas/Audience"
              }
            }
          }
        ]
      },
      "AudiencesListResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Envelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Audience"
                }
              },
              "metadata": {
                "$ref": "#/components/schemas/PaginationMetadata"
              }
            }
          }
        ]
      },
      "AudiencePropertyResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Envelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "$ref": "#/components/schemas/AudienceProperty"
              }
            }
          }
        ]
      },
      "AudiencePropertiesListResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Envelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AudienceProperty"
                }
              },
              "metadata": {
                "$ref": "#/components/schemas/PaginationMetadata"
              }
            }
          }
        ]
      },
      "ContactResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Envelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "$ref": "#/components/schemas/Contact"
              }
            }
          }
        ]
      },
      "ContactWithAudiencesResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Envelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Contact"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "audiences": {
                        "type": "array",
                        "items": {
                          "$ref": "#/components/schemas/ContactAudience"
                        }
                      }
                    }
                  }
                ]
              }
            }
          }
        ]
      },
      "ContactsListResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Envelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Contact"
                }
              },
              "metadata": {
                "$ref": "#/components/schemas/PaginationMetadata"
              }
            }
          }
        ]
      },
      "AudienceMembershipResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Envelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "$ref": "#/components/schemas/AudienceMembership"
              }
            }
          }
        ]
      },
      "DeleteResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Envelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "deleted": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        ]
      },
      "DeleteAudienceMembershipResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Envelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "object",
                "properties": {
                  "contact_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "audience_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "deleted": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        ]
      },
      "Envelope": {
        "type": "object",
        "required": [
          "status"
        ],
        "properties": {
          "status": {
            "type": "integer",
            "description": "HTTP response status code"
          }
        }
      },
      "Correlation": {
        "type": "object",
        "required": [
          "key",
          "value"
        ],
        "properties": {
          "key": {
            "type": "string",
            "maxLength": 100
          },
          "value": {
            "type": "string",
            "maxLength": 255
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "status",
          "error"
        ],
        "properties": {
          "status": {
            "type": "integer"
          },
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "details": {
                "$ref": "#/components/schemas/JsonValue"
              },
              "issues": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ValidationIssue"
                }
              }
            }
          }
        }
      },
      "JsonValue": {
        "oneOf": [
          {
            "type": "string",
            "nullable": true
          },
          {
            "type": "number"
          },
          {
            "type": "boolean"
          },
          {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/JsonValue"
            }
          },
          {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JsonValue"
            }
          }
        ]
      },
      "JsonObject": {
        "type": "object",
        "additionalProperties": {
          "$ref": "#/components/schemas/JsonValue"
        }
      },
      "JsonArray": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/JsonValue"
        }
      },
      "JsonPrimitive": {
        "oneOf": [
          {
            "type": "string",
            "nullable": true
          },
          {
            "type": "number"
          },
          {
            "type": "boolean"
          }
        ]
      },
      "ValidationIssue": {
        "type": "object",
        "required": [
          "code",
          "path",
          "message"
        ],
        "properties": {
          "code": {
            "type": "string"
          },
          "path": {
            "type": "string",
            "nullable": true
          },
          "message": {
            "type": "string"
          }
        }
      },
      "CursorMetadata": {
        "type": "object",
        "required": [
          "items",
          "has_more",
          "next"
        ],
        "properties": {
          "items": {
            "type": "integer"
          },
          "has_more": {
            "type": "boolean"
          },
          "next": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "CampaignListItem": {
        "type": "object",
        "required": [
          "id",
          "name",
          "status",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Campaign": {
        "type": "object",
        "required": [
          "id",
          "name",
          "status",
          "channel",
          "targeting",
          "from",
          "reply_to_address",
          "subject",
          "domain_id",
          "template_version_id",
          "audience_ids",
          "audiences",
          "tracking",
          "include_unsubscribe_link",
          "unsubscribe_link_type",
          "content",
          "readiness",
          "is_editable",
          "analytics",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "channel": {
            "type": "string",
            "enum": [
              "email"
            ]
          },
          "targeting": {
            "$ref": "#/components/schemas/JsonObject"
          },
          "from": {
            "type": "object",
            "required": [
              "name",
              "address"
            ],
            "properties": {
              "name": {
                "type": "string"
              },
              "address": {
                "type": "string",
                "format": "email"
              }
            },
            "nullable": true
          },
          "reply_to_address": {
            "type": "string",
            "format": "email",
            "nullable": true
          },
          "subject": {
            "type": "string",
            "nullable": true
          },
          "domain_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "template_version_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "audience_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "audiences": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "name",
                "subscribed_contacts"
              ],
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "name": {
                  "type": "string"
                },
                "subscribed_contacts": {
                  "type": "integer"
                }
              }
            }
          },
          "tracking": {
            "type": "object",
            "required": [
              "click_tracking",
              "open_tracking"
            ],
            "properties": {
              "click_tracking": {
                "type": "boolean"
              },
              "open_tracking": {
                "type": "boolean"
              }
            }
          },
          "include_unsubscribe_link": {
            "type": "boolean"
          },
          "unsubscribe_link_type": {
            "type": "string",
            "nullable": true
          },
          "content": {
            "type": "object",
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/JsonValue"
              }
            ]
          },
          "readiness": {
            "type": "object",
            "required": [
              "ready",
              "reasons"
            ],
            "properties": {
              "ready": {
                "type": "boolean"
              },
              "reasons": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "is_editable": {
            "type": "boolean"
          },
          "analytics": {
            "type": "object",
            "required": [
              "recipients",
              "delivered",
              "opened",
              "clicked",
              "bounced",
              "complained",
              "unsubscribed"
            ],
            "properties": {
              "recipients": {
                "type": "integer"
              },
              "delivered": {
                "type": "integer"
              },
              "opened": {
                "type": "integer"
              },
              "clicked": {
                "type": "integer"
              },
              "bounced": {
                "type": "integer"
              },
              "complained": {
                "type": "integer"
              },
              "unsubscribed": {
                "type": "integer"
              }
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CampaignsListResponse": {
        "type": "object",
        "required": [
          "status",
          "data",
          "metadata"
        ],
        "properties": {
          "status": {
            "type": "integer",
            "description": "HTTP response status code"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CampaignListItem"
            }
          },
          "metadata": {
            "$ref": "#/components/schemas/PaginationMetadata"
          }
        }
      },
      "CampaignResponse": {
        "type": "object",
        "required": [
          "status",
          "data"
        ],
        "properties": {
          "status": {
            "type": "integer",
            "description": "HTTP response status code"
          },
          "data": {
            "$ref": "#/components/schemas/Campaign"
          }
        }
      },
      "PushProviderReadiness": {
        "type": "object",
        "required": [
          "ready",
          "missing"
        ],
        "properties": {
          "ready": {
            "type": "boolean"
          },
          "missing": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "PushProvider": {
        "type": "object",
        "required": [
          "id",
          "name",
          "platform",
          "status",
          "android_package_name",
          "apns_bundle_id",
          "apns_environment",
          "web_vapid_public_key",
          "web_vapid_subject",
          "readiness",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "platform": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "android_package_name": {
            "type": "string",
            "nullable": true
          },
          "apns_bundle_id": {
            "type": "string",
            "nullable": true
          },
          "apns_environment": {
            "type": "string",
            "nullable": true
          },
          "web_vapid_public_key": {
            "type": "string",
            "nullable": true
          },
          "web_vapid_subject": {
            "type": "string",
            "nullable": true
          },
          "readiness": {
            "$ref": "#/components/schemas/PushProviderReadiness"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PushApp": {
        "type": "object",
        "required": [
          "id",
          "public_id",
          "name",
          "providers",
          "readiness",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "public_id": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string"
          },
          "providers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PushProvider"
            }
          },
          "readiness": {
            "type": "object",
            "required": [
              "ready",
              "ready_platforms"
            ],
            "properties": {
              "ready": {
                "type": "boolean"
              },
              "ready_platforms": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PushNotificationChannel": {
        "type": "object",
        "required": [
          "id",
          "platform",
          "channel_id",
          "name",
          "description",
          "importance",
          "sound",
          "vibration",
          "led_color",
          "lockscreen_visibility",
          "is_default",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "platform": {
            "type": "string"
          },
          "channel_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "importance": {
            "type": "string"
          },
          "sound": {
            "type": "string",
            "nullable": true
          },
          "vibration": {
            "type": "boolean"
          },
          "led_color": {
            "type": "string",
            "nullable": true
          },
          "lockscreen_visibility": {
            "type": "string"
          },
          "is_default": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PushAppsListResponse": {
        "type": "object",
        "required": [
          "status",
          "data"
        ],
        "properties": {
          "status": {
            "type": "integer",
            "description": "HTTP response status code"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PushApp"
            }
          }
        }
      },
      "PushAppResponse": {
        "type": "object",
        "required": [
          "status",
          "data"
        ],
        "properties": {
          "status": {
            "type": "integer",
            "description": "HTTP response status code"
          },
          "data": {
            "$ref": "#/components/schemas/PushApp"
          }
        }
      },
      "PushProvidersResponse": {
        "type": "object",
        "required": [
          "status",
          "data"
        ],
        "properties": {
          "status": {
            "type": "integer",
            "description": "HTTP response status code"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PushProvider"
            }
          }
        }
      },
      "PushNotificationChannelsResponse": {
        "type": "object",
        "required": [
          "status",
          "data"
        ],
        "properties": {
          "status": {
            "type": "integer",
            "description": "HTTP response status code"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PushNotificationChannel"
            }
          }
        }
      },
      "PushDeviceProviderError": {
        "type": "object",
        "required": [
          "code",
          "message",
          "occurred_at"
        ],
        "properties": {
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string",
            "nullable": true
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        }
      },
      "PushDevice": {
        "type": "object",
        "required": [
          "id",
          "device_id",
          "app_id",
          "app_name",
          "platform",
          "environment",
          "external_id",
          "app_version",
          "sdk_version",
          "os_version",
          "device_model",
          "locale",
          "region",
          "permission_status",
          "subscribed",
          "registration_token_present",
          "apns_environment",
          "last_registration_at",
          "last_active_at",
          "last_provider_error",
          "contact",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "device_id": {
            "type": "string"
          },
          "app_id": {
            "type": "string",
            "nullable": true
          },
          "app_name": {
            "type": "string",
            "nullable": true
          },
          "platform": {
            "type": "string"
          },
          "environment": {
            "type": "string"
          },
          "external_id": {
            "type": "string",
            "nullable": true
          },
          "app_version": {
            "type": "string",
            "nullable": true
          },
          "sdk_version": {
            "type": "string",
            "nullable": true
          },
          "os_version": {
            "type": "string",
            "nullable": true
          },
          "device_model": {
            "type": "string",
            "nullable": true
          },
          "locale": {
            "type": "string",
            "nullable": true
          },
          "region": {
            "type": "string",
            "nullable": true
          },
          "permission_status": {
            "type": "string",
            "nullable": true
          },
          "subscribed": {
            "type": "boolean"
          },
          "registration_token_present": {
            "type": "boolean"
          },
          "apns_environment": {
            "type": "string",
            "nullable": true
          },
          "last_registration_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "last_active_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "last_provider_error": {
            "type": "object",
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/PushDeviceProviderError"
              }
            ]
          },
          "contact": {
            "type": "object",
            "required": [
              "id",
              "email"
            ],
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "email": {
                "type": "string",
                "format": "email",
                "nullable": true
              }
            },
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PushDeviceEvent": {
        "type": "object",
        "required": [
          "id",
          "type",
          "properties",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string"
          },
          "properties": {
            "type": "object",
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/JsonObject"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PushDeviceDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PushDevice"
          },
          {
            "type": "object",
            "required": [
              "events"
            ],
            "properties": {
              "events": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/PushDeviceEvent"
                }
              }
            }
          }
        ]
      },
      "PushDevicesListResponse": {
        "type": "object",
        "required": [
          "status",
          "data",
          "metadata"
        ],
        "properties": {
          "status": {
            "type": "integer",
            "description": "HTTP response status code"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PushDevice"
            }
          },
          "metadata": {
            "$ref": "#/components/schemas/PaginationMetadata"
          }
        }
      },
      "PushDeviceResponse": {
        "type": "object",
        "required": [
          "status",
          "data"
        ],
        "properties": {
          "status": {
            "type": "integer",
            "description": "HTTP response status code"
          },
          "data": {
            "$ref": "#/components/schemas/PushDeviceDetail"
          }
        }
      },
      "PushDeliveryEvent": {
        "type": "object",
        "required": [
          "id",
          "type",
          "device_id",
          "provider",
          "external_user_id",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string"
          },
          "device_id": {
            "type": "string",
            "nullable": true
          },
          "provider": {
            "type": "string",
            "nullable": true
          },
          "external_user_id": {
            "type": "string",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PushNotificationDelivery": {
        "type": "object",
        "required": [
          "id",
          "app_id",
          "broadcast_id",
          "source",
          "title",
          "body",
          "platform",
          "environment",
          "status",
          "last_event",
          "provider_message_id",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "nullable": true
          },
          "broadcast_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "source": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "body": {
            "type": "string"
          },
          "platform": {
            "type": "string"
          },
          "environment": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "last_event": {
            "type": "string"
          },
          "provider_message_id": {
            "type": "string",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PushNotificationDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PushNotificationDelivery"
          },
          {
            "type": "object",
            "required": [
              "data",
              "image_url",
              "events"
            ],
            "properties": {
              "data": {
                "type": "object",
                "nullable": true,
                "allOf": [
                  {
                    "$ref": "#/components/schemas/JsonObject"
                  }
                ]
              },
              "image_url": {
                "type": "string",
                "format": "uri",
                "nullable": true
              },
              "events": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/PushDeliveryEvent"
                }
              }
            }
          }
        ]
      },
      "PushNotificationsListResponse": {
        "type": "object",
        "required": [
          "status",
          "data",
          "metadata"
        ],
        "properties": {
          "status": {
            "type": "integer",
            "description": "HTTP response status code"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PushNotificationDelivery"
            }
          },
          "metadata": {
            "$ref": "#/components/schemas/PaginationMetadata"
          }
        }
      },
      "PushNotificationDetailResponse": {
        "type": "object",
        "required": [
          "status",
          "data"
        ],
        "properties": {
          "status": {
            "type": "integer",
            "description": "HTTP response status code"
          },
          "data": {
            "$ref": "#/components/schemas/PushNotificationDetail"
          }
        }
      },
      "PushCampaignMessage": {
        "type": "object",
        "required": [
          "code",
          "label",
          "title",
          "body",
          "image_url",
          "launch_url"
        ],
        "properties": {
          "code": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "body": {
            "type": "string"
          },
          "image_url": {
            "type": "string",
            "format": "uri",
            "nullable": true
          },
          "launch_url": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "PushCampaign": {
        "type": "object",
        "required": [
          "id",
          "app_id",
          "app_name",
          "name",
          "status",
          "channel",
          "targeting",
          "mode",
          "environment",
          "messages",
          "buttons",
          "platforms",
          "audience",
          "template_version_id",
          "android_config",
          "live_activity_config",
          "is_editable",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "app_id": {
            "type": "string",
            "nullable": true
          },
          "app_name": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "channel": {
            "type": "string",
            "enum": [
              "push"
            ]
          },
          "targeting": {
            "$ref": "#/components/schemas/JsonObject"
          },
          "mode": {
            "type": "string"
          },
          "environment": {
            "type": "string"
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PushCampaignMessage"
            }
          },
          "buttons": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PushActionButton"
            }
          },
          "platforms": {
            "type": "object",
            "required": [
              "android",
              "ios",
              "web"
            ],
            "properties": {
              "android": {
                "type": "boolean"
              },
              "ios": {
                "type": "boolean"
              },
              "web": {
                "type": "boolean"
              }
            }
          },
          "audience": {
            "type": "object",
            "required": [
              "type",
              "include_audience_ids",
              "exclude_audience_ids"
            ],
            "properties": {
              "type": {
                "type": "string"
              },
              "include_audience_ids": {
                "type": "array",
                "items": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "exclude_audience_ids": {
                "type": "array",
                "items": {
                  "type": "string",
                  "format": "uuid"
                }
              }
            }
          },
          "template_version_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "android_config": {
            "$ref": "#/components/schemas/JsonObject"
          },
          "live_activity_config": {
            "type": "object",
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/JsonObject"
              }
            ]
          },
          "is_editable": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PushCampaignDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PushCampaign"
          },
          {
            "type": "object",
            "required": [
              "analytics"
            ],
            "properties": {
              "analytics": {
                "type": "object",
                "required": [
                  "targeted",
                  "sent",
                  "failed"
                ],
                "properties": {
                  "targeted": {
                    "type": "integer"
                  },
                  "sent": {
                    "type": "integer"
                  },
                  "failed": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        ]
      },
      "PushCampaignsListResponse": {
        "type": "object",
        "required": [
          "status",
          "data",
          "metadata"
        ],
        "properties": {
          "status": {
            "type": "integer",
            "description": "HTTP response status code"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PushCampaign"
            }
          },
          "metadata": {
            "$ref": "#/components/schemas/PaginationMetadata"
          }
        }
      },
      "PushCampaignResponse": {
        "type": "object",
        "required": [
          "status",
          "data"
        ],
        "properties": {
          "status": {
            "type": "integer",
            "description": "HTTP response status code"
          },
          "data": {
            "$ref": "#/components/schemas/PushCampaign"
          }
        }
      },
      "PushCampaignDetailResponse": {
        "type": "object",
        "required": [
          "status",
          "data"
        ],
        "properties": {
          "status": {
            "type": "integer",
            "description": "HTTP response status code"
          },
          "data": {
            "$ref": "#/components/schemas/PushCampaignDetail"
          }
        }
      },
      "PushCampaignPreviewResponse": {
        "type": "object",
        "required": [
          "status",
          "data"
        ],
        "properties": {
          "status": {
            "type": "integer",
            "description": "HTTP response status code"
          },
          "data": {
            "type": "object",
            "required": [
              "reachable_devices",
              "by_platform",
              "note"
            ],
            "properties": {
              "reachable_devices": {
                "type": "integer"
              },
              "by_platform": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "platform",
                    "devices"
                  ],
                  "properties": {
                    "platform": {
                      "type": "string"
                    },
                    "devices": {
                      "type": "integer"
                    }
                  }
                }
              },
              "note": {
                "type": "string",
                "nullable": true
              }
            }
          }
        }
      },
      "PushTestQueuedResponse": {
        "type": "object",
        "required": [
          "status",
          "data"
        ],
        "properties": {
          "status": {
            "type": "integer",
            "description": "HTTP response status code"
          },
          "data": {
            "type": "object",
            "required": [
              "id",
              "device_id",
              "queued"
            ],
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "device_id": {
                "type": "string"
              },
              "queued": {
                "type": "boolean"
              }
            }
          }
        }
      },
      "PushTestNotificationTrace": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PushNotificationDelivery"
          },
          {
            "type": "object",
            "required": [
              "events"
            ],
            "properties": {
              "events": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/PushDeliveryEvent"
                }
              }
            }
          }
        ]
      },
      "PushTest": {
        "type": "object",
        "required": [
          "id",
          "status",
          "source_campaign_id",
          "notifications",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string"
          },
          "source_campaign_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "notifications": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PushTestNotificationTrace"
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PushTestResponse": {
        "type": "object",
        "required": [
          "status",
          "data"
        ],
        "properties": {
          "status": {
            "type": "integer",
            "description": "HTTP response status code"
          },
          "data": {
            "$ref": "#/components/schemas/PushTest"
          }
        }
      },
      "TemplateVersion": {
        "type": "object",
        "required": [
          "id",
          "version_number",
          "channel",
          "state",
          "label",
          "subject_template",
          "preview_text",
          "editor_json",
          "rendered_html",
          "rendered_text",
          "default_locale",
          "messages",
          "published_at",
          "restored_from_version_id",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "version_number": {
            "type": "integer"
          },
          "channel": {
            "type": "string"
          },
          "state": {
            "type": "string"
          },
          "label": {
            "type": "string",
            "nullable": true
          },
          "subject_template": {
            "type": "string",
            "nullable": true
          },
          "preview_text": {
            "type": "string",
            "nullable": true
          },
          "editor_json": {
            "type": "object",
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/JsonObject"
              }
            ]
          },
          "rendered_html": {
            "type": "string",
            "nullable": true
          },
          "rendered_text": {
            "type": "string",
            "nullable": true
          },
          "default_locale": {
            "type": "string",
            "nullable": true
          },
          "messages": {
            "$ref": "#/components/schemas/JsonArray"
          },
          "published_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "restored_from_version_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Template": {
        "type": "object",
        "required": [
          "id",
          "name",
          "description",
          "channel",
          "status",
          "current_draft_version_id",
          "current_published_version_id",
          "created_at",
          "updated_at",
          "deleted_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "channel": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "current_draft_version_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "current_published_version_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "deleted_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        }
      },
      "TemplateSummary": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Template"
          },
          {
            "type": "object",
            "required": [
              "current_draft_version",
              "current_published_version"
            ],
            "properties": {
              "current_draft_version": {
                "type": "object",
                "nullable": true,
                "allOf": [
                  {
                    "$ref": "#/components/schemas/TemplateVersion"
                  }
                ]
              },
              "current_published_version": {
                "type": "object",
                "nullable": true,
                "allOf": [
                  {
                    "$ref": "#/components/schemas/TemplateVersion"
                  }
                ]
              }
            }
          }
        ]
      },
      "TemplateDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/TemplateSummary"
          },
          {
            "type": "object",
            "required": [
              "versions"
            ],
            "properties": {
              "versions": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TemplateVersion"
                }
              }
            }
          }
        ]
      },
      "TemplatesListResponse": {
        "type": "object",
        "required": [
          "status",
          "data"
        ],
        "properties": {
          "status": {
            "type": "integer",
            "description": "HTTP response status code"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TemplateSummary"
            }
          }
        }
      },
      "TemplateResponse": {
        "type": "object",
        "required": [
          "status",
          "data"
        ],
        "properties": {
          "status": {
            "type": "integer",
            "description": "HTTP response status code"
          },
          "data": {
            "$ref": "#/components/schemas/TemplateDetail"
          }
        }
      },
      "TemplateVersionsResponse": {
        "type": "object",
        "required": [
          "status",
          "data"
        ],
        "properties": {
          "status": {
            "type": "integer",
            "description": "HTTP response status code"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TemplateVersion"
            }
          }
        }
      },
      "AutomationVersion": {
        "type": "object",
        "required": [
          "id",
          "version_number",
          "state",
          "definition",
          "editor_layout",
          "published_at",
          "restored_from_version_id",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "version_number": {
            "type": "integer"
          },
          "state": {
            "type": "string"
          },
          "definition": {
            "$ref": "#/components/schemas/JsonObject"
          },
          "editor_layout": {
            "$ref": "#/components/schemas/JsonObject"
          },
          "published_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "restored_from_version_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Automation": {
        "type": "object",
        "required": [
          "id",
          "name",
          "description",
          "status",
          "current_draft_version_id",
          "current_published_version_id",
          "created_at",
          "updated_at",
          "deleted_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string"
          },
          "current_draft_version_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "current_published_version_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "deleted_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        }
      },
      "AutomationSummary": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Automation"
          },
          {
            "type": "object",
            "required": [
              "current_draft_version",
              "current_published_version"
            ],
            "properties": {
              "current_draft_version": {
                "type": "object",
                "nullable": true,
                "allOf": [
                  {
                    "$ref": "#/components/schemas/AutomationVersion"
                  }
                ]
              },
              "current_published_version": {
                "type": "object",
                "nullable": true,
                "allOf": [
                  {
                    "$ref": "#/components/schemas/AutomationVersion"
                  }
                ]
              }
            }
          }
        ]
      },
      "AutomationDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/AutomationSummary"
          },
          {
            "type": "object",
            "required": [
              "versions",
              "run_counts"
            ],
            "properties": {
              "versions": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AutomationVersion"
                }
              },
              "run_counts": {
                "type": "object",
                "additionalProperties": {
                  "type": "integer"
                }
              }
            }
          }
        ]
      },
      "AutomationsListResponse": {
        "type": "object",
        "required": [
          "status",
          "data"
        ],
        "properties": {
          "status": {
            "type": "integer",
            "description": "HTTP response status code"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AutomationSummary"
            }
          }
        }
      },
      "AutomationSummaryResponse": {
        "type": "object",
        "required": [
          "status",
          "data"
        ],
        "properties": {
          "status": {
            "type": "integer",
            "description": "HTTP response status code"
          },
          "data": {
            "$ref": "#/components/schemas/AutomationSummary"
          }
        }
      },
      "AutomationResponse": {
        "type": "object",
        "required": [
          "status",
          "data"
        ],
        "properties": {
          "status": {
            "type": "integer",
            "description": "HTTP response status code"
          },
          "data": {
            "$ref": "#/components/schemas/Automation"
          }
        }
      },
      "AutomationDetailResponse": {
        "type": "object",
        "required": [
          "status",
          "data"
        ],
        "properties": {
          "status": {
            "type": "integer",
            "description": "HTTP response status code"
          },
          "data": {
            "$ref": "#/components/schemas/AutomationDetail"
          }
        }
      },
      "AutomationDeleteResponse": {
        "type": "object",
        "required": [
          "status",
          "data"
        ],
        "properties": {
          "status": {
            "type": "integer",
            "description": "HTTP response status code"
          },
          "data": {
            "type": "object",
            "required": [
              "id",
              "deleted",
              "deleted_at"
            ],
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "deleted": {
                "type": "boolean"
              },
              "deleted_at": {
                "type": "string",
                "format": "date-time"
              }
            }
          }
        }
      },
      "AutomationValidationResponse": {
        "type": "object",
        "required": [
          "status",
          "data"
        ],
        "properties": {
          "status": {
            "type": "integer",
            "description": "HTTP response status code"
          },
          "data": {
            "type": "object",
            "required": [
              "valid",
              "errors",
              "issues"
            ],
            "properties": {
              "valid": {
                "type": "boolean"
              },
              "errors": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "issues": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ValidationIssue"
                }
              }
            }
          }
        }
      },
      "AutomationRun": {
        "type": "object",
        "required": [
          "id",
          "automation_id",
          "automation_version_id",
          "contact_id",
          "trigger_event_name",
          "resolved_identity_type",
          "resolved_identity_value",
          "correlation",
          "execution_mode",
          "status",
          "last_error",
          "started_at",
          "completed_at",
          "virtual_now",
          "terminal_reason",
          "completed_step_key",
          "cancellation_requested_at",
          "cancellation_reason",
          "canceled_at",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "automation_id": {
            "type": "string",
            "format": "uuid"
          },
          "automation_version_id": {
            "type": "string",
            "format": "uuid"
          },
          "contact_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "trigger_event_name": {
            "type": "string"
          },
          "resolved_identity_type": {
            "type": "string"
          },
          "resolved_identity_value": {
            "type": "string"
          },
          "correlation": {
            "type": "object",
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/Correlation"
              }
            ]
          },
          "execution_mode": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "last_error": {
            "type": "string",
            "nullable": true
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "virtual_now": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "terminal_reason": {
            "type": "string",
            "nullable": true
          },
          "completed_step_key": {
            "type": "string",
            "nullable": true
          },
          "cancellation_requested_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "cancellation_reason": {
            "type": "string",
            "nullable": true
          },
          "canceled_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AutomationRunEvent": {
        "type": "object",
        "required": [
          "id",
          "event_name",
          "payload",
          "correlation",
          "occurred_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "event_name": {
            "type": "string"
          },
          "payload": {
            "type": "object",
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/JsonObject"
              }
            ]
          },
          "correlation": {
            "type": "object",
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/Correlation"
              }
            ]
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AutomationRunWait": {
        "type": "object",
        "required": [
          "id",
          "step_id",
          "step_key",
          "step_type",
          "waiting_for_event_name",
          "status",
          "resolved_identity_value",
          "correlation",
          "execution_mode",
          "timeout_at",
          "resumed_at",
          "timed_out_at",
          "outcome_branch",
          "resumed_by_event"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "step_id": {
            "type": "string",
            "format": "uuid"
          },
          "step_key": {
            "type": "string",
            "nullable": true
          },
          "step_type": {
            "type": "string",
            "nullable": true
          },
          "waiting_for_event_name": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "resolved_identity_value": {
            "type": "string"
          },
          "correlation": {
            "type": "object",
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/Correlation"
              }
            ]
          },
          "execution_mode": {
            "type": "string"
          },
          "timeout_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "resumed_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "timed_out_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "outcome_branch": {
            "type": "string",
            "nullable": true
          },
          "resumed_by_event": {
            "type": "object",
            "required": [
              "id",
              "event_name",
              "occurred_at"
            ],
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "event_name": {
                "type": "string"
              },
              "occurred_at": {
                "type": "string",
                "format": "date-time"
              }
            },
            "nullable": true
          }
        }
      },
      "AutomationRunMessage": {
        "type": "object",
        "required": [
          "id",
          "status",
          "last_event",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "subject": {
            "type": "string",
            "nullable": true
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string"
          },
          "last_event": {
            "type": "string"
          },
          "automation_step_key": {
            "type": "string",
            "nullable": true
          },
          "template_version_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "contact_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AutomationRunStep": {
        "type": "object",
        "required": [
          "id",
          "step_key",
          "step_type",
          "status",
          "branch_taken",
          "input",
          "output",
          "last_error",
          "started_at",
          "completed_at",
          "waits",
          "linked_emails",
          "linked_push_notifications"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "step_key": {
            "type": "string"
          },
          "step_type": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "branch_taken": {
            "type": "string",
            "nullable": true
          },
          "input": {
            "$ref": "#/components/schemas/JsonValue"
          },
          "output": {
            "$ref": "#/components/schemas/JsonValue"
          },
          "last_error": {
            "type": "string",
            "nullable": true
          },
          "started_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "completed_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "waits": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AutomationRunWait"
            }
          },
          "linked_emails": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AutomationRunMessage"
            }
          },
          "linked_push_notifications": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AutomationRunMessage"
            }
          }
        }
      },
      "AutomationRunDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/AutomationRun"
          },
          {
            "type": "object",
            "required": [
              "trigger_event",
              "steps",
              "waits",
              "sent_emails",
              "sent_push_notifications"
            ],
            "properties": {
              "trigger_event": {
                "type": "object",
                "nullable": true,
                "allOf": [
                  {
                    "$ref": "#/components/schemas/AutomationRunEvent"
                  }
                ]
              },
              "steps": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AutomationRunStep"
                }
              },
              "waits": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AutomationRunWait"
                }
              },
              "sent_emails": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AutomationRunMessage"
                }
              },
              "sent_push_notifications": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AutomationRunMessage"
                }
              }
            }
          }
        ]
      },
      "AutomationRunsListResponse": {
        "type": "object",
        "required": [
          "status",
          "data",
          "metadata"
        ],
        "properties": {
          "status": {
            "type": "integer",
            "description": "HTTP response status code"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AutomationRun"
            }
          },
          "metadata": {
            "$ref": "#/components/schemas/CursorMetadata"
          }
        }
      },
      "AutomationRunDetailResponse": {
        "type": "object",
        "required": [
          "status",
          "data"
        ],
        "properties": {
          "status": {
            "type": "integer",
            "description": "HTTP response status code"
          },
          "data": {
            "$ref": "#/components/schemas/AutomationRunDetail"
          }
        }
      },
      "AutomationRunCancelResponse": {
        "type": "object",
        "required": [
          "status",
          "data"
        ],
        "properties": {
          "status": {
            "type": "integer",
            "description": "HTTP response status code"
          },
          "data": {
            "type": "object",
            "required": [
              "id",
              "canceled"
            ],
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "canceled": {
                "type": "boolean"
              },
              "already_canceled": {
                "type": "boolean"
              }
            }
          }
        }
      },
      "AutomationRunRetryResponse": {
        "type": "object",
        "required": [
          "status",
          "data"
        ],
        "properties": {
          "status": {
            "type": "integer",
            "description": "HTTP response status code"
          },
          "data": {
            "type": "object",
            "required": [
              "id",
              "retried",
              "resumed_from_step_key"
            ],
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "retried": {
                "type": "boolean"
              },
              "resumed_from_step_key": {
                "type": "string"
              }
            }
          }
        }
      },
      "Topic": {
        "type": "object",
        "required": [
          "id",
          "name",
          "description",
          "created_at",
          "updated_at",
          "deleted_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "deleted_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        }
      },
      "TopicDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Topic"
          },
          {
            "type": "object",
            "required": [
              "active_subscriptions_count"
            ],
            "properties": {
              "active_subscriptions_count": {
                "type": "integer"
              }
            }
          }
        ]
      },
      "TopicsListResponse": {
        "type": "object",
        "required": [
          "status",
          "data"
        ],
        "properties": {
          "status": {
            "type": "integer",
            "description": "HTTP response status code"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Topic"
            }
          }
        }
      },
      "TopicResponse": {
        "type": "object",
        "required": [
          "status",
          "data"
        ],
        "properties": {
          "status": {
            "type": "integer",
            "description": "HTTP response status code"
          },
          "data": {
            "$ref": "#/components/schemas/Topic"
          }
        }
      },
      "TopicDetailResponse": {
        "type": "object",
        "required": [
          "status",
          "data"
        ],
        "properties": {
          "status": {
            "type": "integer",
            "description": "HTTP response status code"
          },
          "data": {
            "$ref": "#/components/schemas/TopicDetail"
          }
        }
      },
      "TopicDeleteResponse": {
        "type": "object",
        "required": [
          "status",
          "data"
        ],
        "properties": {
          "status": {
            "type": "integer",
            "description": "HTTP response status code"
          },
          "data": {
            "type": "object",
            "required": [
              "id",
              "deleted",
              "deleted_at"
            ],
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "deleted": {
                "type": "boolean"
              },
              "deleted_at": {
                "type": "string",
                "format": "date-time"
              }
            }
          }
        }
      },
      "TopicSubscription": {
        "type": "object",
        "required": [
          "id",
          "contact_id",
          "topic_id",
          "is_subscribed",
          "subscribed_at",
          "unsubscribed_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "contact_id": {
            "type": "string",
            "format": "uuid"
          },
          "topic_id": {
            "type": "string",
            "format": "uuid"
          },
          "is_subscribed": {
            "type": "boolean"
          },
          "subscribed_at": {
            "type": "string",
            "format": "date-time"
          },
          "unsubscribed_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        }
      },
      "TopicSubscriptionResponse": {
        "type": "object",
        "required": [
          "status",
          "data"
        ],
        "properties": {
          "status": {
            "type": "integer",
            "description": "HTTP response status code"
          },
          "data": {
            "$ref": "#/components/schemas/TopicSubscription"
          }
        }
      },
      "ContactLookupResponse": {
        "type": "object",
        "required": [
          "status",
          "data"
        ],
        "properties": {
          "status": {
            "type": "integer",
            "description": "HTTP response status code"
          },
          "data": {
            "type": "object",
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/Contact"
              }
            ]
          }
        }
      },
      "ContactUpsert": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Contact"
          },
          {
            "type": "object",
            "required": [
              "created"
            ],
            "properties": {
              "created": {
                "type": "boolean"
              }
            }
          }
        ]
      },
      "ContactUpsertResponse": {
        "type": "object",
        "required": [
          "status",
          "data"
        ],
        "properties": {
          "status": {
            "type": "integer",
            "description": "HTTP response status code"
          },
          "data": {
            "$ref": "#/components/schemas/ContactUpsert"
          }
        }
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  }
}
