{
  "openapi": "3.1.0",
  "jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
  "info": {
    "title": "Coussema Public API",
    "version": "v1",
    "summary": "Programmable SMS and WhatsApp delivery, campaign orchestration, contacts, API keys, and webhook endpoints.",
    "description": "Coussema expose une API publique pour envoyer des SMS et des messages WhatsApp durables, consulter les ressources WhatsApp, gérer les contacts, créer des campagnes et configurer des webhooks sur la même logique métier que le dashboard."
  },
  "servers": [
    {
      "url": "/v1",
      "description": "Relative base path on the API host."
    }
  ],
  "tags": [
    {
      "name": "Platform",
      "description": "Service discovery, health, and machine-readable API metadata."
    },
    {
      "name": "SMS",
      "description": "Single-recipient SMS sends from the developer API."
    },
    {
      "name": "WhatsApp",
      "description": "Coussema WhatsApp template sends, service-window replies, and customer-safe read collections."
    },
    {
      "name": "Account",
      "description": "Organization account state, entitlements, and invoice-ready usage history."
    },
    {
      "name": "Contacts",
      "description": "Organization-scoped contact management."
    },
    {
      "name": "Campaigns",
      "description": "Create and list outbound SMS campaigns."
    },
    {
      "name": "Sender IDs",
      "description": "List approved sender identities and request new ones for review."
    },
    {
      "name": "API Keys",
      "description": "Manage organization API keys for the developer product."
    },
    {
      "name": "Webhooks",
      "description": "Manage outbound event delivery endpoints."
    }
  ],
  "paths": {
    "/": {
      "get": {
        "tags": [
          "Platform"
        ],
        "operationId": "getApiIndex",
        "summary": "Get API entrypoint metadata",
        "description": "Returns the current API version, the public docs path, and the machine-readable OpenAPI document path.",
        "responses": {
          "200": {
            "description": "API discovery metadata with docs and health paths.",
            "headers": {
              "x-request-id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiIndexResponse"
                }
              }
            }
          }
        }
      }
    },
    "/health": {
      "get": {
        "tags": [
          "Platform"
        ],
        "operationId": "getHealth",
        "summary": "Get API health",
        "description": "Lightweight health probe for uptime and platform status checks.",
        "responses": {
          "200": {
            "description": "Current API health snapshot.",
            "headers": {
              "x-request-id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthResponse"
                }
              }
            }
          }
        }
      }
    },
    "/openapi.json": {
      "get": {
        "tags": [
          "Platform"
        ],
        "operationId": "getOpenApiDocument",
        "summary": "Get the OpenAPI 3.1 document",
        "description": "Returns the machine-readable OpenAPI 3.1 contract generated from the shared Zod schemas.",
        "responses": {
          "200": {
            "description": "The current OpenAPI 3.1 document for the public API.",
            "headers": {
              "x-request-id": {
                "$ref": "#/components/headers/XRequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "OpenAPI 3.1 document"
                }
              }
            }
          }
        }
      }
    },
    "/sms/send": {
      "post": {
        "tags": [
          "SMS"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "xApiKey": []
          }
        ],
        "x-coussema-required-api-key-scopes": [
          "sms:send"
        ],
        "operationId": "sendSms",
        "summary": "Send one SMS",
        "description": "Enqueues and dispatches one SMS through the active supplier resolution flow for the authenticated organization.",
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestIdHeader"
          },
          {
            "$ref": "#/components/parameters/RequiredIdempotencyKeyHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Single-recipient SMS payload.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendSmsRequest"
              },
              "examples": {
                "basic": {
                  "summary": "Transactional send",
                  "value": {
                    "to": "243837509125",
                    "message": "Votre code de verification est 1234.",
                    "senderId": "11111111-1111-4111-8111-111111111111",
                    "clientReference": "txn-2026-0001"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "SMS accepted by the platform and queued for supplier dispatch.",
            "headers": {
              "x-request-id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SendSmsSuccessResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/whatsapp/messages": {
      "get": {
        "tags": [
          "WhatsApp"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "xApiKey": []
          }
        ],
        "x-coussema-required-api-key-scopes": [
          "whatsapp:read"
        ],
        "operationId": "listWhatsAppMessages",
        "summary": "List WhatsApp messages",
        "description": "Returns cursor-paginated WhatsApp message history for the authenticated organization. Provider message IDs, operator errors, and raw upstream payloads are never returned.",
        "parameters": [
          {
            "$ref": "#/components/parameters/LimitQuery"
          },
          {
            "$ref": "#/components/parameters/CursorQuery"
          },
          {
            "$ref": "#/components/parameters/WhatsAppMessageStatusQuery"
          },
          {
            "$ref": "#/components/parameters/WhatsAppBillingCategoryQuery"
          },
          {
            "$ref": "#/components/parameters/WhatsAppTemplateNameQuery"
          },
          {
            "$ref": "#/components/parameters/WhatsAppRecipientQuery"
          },
          {
            "$ref": "#/components/parameters/DateFromQuery"
          },
          {
            "$ref": "#/components/parameters/DateToQuery"
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated customer-safe WhatsApp messages.",
            "headers": {
              "x-request-id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListWhatsAppMessagesResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      },
      "post": {
        "tags": [
          "WhatsApp"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "xApiKey": []
          }
        ],
        "x-coussema-required-api-key-scopes": [
          "whatsapp:send"
        ],
        "operationId": "sendWhatsAppMessage",
        "summary": "Send a WhatsApp message",
        "description": "Accepts an approved utility/authentication template send or a service-window text reply for the authenticated organization. The public response returns the Coussema message id and keeps provider message ids hidden.",
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestIdHeader"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKeyHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "description": "WhatsApp send payload.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WhatsAppPublicApiSendRequest"
              },
              "examples": {
                "template": {
                  "summary": "Utility template send",
                  "value": {
                    "type": "template",
                    "to": "+243980395067",
                    "phoneNumberId": "11111111-1111-4111-8111-111111111111",
                    "template": {
                      "name": "payment_notice",
                      "language": "fr",
                      "category": "utility",
                      "parameters": [
                        "12345"
                      ]
                    },
                    "clientReference": "invoice-12345"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "WhatsApp message accepted by the platform.",
            "headers": {
              "x-request-id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WhatsAppSendResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/whatsapp/messages/{messageId}": {
      "get": {
        "tags": [
          "WhatsApp"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "xApiKey": []
          }
        ],
        "x-coussema-required-api-key-scopes": [
          "whatsapp:read"
        ],
        "operationId": "getWhatsAppMessage",
        "summary": "Get a WhatsApp message",
        "description": "Returns one customer-safe WhatsApp message belonging to the authenticated organization. Provider identifiers and raw upstream evidence are never returned.",
        "parameters": [
          {
            "$ref": "#/components/parameters/WhatsAppMessageIdPath"
          }
        ],
        "responses": {
          "200": {
            "description": "Customer-safe WhatsApp message.",
            "headers": {
              "x-request-id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetWhatsAppMessageResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/whatsapp/templates": {
      "get": {
        "tags": [
          "WhatsApp"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "xApiKey": []
          }
        ],
        "x-coussema-required-api-key-scopes": [
          "whatsapp:read"
        ],
        "operationId": "listWhatsAppTemplates",
        "summary": "List WhatsApp templates",
        "description": "Returns cursor-paginated WhatsApp templates available to the authenticated organization, with local Coussema disabled templates excluded.",
        "parameters": [
          {
            "$ref": "#/components/parameters/LimitQuery"
          },
          {
            "$ref": "#/components/parameters/CursorQuery"
          },
          {
            "$ref": "#/components/parameters/WhatsAppTemplateStatusQuery"
          },
          {
            "$ref": "#/components/parameters/WhatsAppTemplateCategoryQuery"
          },
          {
            "$ref": "#/components/parameters/WhatsAppTemplateNameQuery"
          },
          {
            "$ref": "#/components/parameters/DateFromQuery"
          },
          {
            "$ref": "#/components/parameters/DateToQuery"
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated WhatsApp template collection.",
            "headers": {
              "x-request-id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListWhatsAppTemplatesResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/whatsapp/conversations": {
      "get": {
        "tags": [
          "WhatsApp"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "xApiKey": []
          }
        ],
        "x-coussema-required-api-key-scopes": [
          "whatsapp:read"
        ],
        "operationId": "listWhatsAppConversations",
        "summary": "List WhatsApp conversations",
        "description": "Returns cursor-paginated WhatsApp conversations with service-window timestamps for the authenticated organization.",
        "parameters": [
          {
            "$ref": "#/components/parameters/LimitQuery"
          },
          {
            "$ref": "#/components/parameters/CursorQuery"
          },
          {
            "$ref": "#/components/parameters/WhatsAppConversationStatusQuery"
          },
          {
            "$ref": "#/components/parameters/WhatsAppRecipientQuery"
          },
          {
            "$ref": "#/components/parameters/DateFromQuery"
          },
          {
            "$ref": "#/components/parameters/DateToQuery"
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated WhatsApp conversation collection.",
            "headers": {
              "x-request-id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListWhatsAppConversationsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/whatsapp/phone-numbers": {
      "get": {
        "tags": [
          "WhatsApp"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "xApiKey": []
          }
        ],
        "x-coussema-required-api-key-scopes": [
          "whatsapp:read"
        ],
        "operationId": "getWhatsAppPhoneNumberHealth",
        "summary": "Get WhatsApp phone-number health",
        "description": "Returns the customer-safe connection, quality, messaging-tier, and credential-health projection for WhatsApp numbers owned by the authenticated organization.",
        "responses": {
          "200": {
            "description": "WhatsApp phone-number health projection.",
            "headers": {
              "x-request-id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetWhatsAppPhoneNumberHealthResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/whatsapp/campaigns/{campaignId}": {
      "get": {
        "tags": [
          "WhatsApp"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "xApiKey": []
          }
        ],
        "x-coussema-required-api-key-scopes": [
          "whatsapp:read"
        ],
        "operationId": "getWhatsAppCampaignStatus",
        "summary": "Get WhatsApp campaign status",
        "description": "Returns aggregate delivery counts for one WhatsApp campaign owned by the authenticated organization, without provider identifiers or supplier cost evidence.",
        "parameters": [
          {
            "$ref": "#/components/parameters/WhatsAppCampaignIdPath"
          }
        ],
        "responses": {
          "200": {
            "description": "Customer-safe WhatsApp campaign status.",
            "headers": {
              "x-request-id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetWhatsAppCampaignStatusResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/whatsapp/wallet": {
      "get": {
        "tags": [
          "WhatsApp"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "xApiKey": []
          }
        ],
        "x-coussema-required-api-key-scopes": [
          "whatsapp:read"
        ],
        "operationId": "getWhatsAppWalletSummary",
        "summary": "Get WhatsApp wallet summary",
        "description": "Returns available, reserved, consumed, and total WhatsApp wallet amounts for the authenticated organization.",
        "responses": {
          "200": {
            "description": "WhatsApp wallet summary.",
            "headers": {
              "x-request-id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetWhatsAppWalletSummaryResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/account": {
      "get": {
        "tags": [
          "Account"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "xApiKey": []
          }
        ],
        "x-coussema-required-api-key-scopes": [
          "account:read"
        ],
        "operationId": "getAccountSummary",
        "summary": "Get account commercial summary",
        "description": "Returns the authenticated organization commercial state, current subscription, and remaining quota.",
        "responses": {
          "200": {
            "description": "Current organization commercial summary.",
            "headers": {
              "x-request-id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountSummaryResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/usage": {
      "get": {
        "tags": [
          "Account"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "xApiKey": []
          }
        ],
        "x-coussema-required-api-key-scopes": [
          "account:read"
        ],
        "operationId": "listUsage",
        "summary": "List quota usage ledger entries",
        "description": "Returns cursor-paginated usage and quota adjustment entries for the authenticated organization.",
        "parameters": [
          {
            "$ref": "#/components/parameters/LimitQuery"
          },
          {
            "$ref": "#/components/parameters/CursorQuery"
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated commercial usage ledger.",
            "headers": {
              "x-request-id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListUsageResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/contacts": {
      "get": {
        "tags": [
          "Contacts"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "xApiKey": []
          }
        ],
        "x-coussema-required-api-key-scopes": [
          "contacts:read"
        ],
        "operationId": "listContacts",
        "summary": "List contacts",
        "description": "Returns a cursor-paginated collection of organization contacts.",
        "parameters": [
          {
            "$ref": "#/components/parameters/LimitQuery"
          },
          {
            "$ref": "#/components/parameters/CursorQuery"
          },
          {
            "$ref": "#/components/parameters/ContactTagQuery"
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated organization contacts.",
            "headers": {
              "x-request-id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListContactsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      },
      "post": {
        "tags": [
          "Contacts"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "xApiKey": []
          }
        ],
        "x-coussema-required-api-key-scopes": [
          "contacts:write"
        ],
        "operationId": "createContact",
        "summary": "Create a contact",
        "description": "Creates one organization contact and normalizes phone/tags server-side.",
        "requestBody": {
          "required": true,
          "description": "Contact creation payload.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateContactRequest"
              },
              "examples": {
                "basic": {
                  "summary": "Contact with tags",
                  "value": {
                    "name": "Nadine M.",
                    "phone": "243837509125",
                    "tags": [
                      "vip",
                      "retail"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Created contact.",
            "headers": {
              "x-request-id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateContactResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      },
      "delete": {
        "tags": [
          "Contacts"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "xApiKey": []
          }
        ],
        "x-coussema-required-api-key-scopes": [
          "contacts:write"
        ],
        "operationId": "deleteContact",
        "summary": "Delete a contact",
        "description": "Deletes one organization contact by identifier.",
        "parameters": [
          {
            "$ref": "#/components/parameters/ContactIdQuery"
          }
        ],
        "responses": {
          "200": {
            "description": "Contact deleted.",
            "headers": {
              "x-request-id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/campaigns": {
      "get": {
        "tags": [
          "Campaigns"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "xApiKey": []
          }
        ],
        "x-coussema-required-api-key-scopes": [
          "campaigns:read"
        ],
        "operationId": "listCampaigns",
        "summary": "List campaigns",
        "description": "Returns cursor-paginated campaigns for the authenticated organization.",
        "parameters": [
          {
            "$ref": "#/components/parameters/LimitQuery"
          },
          {
            "$ref": "#/components/parameters/CursorQuery"
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated campaign collection.",
            "headers": {
              "x-request-id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListCampaignsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      },
      "post": {
        "tags": [
          "Campaigns"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "xApiKey": []
          }
        ],
        "x-coussema-required-api-key-scopes": [
          "campaigns:write"
        ],
        "operationId": "createCampaign",
        "summary": "Create a campaign",
        "description": "Creates one immediate or scheduled SMS campaign on the shared organization-centric runtime.",
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestIdHeader"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKeyHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Campaign creation payload.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCampaignRequest"
              },
              "examples": {
                "scheduled": {
                  "summary": "Scheduled campaign",
                  "value": {
                    "name": "Promo week-end",
                    "message_template": "Bonjour {{name}}, profitez de -15% ce week-end.",
                    "scheduled_at": "2026-04-10T08:30:00.000Z",
                    "sender_id": "11111111-1111-4111-8111-111111111111",
                    "audience_tags": [
                      "vip",
                      "retail"
                    ],
                    "audience_tag_match_mode": "all"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created campaign.",
            "headers": {
              "x-request-id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateCampaignResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/sender-ids": {
      "get": {
        "tags": [
          "Sender IDs"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "xApiKey": []
          }
        ],
        "x-coussema-required-api-key-scopes": [
          "sender_ids:read"
        ],
        "operationId": "listSenderIds",
        "summary": "List sender IDs",
        "description": "Returns the authenticated organization sender IDs, including approval status and default selection.",
        "responses": {
          "200": {
            "description": "Current sender IDs for the organization.",
            "headers": {
              "x-request-id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListSenderIdsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      },
      "post": {
        "tags": [
          "Sender IDs"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "xApiKey": []
          }
        ],
        "x-coussema-required-api-key-scopes": [
          "sender_ids:write"
        ],
        "operationId": "createSenderIdRequest",
        "summary": "Request a sender ID",
        "description": "Creates or reopens a sender ID request for the authenticated organization. Approval remains operator and admin controlled.",
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestIdHeader"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKeyHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Sender ID request payload.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSenderIdRequest"
              },
              "examples": {
                "basic": {
                  "summary": "Request a branded sender",
                  "value": {
                    "value": "TESSA"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created sender ID request.",
            "headers": {
              "x-request-id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateSenderIdRequestResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/api-keys": {
      "get": {
        "tags": [
          "API Keys"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "xApiKey": []
          }
        ],
        "x-coussema-required-api-key-scopes": [
          "api_keys:read"
        ],
        "operationId": "listApiKeys",
        "summary": "List API keys",
        "description": "Lists the organization API keys visible to the authenticated principal, paginated by cursor.",
        "parameters": [
          {
            "$ref": "#/components/parameters/LimitQuery"
          },
          {
            "$ref": "#/components/parameters/CursorQuery"
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated API key collection.",
            "headers": {
              "x-request-id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListApiKeysResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      },
      "post": {
        "tags": [
          "API Keys"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "xApiKey": []
          }
        ],
        "x-coussema-required-api-key-scopes": [
          "api_keys:write"
        ],
        "operationId": "createApiKey",
        "summary": "Create an API key",
        "description": "Creates a scoped organization API key and returns the plaintext secret exactly once. A key may delegate only scopes it already owns, and each organization may keep at most five active keys.",
        "requestBody": {
          "required": true,
          "description": "API key creation payload.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateApiKeyRequest"
              },
              "examples": {
                "basic": {
                  "summary": "Server integration key",
                  "value": {
                    "name": "Production backend",
                    "scopes": [
                      "account:read",
                      "sms:send"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Created API key.",
            "headers": {
              "x-request-id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateApiKeyResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/api-keys/{apiKeyId}": {
      "delete": {
        "tags": [
          "API Keys"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "xApiKey": []
          }
        ],
        "x-coussema-required-api-key-scopes": [
          "api_keys:write"
        ],
        "operationId": "revokeApiKey",
        "summary": "Revoke an API key",
        "description": "Revokes one organization API key by identifier.",
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiKeyIdPath"
          }
        ],
        "responses": {
          "200": {
            "description": "API key revoked.",
            "headers": {
              "x-request-id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/webhooks": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "xApiKey": []
          }
        ],
        "x-coussema-required-api-key-scopes": [
          "webhooks:read"
        ],
        "operationId": "listWebhookEndpoints",
        "summary": "List webhook endpoints",
        "description": "Lists outbound webhook endpoints configured for the authenticated organization.",
        "parameters": [
          {
            "$ref": "#/components/parameters/LimitQuery"
          },
          {
            "$ref": "#/components/parameters/CursorQuery"
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated webhook endpoint collection.",
            "headers": {
              "x-request-id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListWebhookEndpointsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      },
      "post": {
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "xApiKey": []
          }
        ],
        "x-coussema-required-api-key-scopes": [
          "webhooks:write"
        ],
        "operationId": "createWebhookEndpoint",
        "summary": "Create a webhook endpoint",
        "description": "Registers a webhook endpoint and returns its signing secret once at creation time.",
        "requestBody": {
          "required": true,
          "description": "Webhook endpoint creation payload.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateWebhookEndpointRequest"
              },
              "examples": {
                "basic": {
                  "summary": "Message lifecycle events",
                  "value": {
                    "url": "https://example.com/hooks/coussema",
                    "subscribed_events": [
                      "message.sent",
                      "message.delivered",
                      "message.failed"
                    ]
                  }
                },
                "whatsapp": {
                  "summary": "WhatsApp lifecycle events",
                  "value": {
                    "url": "https://example.com/hooks/coussema-whatsapp",
                    "subscribed_events": [
                      "whatsapp.message.sent",
                      "whatsapp.message.delivered",
                      "whatsapp.message.read",
                      "whatsapp.message.failed",
                      "whatsapp.message.received"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Created webhook endpoint and signing secret.",
            "headers": {
              "x-request-id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateWebhookEndpointResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/webhooks/{webhookEndpointId}": {
      "delete": {
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "bearerApiKey": []
          },
          {
            "xApiKey": []
          }
        ],
        "x-coussema-required-api-key-scopes": [
          "webhooks:write"
        ],
        "operationId": "disableWebhookEndpoint",
        "summary": "Disable a webhook endpoint",
        "description": "Disables an existing outbound webhook endpoint by identifier.",
        "parameters": [
          {
            "$ref": "#/components/parameters/WebhookEndpointIdPath"
          }
        ],
        "responses": {
          "200": {
            "description": "Webhook endpoint disabled.",
            "headers": {
              "x-request-id": {
                "$ref": "#/components/headers/XRequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/XRateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/XRateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/XRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerApiKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API key",
        "description": "Send your Coussema API key as Authorization: Bearer <api-key>."
      },
      "xApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key",
        "description": "Alternative header for clients that cannot send Authorization."
      }
    },
    "parameters": {
      "RequestIdHeader": {
        "name": "x-request-id",
        "in": "header",
        "required": false,
        "description": "Optional caller-supplied correlation identifier. The API always echoes a request id in responses.",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 255
        }
      },
      "IdempotencyKeyHeader": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": false,
        "description": "Recommended for POST requests. Reusing the same key with the same payload replays the stored response.",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 255
        }
      },
      "RequiredIdempotencyKeyHeader": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": true,
        "description": "Required for SMS sends. Reusing the same key with the same payload replays the stored response and prevents duplicate enqueue on client retries.",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 255
        }
      },
      "LimitQuery": {
        "name": "limit",
        "in": "query",
        "required": false,
        "description": "Maximum number of items to return.",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100,
          "default": 25
        }
      },
      "CursorQuery": {
        "name": "cursor",
        "in": "query",
        "required": false,
        "description": "Opaque cursor returned by the previous page.",
        "schema": {
          "type": "string",
          "minLength": 1
        }
      },
      "DateFromQuery": {
        "name": "dateFrom",
        "in": "query",
        "required": false,
        "description": "Inclusive lower bound on the resource creation timestamp.",
        "schema": {
          "type": "string",
          "format": "date-time"
        }
      },
      "DateToQuery": {
        "name": "dateTo",
        "in": "query",
        "required": false,
        "description": "Inclusive upper bound on the resource creation timestamp.",
        "schema": {
          "type": "string",
          "format": "date-time"
        }
      },
      "WhatsAppTemplateStatusQuery": {
        "name": "status",
        "in": "query",
        "required": false,
        "description": "Filter WhatsApp templates by Coussema template status.",
        "schema": {
          "type": "string",
          "enum": [
            "draft",
            "pending",
            "approved",
            "rejected",
            "paused",
            "disabled"
          ]
        }
      },
      "WhatsAppTemplateCategoryQuery": {
        "name": "category",
        "in": "query",
        "required": false,
        "description": "Filter WhatsApp templates by template category.",
        "schema": {
          "type": "string",
          "enum": [
            "authentication",
            "utility",
            "marketing"
          ]
        }
      },
      "WhatsAppConversationStatusQuery": {
        "name": "status",
        "in": "query",
        "required": false,
        "description": "Filter WhatsApp conversations by conversation state.",
        "schema": {
          "type": "string",
          "enum": [
            "open",
            "pending",
            "needs_human",
            "closed",
            "blocked"
          ]
        }
      },
      "WhatsAppMessageStatusQuery": {
        "name": "status",
        "in": "query",
        "required": false,
        "description": "Filter WhatsApp messages by delivery state.",
        "schema": {
          "type": "string",
          "enum": [
            "funding",
            "accepted",
            "queued",
            "sent",
            "delivered",
            "read",
            "failed",
            "cancelled",
            "ambiguous"
          ]
        }
      },
      "WhatsAppBillingCategoryQuery": {
        "name": "category",
        "in": "query",
        "required": false,
        "description": "Filter WhatsApp messages by billing/conversation category.",
        "schema": {
          "type": "string",
          "enum": [
            "authentication",
            "utility",
            "marketing",
            "service"
          ]
        }
      },
      "WhatsAppTemplateNameQuery": {
        "name": "template",
        "in": "query",
        "required": false,
        "description": "Filter by WhatsApp template name.",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 512,
          "pattern": "^[a-z0-9_]+$"
        }
      },
      "WhatsAppRecipientQuery": {
        "name": "recipient",
        "in": "query",
        "required": false,
        "description": "Filter by recipient phone number in E.164 format.",
        "schema": {
          "type": "string",
          "pattern": "^\\+[1-9][0-9]{7,14}$"
        }
      },
      "WhatsAppMessageIdPath": {
        "name": "messageId",
        "in": "path",
        "required": true,
        "description": "Coussema WhatsApp message identifier.",
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "WhatsAppCampaignIdPath": {
        "name": "campaignId",
        "in": "path",
        "required": true,
        "description": "Coussema WhatsApp campaign identifier.",
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "ContactTagQuery": {
        "name": "tag",
        "in": "query",
        "required": false,
        "description": "Filter contacts to a single tag value.",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 64
        }
      },
      "ContactIdQuery": {
        "name": "id",
        "in": "query",
        "required": true,
        "description": "Contact identifier.",
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "ApiKeyIdPath": {
        "name": "apiKeyId",
        "in": "path",
        "required": true,
        "description": "API key identifier.",
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "WebhookEndpointIdPath": {
        "name": "webhookEndpointId",
        "in": "path",
        "required": true,
        "description": "Webhook endpoint identifier.",
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      }
    },
    "headers": {
      "XRequestId": {
        "description": "Unique request correlation id generated or echoed by the API.",
        "schema": {
          "type": "string"
        }
      },
      "XRateLimitLimit": {
        "description": "Rate limit budget allocated to the authenticated API key window.",
        "schema": {
          "type": "integer",
          "minimum": 0
        }
      },
      "XRateLimitRemaining": {
        "description": "Remaining requests in the current API key window.",
        "schema": {
          "type": "integer",
          "minimum": 0
        }
      },
      "XRateLimitReset": {
        "description": "Unix timestamp at which the current rate-limit window resets.",
        "schema": {
          "type": "integer",
          "minimum": 0
        }
      },
      "RetryAfter": {
        "description": "Seconds to wait before retrying after a rate-limit rejection.",
        "schema": {
          "type": "integer",
          "minimum": 0
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Invalid request payload, query, or header values.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/XRequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ValidationErrorResponse"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Missing or invalid API key authentication.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/XRequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "Forbidden": {
        "description": "Authenticated principal cannot access the requested organization resource.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/XRequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "NotFound": {
        "description": "Requested resource was not found.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/XRequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "Conflict": {
        "description": "The request conflicts with current state or a prior idempotent request.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/XRequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ConflictErrorResponse"
            }
          }
        }
      },
      "RateLimited": {
        "description": "The authenticated API key exceeded its request budget for the current window.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/XRequestId"
          },
          "X-RateLimit-Limit": {
            "$ref": "#/components/headers/XRateLimitLimit"
          },
          "X-RateLimit-Remaining": {
            "$ref": "#/components/headers/XRateLimitRemaining"
          },
          "X-RateLimit-Reset": {
            "$ref": "#/components/headers/XRateLimitReset"
          },
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "InternalServerError": {
        "description": "Unexpected server-side failure.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/XRequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      }
    },
    "schemas": {
      "ApiIndexResponse": {
        "type": "object",
        "properties": {
          "service": {
            "type": "string",
            "const": "coussema-api"
          },
          "version": {
            "type": "string",
            "const": "v1"
          },
          "status": {
            "type": "string",
            "const": "available"
          },
          "docsPath": {
            "type": "string",
            "const": "/docs/api"
          },
          "healthPath": {
            "type": "string",
            "const": "/v1/health"
          },
          "openApiPath": {
            "type": "string",
            "const": "/v1/openapi.json"
          }
        },
        "required": [
          "service",
          "version",
          "status",
          "docsPath",
          "healthPath",
          "openApiPath"
        ],
        "additionalProperties": false
      },
      "HealthResponse": {
        "type": "object",
        "properties": {
          "service": {
            "type": "string",
            "const": "coussema-api"
          },
          "version": {
            "type": "string",
            "const": "v1"
          },
          "status": {
            "type": "string",
            "const": "ok"
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
          },
          "release": {
            "type": "object",
            "properties": {
              "manifestVersion": {
                "type": "number",
                "const": 1
              },
              "service": {
                "type": "string",
                "const": "coussema-api"
              },
              "commitSha": {
                "anyOf": [
                  {
                    "type": "string",
                    "const": "unknown"
                  },
                  {
                    "type": "string",
                    "pattern": "^[0-9a-f]{40}$"
                  }
                ]
              },
              "builtAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "environment": {
                "type": "string",
                "pattern": "^[a-z0-9][a-z0-9._-]{0,63}$"
              },
              "source": {
                "type": "string",
                "enum": [
                  "explicit",
                  "vercel",
                  "github",
                  "unconfigured"
                ]
              },
              "schemaVersion": {
                "type": "string",
                "const": "20260731210000"
              },
              "schemaCompatibility": {
                "type": "object",
                "properties": {
                  "minimum": {
                    "type": "string",
                    "const": "20260717020000"
                  },
                  "maximum": {
                    "type": "string",
                    "const": "20260731210000"
                  }
                },
                "required": [
                  "minimum",
                  "maximum"
                ],
                "additionalProperties": false
              },
              "complete": {
                "type": "boolean"
              }
            },
            "required": [
              "manifestVersion",
              "service",
              "commitSha",
              "builtAt",
              "environment",
              "source",
              "schemaVersion",
              "schemaCompatibility",
              "complete"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "service",
          "version",
          "status",
          "timestamp",
          "release"
        ],
        "additionalProperties": false
      },
      "AccountSummaryResponse": {
        "type": "object",
        "properties": {
          "organizationId": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "organizationName": {
            "type": "string",
            "minLength": 1
          },
          "organizationSlug": {
            "type": "string",
            "minLength": 1
          },
          "billingEmail": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "defaultSenderName": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string",
            "minLength": 1
          },
          "canSend": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "string"
          },
          "plan": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "code": {
                    "type": "string",
                    "minLength": 1
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1
                  },
                  "description": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "includedSms": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "priceUsd": {
                    "type": "number",
                    "minimum": 0
                  },
                  "isActive": {
                    "type": "boolean"
                  },
                  "overageEnabled": {
                    "type": "boolean"
                  },
                  "overageLimitSms": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "overagePriceUsdPerSms": {
                    "type": "number",
                    "minimum": 0
                  },
                  "createdAt": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "updatedAt": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "id",
                  "code",
                  "name",
                  "description",
                  "includedSms",
                  "priceUsd",
                  "isActive",
                  "overageEnabled",
                  "overageLimitSms",
                  "overagePriceUsdPerSms",
                  "createdAt",
                  "updatedAt"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "subscription": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "planId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "status": {
                    "type": "string",
                    "minLength": 1
                  },
                  "smsLimit": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "priceUsd": {
                    "type": "number",
                    "minimum": 0
                  },
                  "startsAt": {
                    "type": "string"
                  },
                  "expiresAt": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "createdAt": {
                    "type": "string"
                  },
                  "updatedAt": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "overageEnabled": {
                    "type": "boolean"
                  },
                  "overageLimitSms": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "overagePriceUsdPerSms": {
                    "type": "number",
                    "minimum": 0
                  }
                },
                "required": [
                  "id",
                  "planId",
                  "status",
                  "smsLimit",
                  "priceUsd",
                  "startsAt",
                  "expiresAt",
                  "createdAt",
                  "updatedAt",
                  "overageEnabled",
                  "overageLimitSms",
                  "overagePriceUsdPerSms"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "quota": {
            "type": "object",
            "properties": {
              "creditUnits": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "debitUnits": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "remainingUnits": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "limitUnits": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "creditUnits",
              "debitUnits",
              "remainingUnits",
              "limitUnits"
            ],
            "additionalProperties": false
          },
          "overage": {
            "type": "object",
            "properties": {
              "enabled": {
                "type": "boolean"
              },
              "limitUnits": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "usedUnits": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "remainingUnits": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "billableUnits": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "priceUsdPerSms": {
                "type": "number",
                "minimum": 0
              }
            },
            "required": [
              "enabled",
              "limitUnits",
              "usedUnits",
              "remainingUnits",
              "billableUnits",
              "priceUsdPerSms"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "organizationId",
          "organizationName",
          "organizationSlug",
          "billingEmail",
          "defaultSenderName",
          "status",
          "canSend",
          "createdAt",
          "plan",
          "subscription",
          "quota",
          "overage"
        ],
        "additionalProperties": false
      },
      "ListUsageResponse": {
        "type": "object",
        "properties": {
          "usage": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "organizationId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "entryType": {
                  "type": "string",
                  "minLength": 1
                },
                "direction": {
                  "type": "string",
                  "enum": [
                    "credit",
                    "debit"
                  ]
                },
                "units": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "referenceType": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "referenceId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "createdAt": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "organizationId",
                "entryType",
                "direction",
                "units",
                "referenceType",
                "referenceId",
                "createdAt"
              ],
              "additionalProperties": false
            }
          },
          "pageInfo": {
            "type": "object",
            "properties": {
              "limit": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "hasMore": {
                "type": "boolean"
              },
              "nextCursor": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "limit",
              "hasMore",
              "nextCursor"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "usage",
          "pageInfo"
        ],
        "additionalProperties": false
      },
      "SendSmsRequest": {
        "type": "object",
        "properties": {
          "to": {
            "type": "string",
            "minLength": 6,
            "maxLength": 32
          },
          "message": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1530
          },
          "senderId": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "senderName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 32
          },
          "clientReference": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        },
        "required": [
          "to",
          "message"
        ],
        "additionalProperties": false
      },
      "SendSmsSuccessResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "const": true
          },
          "queued": {
            "type": "boolean"
          },
          "status": {
            "type": "string",
            "enum": [
              "accepted",
              "sent"
            ]
          },
          "count": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "remainingQuota": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "message": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "clientReference": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "id",
              "clientReference"
            ],
            "additionalProperties": false
          },
          "provider": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "minLength": 1
              },
              "messageId": {
                "type": "null"
              },
              "httpStatus": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "code",
              "messageId",
              "httpStatus"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "success",
          "count",
          "remainingQuota",
          "message",
          "provider"
        ],
        "additionalProperties": false
      },
      "WhatsAppPublicApiSendRequest": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "to": {
                "type": "string",
                "pattern": "^\\+[1-9]\\d{7,14}$"
              },
              "phoneNumberId": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "clientReference": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "type": {
                "type": "string",
                "const": "template"
              },
              "template": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 512,
                    "pattern": "^[a-z0-9_]+$"
                  },
                  "language": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 16
                  },
                  "category": {
                    "type": "string",
                    "enum": [
                      "authentication",
                      "utility",
                      "marketing"
                    ]
                  },
                  "parameters": {
                    "default": [],
                    "maxItems": 32,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 1024
                    }
                  }
                },
                "required": [
                  "name",
                  "language",
                  "category",
                  "parameters"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "to",
              "phoneNumberId",
              "type",
              "template"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "to": {
                "type": "string",
                "pattern": "^\\+[1-9]\\d{7,14}$"
              },
              "phoneNumberId": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "clientReference": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "type": {
                "type": "string",
                "const": "text"
              },
              "conversationId": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "text": {
                "type": "string",
                "minLength": 1,
                "maxLength": 4096
              }
            },
            "required": [
              "to",
              "phoneNumberId",
              "type",
              "conversationId",
              "text"
            ],
            "additionalProperties": false
          }
        ]
      },
      "WhatsAppSendResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "const": true
          },
          "queued": {
            "type": "boolean"
          },
          "status": {
            "type": "string",
            "enum": [
              "accepted",
              "queued",
              "sent"
            ]
          },
          "messageId": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "provider": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "const": "whatsapp"
              },
              "messageId": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "httpStatus": {
                "type": "integer",
                "minimum": 100,
                "maximum": 599
              }
            },
            "required": [
              "code",
              "messageId",
              "httpStatus"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "success",
          "queued",
          "status",
          "messageId",
          "provider"
        ],
        "additionalProperties": false
      },
      "GetWhatsAppMessageResponse": {
        "type": "object",
        "properties": {
          "message": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "conversationId": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "direction": {
                "type": "string",
                "enum": [
                  "inbound",
                  "outbound"
                ]
              },
              "messageType": {
                "type": "string",
                "enum": [
                  "template",
                  "text",
                  "interactive",
                  "unknown"
                ]
              },
              "recipientPhoneE164": {
                "type": "string",
                "pattern": "^\\+[1-9]\\d{7,14}$"
              },
              "templateName": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "templateLanguage": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "category": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": [
                      "authentication",
                      "utility",
                      "marketing",
                      "service"
                    ]
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "funding",
                  "accepted",
                  "queued",
                  "sent",
                  "delivered",
                  "read",
                  "failed",
                  "cancelled",
                  "ambiguous"
                ]
              },
              "bodyPreview": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "publicErrorCode": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "failureLabel": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "createdAt": {
                "type": "string"
              },
              "sentAt": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "deliveredAt": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "readAt": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "failedAt": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "id",
              "conversationId",
              "direction",
              "messageType",
              "recipientPhoneE164",
              "templateName",
              "templateLanguage",
              "category",
              "status",
              "bodyPreview",
              "publicErrorCode",
              "failureLabel",
              "createdAt",
              "sentAt",
              "deliveredAt",
              "readAt",
              "failedAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "message"
        ],
        "additionalProperties": false
      },
      "GetWhatsAppPhoneNumberHealthResponse": {
        "type": "object",
        "properties": {
          "channelStatus": {
            "type": "string",
            "enum": [
              "ready",
              "attention",
              "unavailable"
            ]
          },
          "phoneNumbers": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "phoneNumberId": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "displayNumberMasked": {
                  "type": "string",
                  "minLength": 1
                },
                "displayName": {
                  "type": "string",
                  "minLength": 1
                },
                "quality": {
                  "type": "string",
                  "enum": [
                    "good",
                    "warning",
                    "critical",
                    "unknown"
                  ]
                },
                "messagingTier": {
                  "type": "string",
                  "minLength": 1
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "connected",
                    "restricted",
                    "disconnected",
                    "unknown"
                  ]
                },
                "active": {
                  "type": "boolean"
                },
                "credentialStatus": {
                  "type": "string",
                  "enum": [
                    "healthy",
                    "expiring",
                    "expired",
                    "revoked",
                    "error",
                    "unknown"
                  ]
                },
                "credentialExpiresAt": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "credentialLastCheckedAt": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "webhookStatus": {
                  "type": "string",
                  "enum": [
                    "healthy",
                    "configured",
                    "stale",
                    "unconfigured",
                    "unknown"
                  ]
                },
                "lastUpdatedAt": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "phoneNumberId",
                "displayNumberMasked",
                "displayName",
                "quality",
                "messagingTier",
                "status",
                "active",
                "credentialStatus",
                "credentialExpiresAt",
                "credentialLastCheckedAt",
                "webhookStatus",
                "lastUpdatedAt"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "channelStatus",
          "phoneNumbers"
        ],
        "additionalProperties": false
      },
      "GetWhatsAppCampaignStatusResponse": {
        "type": "object",
        "properties": {
          "campaign": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "name": {
                "type": "string",
                "minLength": 1
              },
              "status": {
                "type": "string",
                "minLength": 1
              },
              "scheduledAt": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "createdAt": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "updatedAt": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "summary": {
                "type": "object",
                "properties": {
                  "totalRecipients": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "acceptedCount": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "sentCount": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "deliveredCount": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "readCount": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "failedCount": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "billedCount": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "totalRecipients",
                  "acceptedCount",
                  "sentCount",
                  "deliveredCount",
                  "readCount",
                  "failedCount",
                  "billedCount"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "id",
              "name",
              "status",
              "scheduledAt",
              "createdAt",
              "updatedAt",
              "summary"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "campaign"
        ],
        "additionalProperties": false
      },
      "GetWhatsAppWalletSummaryResponse": {
        "type": "object",
        "properties": {
          "balances": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "currency": {
                  "type": "string",
                  "minLength": 3,
                  "maxLength": 8
                },
                "availableBalance": {
                  "type": "number",
                  "minimum": 0
                },
                "reservedBalance": {
                  "type": "number",
                  "minimum": 0
                },
                "consumedBalance": {
                  "type": "number",
                  "minimum": 0
                },
                "updatedAt": {
                  "type": "string"
                }
              },
              "required": [
                "currency",
                "availableBalance",
                "reservedBalance",
                "consumedBalance",
                "updatedAt"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "balances"
        ],
        "additionalProperties": false
      },
      "ListWhatsAppTemplatesResponse": {
        "type": "object",
        "properties": {
          "templates": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "name": {
                  "type": "string"
                },
                "language": {
                  "type": "string"
                },
                "category": {
                  "type": "string",
                  "enum": [
                    "authentication",
                    "utility",
                    "marketing"
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "draft",
                    "pending",
                    "approved",
                    "rejected",
                    "paused",
                    "disabled"
                  ]
                },
                "createdAt": {
                  "type": "string"
                },
                "updatedAt": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "name",
                "language",
                "category",
                "status",
                "createdAt",
                "updatedAt"
              ],
              "additionalProperties": false
            }
          },
          "pageInfo": {
            "type": "object",
            "properties": {
              "limit": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "hasMore": {
                "type": "boolean"
              },
              "nextCursor": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "limit",
              "hasMore",
              "nextCursor"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "templates",
          "pageInfo"
        ],
        "additionalProperties": false
      },
      "ListWhatsAppConversationsResponse": {
        "type": "object",
        "properties": {
          "conversations": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "recipientPhoneE164": {
                  "type": "string",
                  "pattern": "^\\+[1-9]\\d{7,14}$"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "open",
                    "pending",
                    "needs_human",
                    "closed",
                    "blocked"
                  ]
                },
                "customerServiceWindowUntil": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "lastCustomerMessageAt": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "createdAt": {
                  "type": "string"
                },
                "updatedAt": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "recipientPhoneE164",
                "status",
                "customerServiceWindowUntil",
                "lastCustomerMessageAt",
                "createdAt",
                "updatedAt"
              ],
              "additionalProperties": false
            }
          },
          "pageInfo": {
            "type": "object",
            "properties": {
              "limit": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "hasMore": {
                "type": "boolean"
              },
              "nextCursor": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "limit",
              "hasMore",
              "nextCursor"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "conversations",
          "pageInfo"
        ],
        "additionalProperties": false
      },
      "ListWhatsAppMessagesResponse": {
        "type": "object",
        "properties": {
          "messages": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "conversationId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "direction": {
                  "type": "string",
                  "enum": [
                    "inbound",
                    "outbound"
                  ]
                },
                "messageType": {
                  "type": "string",
                  "enum": [
                    "template",
                    "text",
                    "interactive",
                    "unknown"
                  ]
                },
                "recipientPhoneE164": {
                  "type": "string",
                  "pattern": "^\\+[1-9]\\d{7,14}$"
                },
                "templateName": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "templateLanguage": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "category": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "authentication",
                        "utility",
                        "marketing",
                        "service"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "funding",
                    "accepted",
                    "queued",
                    "sent",
                    "delivered",
                    "read",
                    "failed",
                    "cancelled",
                    "ambiguous"
                  ]
                },
                "bodyPreview": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "publicErrorCode": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "failureLabel": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "createdAt": {
                  "type": "string"
                },
                "sentAt": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "deliveredAt": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "readAt": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "failedAt": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "conversationId",
                "direction",
                "messageType",
                "recipientPhoneE164",
                "templateName",
                "templateLanguage",
                "category",
                "status",
                "bodyPreview",
                "publicErrorCode",
                "failureLabel",
                "createdAt",
                "sentAt",
                "deliveredAt",
                "readAt",
                "failedAt"
              ],
              "additionalProperties": false
            }
          },
          "pageInfo": {
            "type": "object",
            "properties": {
              "limit": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "hasMore": {
                "type": "boolean"
              },
              "nextCursor": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "limit",
              "hasMore",
              "nextCursor"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "messages",
          "pageInfo"
        ],
        "additionalProperties": false
      },
      "CreateContactRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "phone": {
            "type": "string",
            "minLength": 6,
            "maxLength": 32
          },
          "tags": {
            "maxItems": 20,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        },
        "required": [
          "phone"
        ],
        "additionalProperties": false
      },
      "CreateContactResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "const": true
          },
          "contact": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "organization_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "name": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "phone": {
                "type": "string"
              },
              "tags": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "metadata": {
                "anyOf": [
                  {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "created_at": {
                "type": "string"
              },
              "updated_at": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "organization_id",
              "name",
              "phone",
              "tags",
              "created_at",
              "updated_at"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "success",
          "contact"
        ],
        "additionalProperties": false
      },
      "ListContactsResponse": {
        "type": "object",
        "properties": {
          "contacts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "organization_id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "name": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "phone": {
                  "type": "string"
                },
                "tags": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "metadata": {
                  "anyOf": [
                    {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "created_at": {
                  "type": "string"
                },
                "updated_at": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "organization_id",
                "name",
                "phone",
                "tags",
                "created_at",
                "updated_at"
              ],
              "additionalProperties": false
            }
          },
          "pageInfo": {
            "type": "object",
            "properties": {
              "limit": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "hasMore": {
                "type": "boolean"
              },
              "nextCursor": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "limit",
              "hasMore",
              "nextCursor"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "contacts",
          "pageInfo"
        ],
        "additionalProperties": false
      },
      "CreateCampaignRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          },
          "message_template": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1530
          },
          "scheduled_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "total_recipients": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "sender_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ]
          },
          "sender_name": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 32
              },
              {
                "type": "null"
              }
            ]
          },
          "audience_preset_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ]
          },
          "audience_tags": {
            "maxItems": 20,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          "audience_tag_match_mode": {
            "type": "string",
            "enum": [
              "any",
              "all"
            ]
          }
        },
        "required": [
          "name",
          "message_template"
        ],
        "additionalProperties": false
      },
      "CreateCampaignResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "const": true
          },
          "campaign": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "organization_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "created_by_user_id": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "name": {
                "type": "string"
              },
              "sender_id": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "sender_name": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "message_template": {
                "type": "string"
              },
              "audience_preset_id": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "audience_tags": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "audience_tag_match_mode": {
                "type": "string",
                "enum": [
                  "any",
                  "all"
                ]
              },
              "status": {
                "type": "string"
              },
              "scheduled_at": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "total_recipients": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "queued_count": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "sent_count": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "delivered_count": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "failed_count": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "created_at": {
                "type": "string"
              },
              "updated_at": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "organization_id",
              "created_by_user_id",
              "name",
              "sender_id",
              "sender_name",
              "message_template",
              "audience_preset_id",
              "audience_tags",
              "audience_tag_match_mode",
              "status",
              "scheduled_at",
              "total_recipients",
              "queued_count",
              "sent_count",
              "delivered_count",
              "failed_count",
              "created_at",
              "updated_at"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "success",
          "campaign"
        ],
        "additionalProperties": false
      },
      "ListCampaignsResponse": {
        "type": "object",
        "properties": {
          "campaigns": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "organization_id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "created_by_user_id": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "name": {
                  "type": "string"
                },
                "sender_id": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "sender_name": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "message_template": {
                  "type": "string"
                },
                "audience_preset_id": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "audience_tags": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "audience_tag_match_mode": {
                  "type": "string",
                  "enum": [
                    "any",
                    "all"
                  ]
                },
                "status": {
                  "type": "string"
                },
                "scheduled_at": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "total_recipients": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "queued_count": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "sent_count": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "delivered_count": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "failed_count": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "created_at": {
                  "type": "string"
                },
                "updated_at": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "organization_id",
                "created_by_user_id",
                "name",
                "sender_id",
                "sender_name",
                "message_template",
                "audience_preset_id",
                "audience_tags",
                "audience_tag_match_mode",
                "status",
                "scheduled_at",
                "total_recipients",
                "queued_count",
                "sent_count",
                "delivered_count",
                "failed_count",
                "created_at",
                "updated_at"
              ],
              "additionalProperties": false
            }
          },
          "pageInfo": {
            "type": "object",
            "properties": {
              "limit": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "hasMore": {
                "type": "boolean"
              },
              "nextCursor": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "limit",
              "hasMore",
              "nextCursor"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "campaigns",
          "pageInfo"
        ],
        "additionalProperties": false
      },
      "CreateSenderIdRequest": {
        "type": "object",
        "properties": {
          "value": {
            "type": "string",
            "minLength": 3,
            "maxLength": 11
          },
          "metadata": {
            "anyOf": [
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "value"
        ],
        "additionalProperties": false
      },
      "CreateSenderIdRequestResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "const": true
          },
          "sender_id": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "organization_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "requested_by_user_id": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "reviewed_by_user_id": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "value": {
                "type": "string",
                "minLength": 1,
                "maxLength": 32
              },
              "normalized_value": {
                "type": "string",
                "minLength": 1,
                "maxLength": 32
              },
              "status": {
                "type": "string",
                "enum": [
                  "pending_review",
                  "pending_operator",
                  "approved",
                  "rejected",
                  "archived"
                ]
              },
              "rejection_reason": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "operator_reference": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "is_default": {
                "type": "boolean"
              },
              "metadata": {
                "anyOf": [
                  {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "reviewed_at": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "created_at": {
                "type": "string"
              },
              "updated_at": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "organization_id",
              "requested_by_user_id",
              "reviewed_by_user_id",
              "value",
              "normalized_value",
              "status",
              "rejection_reason",
              "operator_reference",
              "is_default",
              "metadata",
              "reviewed_at",
              "created_at",
              "updated_at"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "success",
          "sender_id"
        ],
        "additionalProperties": false
      },
      "ListSenderIdsResponse": {
        "type": "object",
        "properties": {
          "sender_ids": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "organization_id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "requested_by_user_id": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "reviewed_by_user_id": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "value": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 32
                },
                "normalized_value": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 32
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "pending_review",
                    "pending_operator",
                    "approved",
                    "rejected",
                    "archived"
                  ]
                },
                "rejection_reason": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "operator_reference": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "is_default": {
                  "type": "boolean"
                },
                "metadata": {
                  "anyOf": [
                    {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "reviewed_at": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "created_at": {
                  "type": "string"
                },
                "updated_at": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "organization_id",
                "requested_by_user_id",
                "reviewed_by_user_id",
                "value",
                "normalized_value",
                "status",
                "rejection_reason",
                "operator_reference",
                "is_default",
                "metadata",
                "reviewed_at",
                "created_at",
                "updated_at"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "sender_ids"
        ],
        "additionalProperties": false
      },
      "CreateApiKeyRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "scopes": {
            "minItems": 1,
            "maxItems": 14,
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "account:read",
                "sms:send",
                "campaigns:read",
                "campaigns:write",
                "contacts:read",
                "contacts:write",
                "sender_ids:read",
                "sender_ids:write",
                "webhooks:read",
                "webhooks:write",
                "api_keys:read",
                "api_keys:write",
                "whatsapp:read",
                "whatsapp:send"
              ]
            }
          }
        },
        "required": [
          "name"
        ],
        "additionalProperties": false
      },
      "CreateApiKeyResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "const": true
          },
          "apiKey": {
            "type": "object",
            "properties": {
              "apiKeyId": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "organizationId": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "name": {
                "type": "string",
                "minLength": 1
              },
              "keyPrefix": {
                "type": "string",
                "minLength": 1
              },
              "maskedKey": {
                "type": "string",
                "minLength": 1
              },
              "plainTextKey": {
                "type": "string",
                "minLength": 1
              },
              "scopes": {
                "minItems": 1,
                "maxItems": 14,
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "account:read",
                    "sms:send",
                    "campaigns:read",
                    "campaigns:write",
                    "contacts:read",
                    "contacts:write",
                    "sender_ids:read",
                    "sender_ids:write",
                    "webhooks:read",
                    "webhooks:write",
                    "api_keys:read",
                    "api_keys:write",
                    "whatsapp:read",
                    "whatsapp:send"
                  ]
                }
              },
              "lastUsedAt": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "revokedAt": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "createdAt": {
                "type": "string"
              }
            },
            "required": [
              "apiKeyId",
              "organizationId",
              "name",
              "keyPrefix",
              "maskedKey",
              "plainTextKey",
              "scopes",
              "lastUsedAt",
              "revokedAt",
              "createdAt"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "success",
          "apiKey"
        ],
        "additionalProperties": false
      },
      "ListApiKeysResponse": {
        "type": "object",
        "properties": {
          "apiKeys": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "organizationId": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "name": {
                  "type": "string",
                  "minLength": 1
                },
                "keyPrefix": {
                  "type": "string",
                  "minLength": 1
                },
                "maskedKey": {
                  "type": "string",
                  "minLength": 1
                },
                "scopes": {
                  "minItems": 1,
                  "maxItems": 14,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "enum": [
                      "account:read",
                      "sms:send",
                      "campaigns:read",
                      "campaigns:write",
                      "contacts:read",
                      "contacts:write",
                      "sender_ids:read",
                      "sender_ids:write",
                      "webhooks:read",
                      "webhooks:write",
                      "api_keys:read",
                      "api_keys:write",
                      "whatsapp:read",
                      "whatsapp:send"
                    ]
                  }
                },
                "lastUsedAt": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "revokedAt": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "createdAt": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "organizationId",
                "name",
                "keyPrefix",
                "maskedKey",
                "scopes",
                "lastUsedAt",
                "revokedAt",
                "createdAt"
              ],
              "additionalProperties": false
            }
          },
          "pageInfo": {
            "type": "object",
            "properties": {
              "limit": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "hasMore": {
                "type": "boolean"
              },
              "nextCursor": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "limit",
              "hasMore",
              "nextCursor"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "apiKeys",
          "pageInfo"
        ],
        "additionalProperties": false
      },
      "CreateWebhookEndpointRequest": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "subscribed_events": {
            "minItems": 1,
            "maxItems": 10,
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "message.queued",
                "message.sent",
                "message.delivered",
                "message.failed",
                "message.delivery_unconfirmed",
                "whatsapp.message.sent",
                "whatsapp.message.delivered",
                "whatsapp.message.read",
                "whatsapp.message.failed",
                "whatsapp.message.received"
              ]
            }
          }
        },
        "required": [
          "url",
          "subscribed_events"
        ],
        "additionalProperties": false
      },
      "CreateWebhookEndpointResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "const": true
          },
          "webhookEndpoint": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "organization_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "url": {
                "type": "string",
                "format": "uri"
              },
              "subscribed_events": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "message.queued",
                    "message.sent",
                    "message.delivered",
                    "message.failed",
                    "message.delivery_unconfirmed",
                    "whatsapp.message.sent",
                    "whatsapp.message.delivered",
                    "whatsapp.message.read",
                    "whatsapp.message.failed",
                    "whatsapp.message.received"
                  ]
                }
              },
              "status": {
                "type": "string"
              },
              "created_at": {
                "type": "string"
              },
              "updated_at": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "organization_id",
              "url",
              "subscribed_events",
              "status",
              "created_at",
              "updated_at"
            ],
            "additionalProperties": false
          },
          "signingSecret": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "success",
          "webhookEndpoint",
          "signingSecret"
        ],
        "additionalProperties": false
      },
      "ListWebhookEndpointsResponse": {
        "type": "object",
        "properties": {
          "webhookEndpoints": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "organization_id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "url": {
                  "type": "string",
                  "format": "uri"
                },
                "subscribed_events": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "enum": [
                      "message.queued",
                      "message.sent",
                      "message.delivered",
                      "message.failed",
                      "message.delivery_unconfirmed",
                      "whatsapp.message.sent",
                      "whatsapp.message.delivered",
                      "whatsapp.message.read",
                      "whatsapp.message.failed",
                      "whatsapp.message.received"
                    ]
                  }
                },
                "status": {
                  "type": "string"
                },
                "created_at": {
                  "type": "string"
                },
                "updated_at": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "organization_id",
                "url",
                "subscribed_events",
                "status",
                "created_at",
                "updated_at"
              ],
              "additionalProperties": false
            }
          },
          "pageInfo": {
            "type": "object",
            "properties": {
              "limit": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "hasMore": {
                "type": "boolean"
              },
              "nextCursor": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "limit",
              "hasMore",
              "nextCursor"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "webhookEndpoints",
          "pageInfo"
        ],
        "additionalProperties": false
      },
      "SuccessResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "const": true
          }
        },
        "required": [
          "success"
        ],
        "additionalProperties": false
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "requestId": {
            "type": "string"
          }
        },
        "required": [
          "error",
          "requestId"
        ],
        "additionalProperties": true
      },
      "ConflictErrorResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ErrorResponse"
          },
          {
            "type": "object",
            "properties": {
              "remainingQuota": {
                "type": [
                  "integer",
                  "null"
                ]
              }
            }
          }
        ]
      },
      "ValidationErrorResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ErrorResponse"
          },
          {
            "type": "object",
            "properties": {
              "issues": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "path": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "path",
                    "message"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        ]
      }
    }
  }
}
