{
  "openapi": "3.1.1",
  "info": {
    "title": "Txtly API",
    "description": "Email, SMS, and messaging platform API. Manage domains, send transactional and bulk email/SMS, configure webhooks, automate workflows, and more.",
    "contact": {
      "name": "Txtly Support",
      "url": "https://docs.txtly.com.au"
    },
    "version": "v1"
  },
  "servers": [
    {
      "url": "http://api.txtly.com.au/"
    }
  ],
  "paths": {
    "/health": {
      "get": {
        "tags": [
          "Txtly.Api"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/auth/signup": {
      "post": {
        "tags": [
          "Auth"
        ],
        "summary": "Sign up",
        "description": "Create a new user account with email and password.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SignupRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/auth/login": {
      "post": {
        "tags": [
          "Auth"
        ],
        "summary": "Log in",
        "description": "Authenticate with email and password to receive JWT tokens.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LoginRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/auth/refresh": {
      "post": {
        "tags": [
          "Auth"
        ],
        "summary": "Refresh token",
        "description": "Exchange a refresh token for a new access token.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RefreshRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/auth/oauth": {
      "post": {
        "tags": [
          "Auth"
        ],
        "summary": "OAuth callback",
        "description": "Handle OAuth provider callbacks for social login.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OAuthRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/auth/me": {
      "get": {
        "tags": [
          "Auth"
        ],
        "summary": "Get current user",
        "description": "Retrieve authenticated user profile and team information.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/auth/2fa/status": {
      "get": {
        "tags": [
          "GetTwoFactorStatusHandler"
        ],
        "summary": "Get 2FA status",
        "description": "Check if two-factor authentication is enabled for the user.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/auth/2fa/setup": {
      "post": {
        "tags": [
          "SetupTwoFactorHandler"
        ],
        "summary": "Setup 2FA",
        "description": "Initiate two-factor authentication setup and receive a QR code.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/auth/2fa/verify": {
      "post": {
        "tags": [
          "VerifyTwoFactorHandler"
        ],
        "summary": "Verify 2FA",
        "description": "Confirm two-factor setup with a verification code from an authenticator app.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VerifyTotpRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/auth/2fa/disable": {
      "post": {
        "tags": [
          "DisableTwoFactorHandler"
        ],
        "summary": "Disable 2FA",
        "description": "Disable two-factor authentication for the user account.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DisableTwoFactorRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/api-keys": {
      "post": {
        "tags": [
          "API Keys"
        ],
        "summary": "Create an API key",
        "description": "Generate a new API key for programmatic access to the Txtly API.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateApiKeyRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "get": {
        "tags": [
          "API Keys"
        ],
        "summary": "List API keys",
        "description": "List all API keys with their creation date and last used timestamp.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/api-keys/{id}": {
      "get": {
        "tags": [
          "API Keys"
        ],
        "summary": "Get an API key",
        "description": "Retrieve a single API key by ID.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "patch": {
        "tags": [
          "API Keys"
        ],
        "summary": "Update an API key",
        "description": "Update API key details such as name or permissions.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateApiKeyRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "delete": {
        "tags": [
          "API Keys"
        ],
        "summary": "Delete an API key",
        "description": "Revoke an API key. Requests using this key will be rejected immediately.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/domains": {
      "post": {
        "tags": [
          "Domains"
        ],
        "summary": "Add a domain",
        "description": "Register a new domain for sending emails. Requires DNS verification.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddDomainRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "get": {
        "tags": [
          "Domains"
        ],
        "summary": "List domains",
        "description": "List all registered domains with their verification status.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/domains/{id}": {
      "get": {
        "tags": [
          "Domains"
        ],
        "summary": "Get a domain",
        "description": "Retrieve a single domain by ID including DNS records and verification details.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "patch": {
        "tags": [
          "Domains"
        ],
        "summary": "Update a domain",
        "description": "Update domain settings such as friendly name or default reply-to address.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateDomainRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "delete": {
        "tags": [
          "Domains"
        ],
        "summary": "Delete a domain",
        "description": "Delete a domain. Cannot be deleted if actively sending emails.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/domains/{id}/verify": {
      "post": {
        "tags": [
          "Domains"
        ],
        "summary": "Verify a domain",
        "description": "Verify domain ownership by checking DNS records (CNAME, MX, SPF).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/emails": {
      "post": {
        "tags": [
          "Emails"
        ],
        "summary": "Send an email",
        "description": "Send a single transactional email via a verified domain. Supports HTML/text bodies, CC/BCC, reply-to, scheduling, and idempotency keys.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendEmailRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "get": {
        "tags": [
          "Emails"
        ],
        "summary": "List emails",
        "description": "List sent emails with cursor-based pagination. Supports filtering by status and search.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "$ref": "#/components/schemas/EmailStatus"
            }
          },
          {
            "name": "domainId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/emails/batch": {
      "post": {
        "tags": [
          "Emails"
        ],
        "summary": "Send a batch of emails",
        "description": "Send up to 100 emails in a single request. Each email is validated and sent independently.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendBatchEmailRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/emails/{id}": {
      "get": {
        "tags": [
          "Emails"
        ],
        "summary": "Get an email",
        "description": "Retrieve a single email by ID including delivery status.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "patch": {
        "tags": [
          "Emails"
        ],
        "summary": "Reschedule an email",
        "description": "Update the scheduled send time of a scheduled email.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateEmailRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/emails/{id}/events": {
      "get": {
        "tags": [
          "Emails"
        ],
        "summary": "Get email events",
        "description": "Retrieve delivery events for an email (sent, delivered, opened, clicked, bounced, complained).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/emails/{id}/cancel": {
      "post": {
        "tags": [
          "Emails"
        ],
        "summary": "Cancel a scheduled email",
        "description": "Cancel a scheduled email before it is sent. Only emails with status 'scheduled' can be cancelled.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/emails/webhooks/events": {
      "post": {
        "tags": [
          "Emails"
        ],
        "summary": "SES event webhook (SNS)",
        "description": "Receives SES delivery / bounce / complaint events from an SNS topic subscription. Verifies SNS signatures, auto-confirms subscription, and writes EmailEvent rows.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IHttpClientFactory"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/workflows/triggers/{publicKey}": {
      "post": {
        "tags": [
          "Workflows"
        ],
        "summary": "Trigger a workflow via its public webhook",
        "description": "Anonymously trigger an active workflow using its public webhook key. Request body becomes the trigger's payload (TriggerData).",
        "parameters": [
          {
            "name": "publicKey",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/webhooks/stripe": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Stripe webhook",
        "description": "Handles Stripe webhook events for subscription lifecycle management.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/webhooks": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Create a webhook",
        "description": "Register a webhook endpoint to receive real-time event notifications.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateWebhookRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "List webhooks",
        "description": "List all registered webhooks with event types and status.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/webhooks/{id}": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Get a webhook",
        "description": "Retrieve a single webhook by ID including secret and delivery history.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "patch": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Update a webhook",
        "description": "Update webhook URL, event types, or status.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateWebhookRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "delete": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Delete a webhook",
        "description": "Unregister a webhook and stop receiving events.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/webhooks/{id}/rotate-secret": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Rotate webhook secret",
        "description": "Generate a new secret key for webhook signature validation.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/webhooks/dispatch": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Dispatch a webhook",
        "description": "Manually trigger a webhook delivery to test endpoint connectivity.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DispatchWebhookRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/webhooks/{webhookId}/deliveries": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "List webhook deliveries",
        "description": "List all delivery attempts for a webhook with status and timestamps.",
        "parameters": [
          {
            "name": "webhookId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "$ref": "#/components/schemas/WebhookDeliveryStatus"
            }
          },
          {
            "name": "eventType",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/webhooks/{webhookId}/deliveries/{deliveryId}": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Get webhook delivery",
        "description": "Retrieve details of a single webhook delivery attempt including payload and response.",
        "parameters": [
          {
            "name": "webhookId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "deliveryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/webhooks/{webhookId}/deliveries/{deliveryId}/replay": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Replay webhook delivery",
        "description": "Resend a failed webhook delivery to the endpoint.",
        "parameters": [
          {
            "name": "webhookId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "deliveryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/metrics": {
      "get": {
        "tags": [
          "Metrics"
        ],
        "summary": "Get metrics",
        "description": "Retrieve detailed send, delivery, and engagement metrics with filters.",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "domainId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/metrics/summary": {
      "get": {
        "tags": [
          "Metrics"
        ],
        "summary": "Get metrics summary",
        "description": "Get a high-level summary of key metrics (sends, deliveries, opens, clicks).",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "domainId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/templates": {
      "post": {
        "tags": [
          "Templates"
        ],
        "summary": "Create a template",
        "description": "Create a reusable email or SMS template with variable placeholders.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTemplateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "get": {
        "tags": [
          "Templates"
        ],
        "summary": "List templates",
        "description": "List all templates with creation date and usage count.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/templates/{id}": {
      "get": {
        "tags": [
          "Templates"
        ],
        "summary": "Get a template",
        "description": "Retrieve a single template by ID including body and variables.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "patch": {
        "tags": [
          "Templates"
        ],
        "summary": "Update a template",
        "description": "Update template content or variables. Changes apply to future sends.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateTemplateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "delete": {
        "tags": [
          "Templates"
        ],
        "summary": "Delete a template",
        "description": "Delete a template and archive its version history.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/contacts": {
      "post": {
        "tags": [
          "Contacts"
        ],
        "summary": "Create a contact",
        "description": "Add a new contact (recipient) to the system with email/phone and attributes.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateContactRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "get": {
        "tags": [
          "Contacts"
        ],
        "summary": "List contacts",
        "description": "List all contacts with cursor-based pagination and filtering.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "segmentId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/contacts/{id}": {
      "get": {
        "tags": [
          "Contacts"
        ],
        "summary": "Get a contact",
        "description": "Retrieve a single contact by ID including all attributes and engagement history.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "patch": {
        "tags": [
          "Contacts"
        ],
        "summary": "Update a contact",
        "description": "Update contact attributes, email, phone, or preferences.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateContactRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "delete": {
        "tags": [
          "Contacts"
        ],
        "summary": "Delete a contact",
        "description": "Delete a contact and remove it from all segments.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/contacts/import": {
      "post": {
        "tags": [
          "Contacts"
        ],
        "summary": "Import contacts",
        "description": "Bulk import up to 10,000 contacts from a CSV file.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImportContactsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/segments": {
      "post": {
        "tags": [
          "Segments"
        ],
        "summary": "Create a segment",
        "description": "Create a new segment for grouping contacts based on attributes or behavior.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSegmentRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "get": {
        "tags": [
          "Segments"
        ],
        "summary": "List segments",
        "description": "List all segments with contact count and creation date.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/segments/{id}": {
      "get": {
        "tags": [
          "Segments"
        ],
        "summary": "Get a segment",
        "description": "Retrieve a segment by ID including contact and unsubscribed counts.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "patch": {
        "tags": [
          "Segments"
        ],
        "summary": "Update a segment",
        "description": "Update the segment name.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSegmentRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "delete": {
        "tags": [
          "Segments"
        ],
        "summary": "Delete a segment",
        "description": "Delete a segment. Contacts remain but are no longer grouped.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/segments/{id}/contacts": {
      "post": {
        "tags": [
          "Segments"
        ],
        "summary": "Add contacts to segment",
        "description": "Add one or more contacts to a segment.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddContactsToSegmentRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/segments/{id}/contacts/{contactId}": {
      "delete": {
        "tags": [
          "Segments"
        ],
        "summary": "Remove contact from segment",
        "description": "Remove a contact from a segment.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "contactId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/rate-limits": {
      "get": {
        "tags": [
          "Rate Limits"
        ],
        "summary": "Get rate limits",
        "description": "Retrieve current rate limits and usage for your API key and team.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/suppressions": {
      "post": {
        "tags": [
          "Suppressions"
        ],
        "summary": "Create a suppression",
        "description": "Add an email or phone number to the suppression list to prevent sends.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSuppressionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "get": {
        "tags": [
          "Suppressions"
        ],
        "summary": "List suppressions",
        "description": "List all suppressed addresses with reason and creation date.",
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32",
              "default": 50
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reason",
            "in": "query",
            "schema": {
              "$ref": "#/components/schemas/SuppressionReason"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/suppressions/{id}": {
      "get": {
        "tags": [
          "Suppressions"
        ],
        "summary": "Get a suppression",
        "description": "Retrieve details of a single suppressed address.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "delete": {
        "tags": [
          "Suppressions"
        ],
        "summary": "Delete a suppression",
        "description": "Remove an address from the suppression list.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/broadcasts": {
      "post": {
        "tags": [
          "Broadcasts"
        ],
        "summary": "Create a broadcast",
        "description": "Create a new broadcast campaign with recipient segments and message content.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateBroadcastRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "get": {
        "tags": [
          "Broadcasts"
        ],
        "summary": "List broadcasts",
        "description": "List all broadcasts with status, recipient count, and engagement metrics.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/broadcasts/{id}": {
      "get": {
        "tags": [
          "Broadcasts"
        ],
        "summary": "Get a broadcast",
        "description": "Retrieve a single broadcast by ID including full details and performance metrics.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "patch": {
        "tags": [
          "Broadcasts"
        ],
        "summary": "Update a broadcast",
        "description": "Update broadcast settings before sending. Cannot modify after sent.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateBroadcastRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "delete": {
        "tags": [
          "Broadcasts"
        ],
        "summary": "Delete a broadcast",
        "description": "Delete a broadcast and archive its data.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/broadcasts/{id}/send": {
      "post": {
        "tags": [
          "Broadcasts"
        ],
        "summary": "Send a broadcast",
        "description": "Send a broadcast to all recipients in the target segments.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/logs": {
      "get": {
        "tags": [
          "Logs"
        ],
        "summary": "List logs",
        "description": "List API request logs with timestamps, methods, status codes, and response times.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32"
            }
          },
          {
            "name": "method",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "apiKeyId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "since",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/logs/{id}": {
      "get": {
        "tags": [
          "Logs"
        ],
        "summary": "Get a log entry",
        "description": "Retrieve a single API request log with full request and response details.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/credentials": {
      "post": {
        "tags": [
          "CreateCredentialHandler"
        ],
        "summary": "Create a credential",
        "description": "Store provider credentials (AWS, SendGrid, Twilio) for email and SMS sending.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCredentialRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "get": {
        "tags": [
          "ListCredentialsHandler"
        ],
        "summary": "List credentials",
        "description": "List all stored credentials with type and status.",
        "parameters": [
          {
            "name": "type",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/credentials/{id}": {
      "get": {
        "tags": [
          "GetCredentialHandler"
        ],
        "summary": "Get a credential",
        "description": "Retrieve a single credential by ID (secret values are masked).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "patch": {
        "tags": [
          "UpdateCredentialHandler"
        ],
        "summary": "Update a credential",
        "description": "Update credential values and metadata.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateCredentialRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "delete": {
        "tags": [
          "DeleteCredentialHandler"
        ],
        "summary": "Delete a credential",
        "description": "Delete a credential. Services using it will fail until reassigned.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/team": {
      "get": {
        "tags": [
          "GetTeamHandler"
        ],
        "summary": "Get team info",
        "description": "Retrieve team details including name, plan, and member count.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "patch": {
        "tags": [
          "UpdateTeamHandler"
        ],
        "summary": "Update team info",
        "description": "Update team name and settings.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateTeamRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/team/members": {
      "get": {
        "tags": [
          "ListTeamMembersHandler"
        ],
        "summary": "List team members",
        "description": "List all team members with their roles and invitation status.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/team/invites": {
      "get": {
        "tags": [
          "ListInvitesHandler"
        ],
        "summary": "List team invites",
        "description": "List pending and accepted team member invitations.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "post": {
        "tags": [
          "CreateInviteHandler"
        ],
        "summary": "Create team invite",
        "description": "Invite a user to join the team by email address.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateInviteRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/team/invites/{id}": {
      "delete": {
        "tags": [
          "RevokeInviteHandler"
        ],
        "summary": "Revoke team invite",
        "description": "Cancel a pending team member invitation.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/team/invites/{id}/accept": {
      "post": {
        "tags": [
          "AcceptInviteHandler"
        ],
        "summary": "Accept team invite",
        "description": "Accept a team member invitation and join the team.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/users/{id}/role": {
      "patch": {
        "tags": [
          "UpdateUserRoleHandler"
        ],
        "summary": "Update user role",
        "description": "Change a team member's role (admin, editor, viewer).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateUserRoleRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/users/{id}": {
      "delete": {
        "tags": [
          "RemoveTeamMemberHandler"
        ],
        "summary": "Remove team member",
        "description": "Remove a user from the team and revoke their access.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/topics": {
      "post": {
        "tags": [
          "CreateTopicHandler"
        ],
        "summary": "Create a topic",
        "description": "Create a new topic for organizing and managing messages by category.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTopicRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "get": {
        "tags": [
          "ListTopicsHandler"
        ],
        "summary": "List topics",
        "description": "List all topics with subscription counts and metadata.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/topics/{id}": {
      "get": {
        "tags": [
          "GetTopicHandler"
        ],
        "summary": "Get a topic",
        "description": "Retrieve a single topic by ID including subscribers and settings.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "patch": {
        "tags": [
          "UpdateTopicHandler"
        ],
        "summary": "Update a topic",
        "description": "Update topic name and description.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateTopicRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "delete": {
        "tags": [
          "DeleteTopicHandler"
        ],
        "summary": "Delete a topic",
        "description": "Delete a topic and unsubscribe all contacts.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/topics/{id}/contacts": {
      "post": {
        "tags": [
          "SubscribeContactsHandler"
        ],
        "summary": "Subscribe contacts to a topic",
        "description": "Subscribe one or more contacts to a topic. Reactivates opted-out subscriptions.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SubscribeContactsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/topics/{id}/contacts/{contactId}": {
      "delete": {
        "tags": [
          "UnsubscribeContactHandler"
        ],
        "summary": "Unsubscribe a contact from a topic",
        "description": "Unsubscribe a contact from a topic by setting their status to opt-out.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "contactId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/workflows": {
      "post": {
        "tags": [
          "Workflows"
        ],
        "summary": "Create a workflow",
        "description": "Create an automated workflow with triggers, conditions, and actions.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateWorkflowRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "get": {
        "tags": [
          "Workflows"
        ],
        "summary": "List workflows",
        "description": "List all workflows with status and execution counts.",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "schema": {
              "$ref": "#/components/schemas/WorkflowStatus"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/workflows/{id}": {
      "get": {
        "tags": [
          "Workflows"
        ],
        "summary": "Get a workflow",
        "description": "Retrieve a single workflow by ID including steps, triggers, and settings.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "patch": {
        "tags": [
          "Workflows"
        ],
        "summary": "Update a workflow",
        "description": "Update workflow definition. Changes apply to future executions.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateWorkflowRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "delete": {
        "tags": [
          "Workflows"
        ],
        "summary": "Delete a workflow",
        "description": "Delete a workflow and archive execution history.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/workflows/{id}/activate": {
      "post": {
        "tags": [
          "Workflows"
        ],
        "summary": "Activate a workflow",
        "description": "Enable a workflow to start processing triggers and executing actions.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ActivateWorkflowRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/workflows/{id}/triggers/rotate": {
      "post": {
        "tags": [
          "Workflows"
        ],
        "summary": "Rotate trigger key",
        "description": "Regenerate the workflow's public trigger key. The previous URL stops working immediately.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/workflows/{id}/executions": {
      "post": {
        "tags": [
          "Workflows"
        ],
        "summary": "Trigger a workflow",
        "description": "Manually trigger a workflow execution with optional variables.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TriggerWorkflowRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "get": {
        "tags": [
          "Workflows"
        ],
        "summary": "List workflow executions",
        "description": "List all executions for a workflow with status and timestamps.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "$ref": "#/components/schemas/WorkflowExecutionStatus"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/workflows/{id}/executions/{executionId}": {
      "get": {
        "tags": [
          "Workflows"
        ],
        "summary": "Get workflow execution",
        "description": "Retrieve details of a single workflow execution including steps and logs.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "executionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/workflows/{id}/executions/{executionId}/cancel": {
      "post": {
        "tags": [
          "Workflows"
        ],
        "summary": "Cancel workflow execution",
        "description": "Stop a running workflow execution.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "executionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/sms/senders": {
      "post": {
        "tags": [
          "SMS Senders"
        ],
        "summary": "Add an SMS sender",
        "description": "Create a new SMS sender identity (phone number or short code) for sending messages.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddSmsSenderRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "get": {
        "tags": [
          "SMS Senders"
        ],
        "summary": "List SMS senders",
        "description": "List all SMS sender identities with their verification status.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/sms/senders/{id}": {
      "get": {
        "tags": [
          "SMS Senders"
        ],
        "summary": "Get an SMS sender",
        "description": "Retrieve a single SMS sender by ID.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "patch": {
        "tags": [
          "SMS Senders"
        ],
        "summary": "Update an SMS sender",
        "description": "Update SMS sender details such as friendly name.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSmsSenderRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "delete": {
        "tags": [
          "SMS Senders"
        ],
        "summary": "Delete an SMS sender",
        "description": "Delete an SMS sender identity. Cannot be deleted if actively sending messages.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/sms/senders/{id}/verify": {
      "post": {
        "tags": [
          "SMS Senders"
        ],
        "summary": "Verify an SMS sender",
        "description": "Initiate verification process for an SMS sender identity.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/billing/plans": {
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "List available plans",
        "description": "List all available plans with pricing and limits. Indicates which plan the team is currently on.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/billing/subscription": {
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "Get subscription status",
        "description": "Get the current team's subscription details including plan, status, and billing period.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/billing/checkout": {
      "post": {
        "tags": [
          "Billing"
        ],
        "summary": "Create checkout session",
        "description": "Create a Stripe Checkout session to subscribe to a paid plan. Returns a URL to redirect the user to.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCheckoutRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/billing/portal": {
      "post": {
        "tags": [
          "Billing"
        ],
        "summary": "Create billing portal session",
        "description": "Create a Stripe Billing Portal session for self-service subscription management (upgrade, downgrade, cancel, update payment method).",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateBillingPortalRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/sms": {
      "post": {
        "tags": [
          "SMS"
        ],
        "summary": "Send an SMS",
        "description": "Send a single transactional SMS message. Supports scheduling, idempotency keys, and delivery tracking.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendSmsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "get": {
        "tags": [
          "SMS"
        ],
        "summary": "List SMS messages",
        "description": "List sent SMS messages with cursor-based pagination. Supports filtering by status.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "$ref": "#/components/schemas/SmsMessageStatus"
            }
          },
          {
            "name": "senderId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/sms/batch": {
      "post": {
        "tags": [
          "SMS"
        ],
        "summary": "Send batch SMS messages",
        "description": "Send up to 100 SMS messages in a single request. Each message is validated and sent independently.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendBatchSmsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/sms/{id}": {
      "get": {
        "tags": [
          "SMS"
        ],
        "summary": "Get an SMS message",
        "description": "Retrieve a single SMS message by ID including delivery status.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/sms/{id}/events": {
      "get": {
        "tags": [
          "SMS"
        ],
        "summary": "Get SMS events",
        "description": "Retrieve delivery events for an SMS message (sent, delivered, failed, bounced).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/sms/webhooks/events": {
      "post": {
        "tags": [
          "SMS Webhooks"
        ],
        "summary": "Ingest SMS events",
        "description": "Webhook endpoint for receiving SMS delivery status updates from the provider.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchSmsEventPayload"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ActivateWorkflowRequest": {
        "required": [
          "active"
        ],
        "type": "object",
        "properties": {
          "active": {
            "type": "boolean"
          }
        }
      },
      "AddContactsToSegmentRequest": {
        "required": [
          "contactIds"
        ],
        "type": "object",
        "properties": {
          "contactIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        }
      },
      "AddDomainRequest": {
        "required": [
          "name"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "region": {
            "type": "string",
            "default": "us-east-1"
          }
        }
      },
      "AddSmsSenderRequest": {
        "required": [
          "name",
          "senderId"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "senderId": {
            "type": "string"
          },
          "senderType": {
            "$ref": "#/components/schemas/SmsSenderType"
          },
          "defaultMessageType": {
            "$ref": "#/components/schemas/SmsMessageType"
          },
          "country": {
            "type": "string",
            "default": "AU"
          }
        }
      },
      "ApiKeyPermission": {
        "enum": [
          "full_access",
          "sending_access"
        ],
        "default": "sending_access"
      },
      "AttachmentRequest": {
        "required": [
          "filename",
          "content"
        ],
        "type": "object",
        "properties": {
          "filename": {
            "type": "string"
          },
          "content": {
            "type": "string"
          },
          "contentType": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "BatchSmsEventPayload": {
        "required": [
          "events"
        ],
        "type": "object",
        "properties": {
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SmsEventPayload"
            }
          }
        }
      },
      "CreateApiKeyRequest": {
        "required": [
          "name"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "permission": {
            "$ref": "#/components/schemas/ApiKeyPermission"
          },
          "domainId": {
            "type": [
              "null",
              "string"
            ],
            "format": "uuid"
          }
        }
      },
      "CreateBillingPortalRequest": {
        "type": "object",
        "properties": {
          "returnUrl": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "CreateBroadcastRequest": {
        "required": [
          "name",
          "from",
          "segmentId",
          "subject"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "from": {
            "type": "string"
          },
          "segmentId": {
            "type": "string",
            "format": "uuid"
          },
          "subject": {
            "type": "string"
          },
          "html": {
            "type": [
              "null",
              "string"
            ]
          },
          "text": {
            "type": [
              "null",
              "string"
            ]
          },
          "topicId": {
            "type": [
              "null",
              "string"
            ],
            "format": "uuid"
          },
          "replyTo": {
            "type": [
              "null",
              "string"
            ]
          },
          "scheduledAt": {
            "type": [
              "null",
              "string"
            ],
            "format": "date-time"
          }
        }
      },
      "CreateCheckoutRequest": {
        "required": [
          "plan"
        ],
        "type": "object",
        "properties": {
          "plan": {
            "type": "string"
          }
        }
      },
      "CreateContactRequest": {
        "required": [
          "email"
        ],
        "type": "object",
        "properties": {
          "email": {
            "type": "string"
          },
          "firstName": {
            "type": [
              "null",
              "string"
            ]
          },
          "lastName": {
            "type": [
              "null",
              "string"
            ]
          },
          "phoneNumber": {
            "type": [
              "null",
              "string"
            ]
          },
          "properties": { },
          "segmentIds": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "topicIds": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        }
      },
      "CreateCredentialRequest": {
        "required": [
          "name",
          "type",
          "data"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "data": {
            "type": "string"
          }
        }
      },
      "CreateInviteRequest": {
        "required": [
          "email"
        ],
        "type": "object",
        "properties": {
          "email": {
            "type": "string"
          },
          "role": {
            "$ref": "#/components/schemas/UserRole"
          }
        }
      },
      "CreateSegmentRequest": {
        "required": [
          "name"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          }
        }
      },
      "CreateSuppressionRequest": {
        "required": [
          "email"
        ],
        "type": "object",
        "properties": {
          "email": {
            "type": "string"
          },
          "reason": {
            "$ref": "#/components/schemas/SuppressionReason"
          }
        }
      },
      "CreateTemplateRequest": {
        "required": [
          "name"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "html": {
            "type": [
              "null",
              "string"
            ]
          },
          "text": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "CreateTopicRequest": {
        "required": [
          "name"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          }
        }
      },
      "CreateWebhookRequest": {
        "required": [
          "endpointUrl",
          "events"
        ],
        "type": "object",
        "properties": {
          "endpointUrl": {
            "type": "string"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "CreateWorkflowRequest": {
        "required": [
          "name"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "description": {
            "type": [
              "null",
              "string"
            ]
          },
          "nodes": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "$ref": "#/components/schemas/WorkflowNodeRequest"
            }
          },
          "connections": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "$ref": "#/components/schemas/WorkflowConnectionRequest"
            }
          }
        }
      },
      "DisableTwoFactorRequest": {
        "required": [
          "code"
        ],
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          }
        }
      },
      "DispatchWebhookRequest": {
        "required": [
          "emailId",
          "eventType"
        ],
        "type": "object",
        "properties": {
          "emailId": {
            "type": "string",
            "format": "uuid"
          },
          "eventType": {
            "type": "string"
          },
          "eventData": { }
        }
      },
      "EmailStatus": {
        "enum": [
          "scheduled",
          "sent",
          "delivered",
          "bounced",
          "complained",
          "delayed",
          "cancelled",
          null
        ]
      },
      "IHttpClientFactory": {
        "type": "object"
      },
      "ImportContactRow": {
        "required": [
          "email"
        ],
        "type": "object",
        "properties": {
          "email": {
            "type": "string"
          },
          "firstName": {
            "type": [
              "null",
              "string"
            ]
          },
          "lastName": {
            "type": [
              "null",
              "string"
            ]
          },
          "phoneNumber": {
            "type": [
              "null",
              "string"
            ]
          },
          "unsubscribed": {
            "type": [
              "null",
              "boolean"
            ]
          }
        }
      },
      "ImportContactsRequest": {
        "required": [
          "contacts"
        ],
        "type": "object",
        "properties": {
          "contacts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ImportContactRow"
            }
          },
          "segmentId": {
            "type": [
              "null",
              "string"
            ],
            "format": "uuid"
          },
          "topicIds": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        }
      },
      "LoginRequest": {
        "required": [
          "email",
          "password"
        ],
        "type": "object",
        "properties": {
          "email": {
            "type": "string"
          },
          "password": {
            "type": "string"
          },
          "totpCode": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "OAuthRequest": {
        "required": [
          "provider",
          "email",
          "name",
          "avatarUrl",
          "providerAccountId"
        ],
        "type": "object",
        "properties": {
          "provider": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "avatarUrl": {
            "type": [
              "null",
              "string"
            ]
          },
          "providerAccountId": {
            "type": "string"
          }
        }
      },
      "RefreshRequest": {
        "required": [
          "refreshToken"
        ],
        "type": "object",
        "properties": {
          "refreshToken": {
            "type": "string"
          }
        }
      },
      "SendBatchEmailRequest": {
        "required": [
          "emails"
        ],
        "type": "object",
        "properties": {
          "emails": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SendEmailRequest"
            }
          }
        }
      },
      "SendBatchSmsRequest": {
        "required": [
          "messages"
        ],
        "type": "object",
        "properties": {
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SendSmsRequest"
            }
          }
        }
      },
      "SendEmailRequest": {
        "required": [
          "from",
          "to",
          "subject"
        ],
        "type": "object",
        "properties": {
          "from": {
            "type": "string"
          },
          "to": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "subject": {
            "type": "string"
          },
          "html": {
            "type": [
              "null",
              "string"
            ]
          },
          "text": {
            "type": [
              "null",
              "string"
            ]
          },
          "cc": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "type": "string"
            }
          },
          "bcc": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "type": "string"
            }
          },
          "replyTo": {
            "type": [
              "null",
              "string"
            ]
          },
          "tags": {
            "type": [
              "null",
              "object"
            ],
            "additionalProperties": {
              "type": "string"
            }
          },
          "headers": {
            "type": [
              "null",
              "object"
            ],
            "additionalProperties": {
              "type": "string"
            }
          },
          "scheduledAt": {
            "type": [
              "null",
              "string"
            ],
            "format": "date-time"
          },
          "templateId": {
            "type": [
              "null",
              "string"
            ],
            "format": "uuid"
          },
          "templateVariables": {
            "type": [
              "null",
              "object"
            ],
            "additionalProperties": {
              "type": "string"
            }
          },
          "attachments": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "$ref": "#/components/schemas/AttachmentRequest"
            }
          }
        }
      },
      "SendSmsRequest": {
        "required": [
          "to",
          "body",
          "senderId"
        ],
        "type": "object",
        "properties": {
          "to": {
            "type": "string"
          },
          "body": {
            "type": "string"
          },
          "senderId": {
            "type": "string",
            "format": "uuid"
          },
          "messageType": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/SmsMessageType"
              }
            ]
          }
        }
      },
      "SignupRequest": {
        "required": [
          "name",
          "email",
          "password",
          "teamName"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "password": {
            "type": "string"
          },
          "teamName": {
            "type": "string"
          }
        }
      },
      "SmsEventPayload": {
        "required": [
          "providerMessageId",
          "eventType"
        ],
        "type": "object",
        "properties": {
          "providerMessageId": {
            "type": "string"
          },
          "eventType": {
            "type": "string"
          },
          "price": {
            "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
            "type": [
              "null",
              "number",
              "string"
            ],
            "format": "double"
          },
          "data": { }
        }
      },
      "SmsMessageStatus": {
        "enum": [
          "accepted",
          "queued",
          "sent",
          "delivered",
          "failed",
          "undelivered",
          null
        ]
      },
      "SmsMessageType": {
        "enum": [
          "transactional",
          "promotional"
        ],
        "default": "transactional"
      },
      "SmsSenderType": {
        "enum": [
          "alphanumeric_id",
          "long_code",
          "toll_free",
          "short_code"
        ],
        "default": "alphanumeric_id"
      },
      "SubscribeContactsRequest": {
        "required": [
          "contactIds"
        ],
        "type": "object",
        "properties": {
          "contactIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        }
      },
      "SuppressionReason": {
        "enum": [
          "bounce",
          "complaint",
          "manual"
        ],
        "default": "manual"
      },
      "TemplateStatus": {
        "enum": [
          "draft",
          "published",
          null
        ]
      },
      "TlsMode": {
        "enum": [
          "opportunistic",
          "enforced",
          null
        ]
      },
      "TriggerWorkflowRequest": {
        "type": "object",
        "properties": {
          "triggerData": { }
        }
      },
      "UpdateApiKeyRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": [
              "null",
              "string"
            ]
          },
          "permission": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ApiKeyPermission"
              }
            ]
          }
        }
      },
      "UpdateBroadcastRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": [
              "null",
              "string"
            ]
          },
          "from": {
            "type": [
              "null",
              "string"
            ]
          },
          "subject": {
            "type": [
              "null",
              "string"
            ]
          },
          "html": {
            "type": [
              "null",
              "string"
            ]
          },
          "text": {
            "type": [
              "null",
              "string"
            ]
          },
          "replyTo": {
            "type": [
              "null",
              "string"
            ]
          },
          "scheduledAt": {
            "type": [
              "null",
              "string"
            ],
            "format": "date-time"
          }
        }
      },
      "UpdateContactRequest": {
        "type": "object",
        "properties": {
          "firstName": {
            "type": [
              "null",
              "string"
            ]
          },
          "lastName": {
            "type": [
              "null",
              "string"
            ]
          },
          "phoneNumber": {
            "type": [
              "null",
              "string"
            ]
          },
          "unsubscribed": {
            "type": [
              "null",
              "boolean"
            ]
          },
          "properties": { },
          "segmentIds": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "topicIds": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        }
      },
      "UpdateCredentialRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": [
              "null",
              "string"
            ]
          },
          "data": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "UpdateDomainRequest": {
        "type": "object",
        "properties": {
          "clickTracking": {
            "type": [
              "null",
              "boolean"
            ]
          },
          "openTracking": {
            "type": [
              "null",
              "boolean"
            ]
          },
          "tls": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/TlsMode"
              }
            ]
          },
          "customReturnPath": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "UpdateEmailRequest": {
        "required": [
          "scheduledAt"
        ],
        "type": "object",
        "properties": {
          "scheduledAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "UpdateSegmentRequest": {
        "required": [
          "name"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          }
        }
      },
      "UpdateSmsSenderRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": [
              "null",
              "string"
            ]
          },
          "defaultMessageType": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/SmsMessageType"
              }
            ]
          }
        }
      },
      "UpdateTeamRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": [
              "null",
              "string"
            ]
          },
          "avatarUrl": {
            "type": [
              "null",
              "string"
            ]
          },
          "requireTwoFactor": {
            "type": [
              "null",
              "boolean"
            ]
          }
        }
      },
      "UpdateTemplateRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": [
              "null",
              "string"
            ]
          },
          "html": {
            "type": [
              "null",
              "string"
            ]
          },
          "text": {
            "type": [
              "null",
              "string"
            ]
          },
          "status": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/TemplateStatus"
              }
            ]
          }
        }
      },
      "UpdateTopicRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "UpdateUserRoleRequest": {
        "required": [
          "role"
        ],
        "type": "object",
        "properties": {
          "role": {
            "$ref": "#/components/schemas/UserRole"
          }
        }
      },
      "UpdateWebhookRequest": {
        "type": "object",
        "properties": {
          "endpointUrl": {
            "type": [
              "null",
              "string"
            ]
          },
          "events": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "type": "string"
            }
          },
          "status": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/WebhookStatus"
              }
            ]
          }
        }
      },
      "UpdateWorkflowRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": [
              "null",
              "string"
            ]
          },
          "description": {
            "type": [
              "null",
              "string"
            ]
          },
          "nodes": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "$ref": "#/components/schemas/WorkflowNodeRequest"
            }
          },
          "connections": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "$ref": "#/components/schemas/WorkflowConnectionRequest"
            }
          }
        }
      },
      "UserRole": {
        "enum": [
          "owner",
          "admin",
          "member"
        ],
        "default": "member"
      },
      "VerifyTotpRequest": {
        "required": [
          "code"
        ],
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          }
        }
      },
      "WebhookDeliveryStatus": {
        "enum": [
          "pending",
          "delivered",
          "failed",
          null
        ]
      },
      "WebhookStatus": {
        "enum": [
          "active",
          "inactive",
          null
        ]
      },
      "WorkflowConnectionRequest": {
        "required": [
          "sourceNodeId",
          "targetNodeId"
        ],
        "type": "object",
        "properties": {
          "sourceNodeId": {
            "type": "string",
            "format": "uuid"
          },
          "targetNodeId": {
            "type": "string",
            "format": "uuid"
          },
          "sourcePort": {
            "type": [
              "null",
              "string"
            ]
          },
          "targetPort": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "WorkflowExecutionStatus": {
        "enum": [
          "running",
          "completed",
          "failed",
          "cancelled",
          null
        ]
      },
      "WorkflowNodeRequest": {
        "required": [
          "id",
          "type",
          "positionX",
          "positionY"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string"
          },
          "positionX": {
            "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][+-]?\\d+)?$",
            "type": [
              "number",
              "string"
            ],
            "format": "double"
          },
          "positionY": {
            "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][+-]?\\d+)?$",
            "type": [
              "number",
              "string"
            ],
            "format": "double"
          },
          "config": { },
          "credentialId": {
            "type": [
              "null",
              "string"
            ],
            "format": "uuid"
          }
        }
      },
      "WorkflowStatus": {
        "enum": [
          "draft",
          "active",
          "inactive",
          null
        ]
      }
    }
  },
  "tags": [
    {
      "name": "Txtly.Api"
    },
    {
      "name": "Auth"
    },
    {
      "name": "GetTwoFactorStatusHandler"
    },
    {
      "name": "SetupTwoFactorHandler"
    },
    {
      "name": "VerifyTwoFactorHandler"
    },
    {
      "name": "DisableTwoFactorHandler"
    },
    {
      "name": "API Keys"
    },
    {
      "name": "Domains"
    },
    {
      "name": "Emails"
    },
    {
      "name": "Workflows"
    },
    {
      "name": "Webhooks"
    },
    {
      "name": "Metrics"
    },
    {
      "name": "Templates"
    },
    {
      "name": "Contacts"
    },
    {
      "name": "Segments"
    },
    {
      "name": "Rate Limits"
    },
    {
      "name": "Suppressions"
    },
    {
      "name": "Broadcasts"
    },
    {
      "name": "Logs"
    },
    {
      "name": "CreateCredentialHandler"
    },
    {
      "name": "ListCredentialsHandler"
    },
    {
      "name": "GetCredentialHandler"
    },
    {
      "name": "UpdateCredentialHandler"
    },
    {
      "name": "DeleteCredentialHandler"
    },
    {
      "name": "GetTeamHandler"
    },
    {
      "name": "UpdateTeamHandler"
    },
    {
      "name": "ListTeamMembersHandler"
    },
    {
      "name": "ListInvitesHandler"
    },
    {
      "name": "CreateInviteHandler"
    },
    {
      "name": "RevokeInviteHandler"
    },
    {
      "name": "AcceptInviteHandler"
    },
    {
      "name": "UpdateUserRoleHandler"
    },
    {
      "name": "RemoveTeamMemberHandler"
    },
    {
      "name": "CreateTopicHandler"
    },
    {
      "name": "ListTopicsHandler"
    },
    {
      "name": "GetTopicHandler"
    },
    {
      "name": "UpdateTopicHandler"
    },
    {
      "name": "DeleteTopicHandler"
    },
    {
      "name": "SubscribeContactsHandler"
    },
    {
      "name": "UnsubscribeContactHandler"
    },
    {
      "name": "SMS Senders"
    },
    {
      "name": "Billing"
    },
    {
      "name": "SMS"
    },
    {
      "name": "SMS Webhooks"
    }
  ]
}