{
  "openapi": "3.1.0",
  "info": {
    "title": "Bonga Messaging API",
    "version": "2.0",
    "description": "Discover a sender, choose the supported content type, and track the message. Most v2 sends remain a preview contract until their route is qualified. Managed SMS schedules use the qualified managed outbox when the scheduling rollout flag is enabled. An empty discovery list means no sender matched the selected channel and filters. An optional requests-per-minute limit set on the API key is shared across supported API routes. The /api/v2/otp/verifications operations are a preview that requires an approved live Verify project."
  },
  "servers": [
    {
      "url": "https://api.bonga.africa"
    }
  ],
  "security": [
    {
      "ApiKeyAuth": []
    }
  ],
  "tags": [
    {
      "name": "Sender discovery"
    },
    {
      "name": "Messages"
    },
    {
      "name": "Email"
    },
    {
      "name": "Short links",
      "description": "Branded short links, QR targets and click analytics."
    },
    {
      "name": "OTP and Verify",
      "description": "Customer OTP verification (preview) on an approved live project."
    }
  ],
  "paths": {
    "/api/v2/email/sending-limits": {
      "get": {
        "tags": [
          "Email"
        ],
        "operationId": "getEmailSendingLimits",
        "summary": "Read email sending limits",
        "description": "Requires `email:limits:read`. Reports the effective billing workspace's current UTC-day email plan cap and counter. A null cap means no plan daily cap; usage is not reported for uncapped plans. This does not grant sending access or report wallet balances, provider pacing, or sender reputation.",
        "responses": {
          "200": {
            "description": "Current email plan limits.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "daily_cap": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "used": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "remaining": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "resets_at": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        }
                      },
                      "required": [
                        "daily_cap",
                        "used",
                        "remaining",
                        "resets_at"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                },
                "example": {
                  "success": true,
                  "message": "Email sending limits",
                  "data": {
                    "daily_cap": 500,
                    "used": 25,
                    "remaining": 475,
                    "resets_at": "2026-12-01T00:00:00Z"
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "401": {
            "description": "Missing, expired or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the required permission. Error codes: PERMISSION_DENIED.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "The service is temporarily unavailable. Error codes: EMAIL_LIMITS_UNAVAILABLE, UNAVAILABLE.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/senders": {
      "get": {
        "tags": [
          "Sender discovery"
        ],
        "operationId": "listSenders",
        "summary": "List senders",
        "description": "Requires `messages:read`. Match `connection_id` to the connection for a device or account. Configured identities marked `not_qualified` cannot submit preview messages.",
        "parameters": [
          {
            "name": "channel",
            "in": "query",
            "description": "Filter by channel. Omission selects SMS. Disabled channels are refused.",
            "schema": {
              "type": "string",
              "enum": [
                "sms",
                "whatsapp",
                "email"
              ],
              "default": "sms"
            }
          },
          {
            "name": "connection_id",
            "in": "query",
            "description": "Return only the connection with this ID and, where applicable, its senders.",
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          },
          {
            "name": "type",
            "in": "query",
            "description": "Exact sender type from discovery, such as `sim`. Does not filter the connections array.",
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Scoped senders and connections.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "senders": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Sender"
                          }
                        },
                        "connections": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Connection"
                          }
                        }
                      },
                      "required": [
                        "senders",
                        "connections"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                },
                "example": {
                  "success": true,
                  "message": "Senders discovered",
                  "data": {
                    "senders": [
                      {
                        "id": "snd_cfgsample1",
                        "channel": "sms",
                        "type": "sim",
                        "label": "SIM 1",
                        "slot": 1,
                        "connection_id": "con_cfg_example",
                        "ready": false,
                        "readiness_reason": "not_qualified",
                        "content_types": [],
                        "receive": false,
                        "receipts": false
                      },
                      {
                        "id": "snd_cfgsample2",
                        "channel": "sms",
                        "type": "sim",
                        "label": "SIM 2",
                        "slot": 2,
                        "connection_id": "con_cfg_example",
                        "ready": false,
                        "readiness_reason": "not_qualified",
                        "content_types": [],
                        "receive": false,
                        "receipts": false
                      }
                    ],
                    "connections": [
                      {
                        "id": "con_cfg_example",
                        "channel": "sms",
                        "kind": "android_sim",
                        "label": "Dispatch phone",
                        "ready": false,
                        "readiness_reason": "not_qualified"
                      }
                    ]
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "400": {
            "description": "Invalid request, destination, content, or idempotency key. Error codes: INVALID_DISCOVERY_FILTER.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the required permission. Error codes: PERMISSION_DENIED.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "422": {
            "description": "The requested channel or content is unavailable for this sender. Error codes: CHANNEL_UNQUALIFIED.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "The service is temporarily unavailable. Error codes: DISCOVERY_UNAVAILABLE, UNAVAILABLE.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/connections": {
      "get": {
        "tags": [
          "Sender discovery"
        ],
        "operationId": "listConnections",
        "summary": "List connections",
        "description": "Requires `messages:read`. Connections describe devices and accounts without exposing credentials.",
        "parameters": [
          {
            "name": "channel",
            "in": "query",
            "description": "Filter by channel. Omission selects SMS. Disabled channels are refused.",
            "schema": {
              "type": "string",
              "enum": [
                "sms",
                "whatsapp",
                "email"
              ],
              "default": "sms"
            }
          },
          {
            "name": "connection_id",
            "in": "query",
            "description": "Return only the connection with this ID and, where applicable, its senders.",
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Scoped connections.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Connection"
                      }
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                },
                "example": {
                  "success": true,
                  "message": "Connections discovered",
                  "data": [
                    {
                      "id": "con_cfg_example",
                      "channel": "sms",
                      "kind": "android_sim",
                      "label": "Dispatch phone",
                      "ready": false,
                      "readiness_reason": "not_qualified"
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "400": {
            "description": "Invalid request, destination, content, or idempotency key. Error codes: INVALID_DISCOVERY_FILTER.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the required permission. Error codes: PERMISSION_DENIED.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "422": {
            "description": "The requested channel or content is unavailable for this sender. Error codes: CHANNEL_UNQUALIFIED.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "The service is temporarily unavailable. Error codes: DISCOVERY_UNAVAILABLE, UNAVAILABLE.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/messages": {
      "post": {
        "tags": [
          "Messages"
        ],
        "operationId": "submitMessage",
        "summary": "Submit one message (preview)",
        "description": "Requires `messages:send`. Replace the example `from` with a ready sender ID from discovery. Replay the same key and payload to return the existing message. The preview also refuses identical normalized payloads under different keys in the same workspace. Availability is restricted to configured preview routes. The JSON body is limited to 32 KiB. A queued message has not been sent. Each newly accepted recipient counts once toward the API key's optional workspace-local daily quota.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "8–200 visible ASCII characters. Keep the same key and payload on retries.",
            "schema": {
              "type": "string",
              "pattern": "^[!-~]{8,200}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "channel": {
                        "const": "sms"
                      },
                      "from": {
                        "type": "string",
                        "pattern": "^snd_[a-z0-9]{8,40}$",
                        "description": "Opaque ID of a ready sender returned by discovery."
                      },
                      "to": {
                        "type": "string",
                        "pattern": "^\\+[1-9][0-9]{6,14}$",
                        "description": "One recipient: an email address for email, or an E.164 number for SMS and WhatsApp."
                      },
                      "content": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "const": "text"
                          },
                          "text": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 1600
                          }
                        },
                        "required": [
                          "type",
                          "text"
                        ],
                        "additionalProperties": false,
                        "description": "Use a content type listed by the selected sender."
                      },
                      "purpose": {
                        "enum": [
                          "transactional",
                          "marketing",
                          "support",
                          "authentication"
                        ],
                        "default": "transactional",
                        "description": "Purpose used to apply sender and content policy."
                      }
                    },
                    "required": [
                      "channel",
                      "from",
                      "to",
                      "content"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "channel": {
                        "const": "whatsapp"
                      },
                      "from": {
                        "type": "string",
                        "pattern": "^snd_[a-z0-9]{8,40}$",
                        "description": "Opaque ID of a ready sender returned by discovery."
                      },
                      "to": {
                        "type": "string",
                        "pattern": "^\\+[1-9][0-9]{6,14}$",
                        "description": "One recipient: an email address for email, or an E.164 number for SMS and WhatsApp."
                      },
                      "content": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "const": "text"
                          },
                          "text": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 1600
                          }
                        },
                        "required": [
                          "type",
                          "text"
                        ],
                        "additionalProperties": false,
                        "description": "Use a content type listed by the selected sender."
                      },
                      "purpose": {
                        "enum": [
                          "transactional",
                          "marketing",
                          "support",
                          "authentication"
                        ],
                        "default": "transactional",
                        "description": "Purpose used to apply sender and content policy."
                      }
                    },
                    "required": [
                      "channel",
                      "from",
                      "to",
                      "content"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "channel": {
                        "const": "whatsapp"
                      },
                      "from": {
                        "type": "string",
                        "pattern": "^snd_[a-z0-9]{8,40}$",
                        "description": "Opaque ID of a ready sender returned by discovery."
                      },
                      "to": {
                        "type": "string",
                        "pattern": "^\\+[1-9][0-9]{6,14}$",
                        "description": "One recipient: an email address for email, or an E.164 number for SMS and WhatsApp."
                      },
                      "content": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "const": "template"
                          },
                          "template_id": {
                            "type": "string",
                            "pattern": "^[a-z0-9_.-]{3,64}$"
                          },
                          "parameters": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 1600
                            },
                            "maxItems": 10
                          }
                        },
                        "required": [
                          "type",
                          "template_id"
                        ],
                        "additionalProperties": false,
                        "description": "Use a content type listed by the selected sender."
                      },
                      "purpose": {
                        "enum": [
                          "transactional",
                          "marketing",
                          "support",
                          "authentication"
                        ],
                        "default": "transactional",
                        "description": "Purpose used to apply sender and content policy."
                      }
                    },
                    "required": [
                      "channel",
                      "from",
                      "to",
                      "content"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "channel": {
                        "const": "email"
                      },
                      "from": {
                        "type": "string",
                        "pattern": "^snd_[a-z0-9]{8,40}$",
                        "description": "Opaque ID of a ready sender returned by discovery."
                      },
                      "to": {
                        "type": "string",
                        "format": "email",
                        "maxLength": 254,
                        "description": "One recipient: an email address for email, or an E.164 number for SMS and WhatsApp."
                      },
                      "content": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "const": "email"
                          },
                          "subject": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                          },
                          "text": {
                            "type": "string",
                            "maxLength": 20000
                          },
                          "html": {
                            "type": "string",
                            "maxLength": 20000
                          }
                        },
                        "required": [
                          "type",
                          "subject"
                        ],
                        "additionalProperties": false,
                        "anyOf": [
                          {
                            "required": [
                              "text"
                            ],
                            "properties": {
                              "text": {
                                "pattern": "\\S"
                              }
                            }
                          },
                          {
                            "required": [
                              "html"
                            ],
                            "properties": {
                              "html": {
                                "pattern": "\\S"
                              }
                            }
                          }
                        ],
                        "description": "Use a content type listed by the selected sender."
                      },
                      "purpose": {
                        "enum": [
                          "transactional",
                          "marketing",
                          "support",
                          "authentication"
                        ],
                        "default": "transactional",
                        "description": "Purpose used to apply sender and content policy."
                      }
                    },
                    "required": [
                      "channel",
                      "from",
                      "to",
                      "content"
                    ],
                    "additionalProperties": false
                  }
                ]
              },
              "examples": {
                "sms": {
                  "value": {
                    "channel": "sms",
                    "from": "snd_example01",
                    "to": "+254712345678",
                    "content": {
                      "type": "text",
                      "text": "Your order is ready."
                    }
                  }
                },
                "linkedWhatsApp": {
                  "value": {
                    "channel": "whatsapp",
                    "from": "snd_example02",
                    "to": "+254712345678",
                    "content": {
                      "type": "text",
                      "text": "Your order is ready."
                    }
                  }
                },
                "whatsAppTemplate": {
                  "value": {
                    "channel": "whatsapp",
                    "from": "snd_example03",
                    "to": "+254712345678",
                    "content": {
                      "type": "template",
                      "template_id": "order_ready"
                    }
                  }
                },
                "email": {
                  "value": {
                    "channel": "email",
                    "from": "snd_example04",
                    "to": "customer@example.com",
                    "content": {
                      "type": "email",
                      "subject": "Order ready",
                      "text": "Your order is ready.",
                      "html": "<p>Your order is <strong>ready</strong>.</p>"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Durable acceptance in the preview, with no guarantee of provider handoff.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Message"
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                },
                "example": {
                  "success": true,
                  "message": "Message queued",
                  "data": {
                    "id": "msg_0123456789abcdef",
                    "channel": "sms",
                    "sender_id": "snd_example01",
                    "destination": "+254712345678",
                    "status": "queued",
                    "revision": 1,
                    "purpose": "transactional",
                    "created_at": "2026-11-29T09:30:00Z",
                    "updated_at": "2026-11-29T09:30:00Z"
                  }
                }
              }
            },
            "headers": {
              "Location": {
                "description": "Path for reading this message.",
                "schema": {
                  "type": "string"
                }
              },
              "Idempotent-Replay": {
                "description": "Present with value true on replay.",
                "schema": {
                  "type": "string",
                  "const": "true"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/MessageAdmissionLimited"
          },
          "400": {
            "description": "Invalid request, destination, content, or idempotency key. Error codes: INVALID_IDEMPOTENCY_KEY, INVALID_REQUEST, INVALID_CHANNEL, INVALID_SENDER, INVALID_DESTINATION, INVALID_CONTENT, INVALID_PURPOSE.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the required permission. Error codes: PERMISSION_DENIED.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "The resource is unknown or inaccessible. Error codes: SENDER_NOT_FOUND.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "The sender is not ready, or the preview rejected an idempotency conflict. Error codes: SENDER_NOT_READY, IDEMPOTENCY_CONFLICT.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "422": {
            "description": "The requested channel or content is unavailable for this sender. Error codes: CHANNEL_UNQUALIFIED, CONTENT_UNQUALIFIED, TEMPLATE_UNQUALIFIED, INTENT_REFUSED.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "The service is temporarily unavailable. Error codes: SENDER_UNAVAILABLE, CAPABILITY_UNAVAILABLE, ACCEPTANCE_UNAVAILABLE, UNAVAILABLE.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/messages/{id}": {
      "get": {
        "tags": [
          "Messages"
        ],
        "operationId": "getMessage",
        "summary": "Track a message",
        "description": "Requires `messages:read`. Use the path returned in `Location`; unknown and inaccessible messages both return 404.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Message ID from the submission response or its Location header.",
            "schema": {
              "type": "string",
              "pattern": "^msg_[a-f0-9]{16,64}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current evidence-based status.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Message"
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                },
                "example": {
                  "success": true,
                  "message": "Message status",
                  "data": {
                    "id": "msg_0123456789abcdef",
                    "channel": "sms",
                    "sender_id": "snd_example01",
                    "destination": "+254712345678",
                    "status": "queued",
                    "revision": 1,
                    "purpose": "transactional",
                    "created_at": "2026-11-29T09:30:00Z",
                    "updated_at": "2026-11-29T09:30:00Z"
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "400": {
            "description": "Invalid request, destination, content, or idempotency key. Error codes: INVALID_MESSAGE_ID.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the required permission. Error codes: PERMISSION_DENIED.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "The resource is unknown or inaccessible. Error codes: NOT_FOUND.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "The service is temporarily unavailable. Error codes: STATUS_UNAVAILABLE, UNAVAILABLE.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/messages/scheduled": {
      "post": {
        "tags": [
          "Messages"
        ],
        "operationId": "scheduleManagedSMS",
        "summary": "Schedule one managed SMS",
        "description": "Requires `messages:send` and the managed scheduling rollout flag. The sender must be a ready managed SMS sender. `send_at` is one minute through 365 days ahead; the sender, API-key scope, consent and opt-out state are rechecked before dispatch. The daily key quota counts the recipient on acceptance, not at dispatch. Cancelling does not return daily key quota.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[!-~]{8,200}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "channel",
                  "from",
                  "to",
                  "content",
                  "send_at"
                ],
                "properties": {
                  "channel": {
                    "const": "sms"
                  },
                  "from": {
                    "type": "string"
                  },
                  "to": {
                    "type": "string",
                    "pattern": "^\\+[1-9][0-9]{6,14}$"
                  },
                  "content": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "const": "text"
                      },
                      "text": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 1600
                      }
                    },
                    "required": [
                      "type",
                      "text"
                    ],
                    "additionalProperties": false
                  },
                  "send_at": {
                    "type": "string",
                    "format": "date-time"
                  }
                }
              },
              "example": {
                "channel": "sms",
                "from": "snd_example01",
                "to": "+254712345678",
                "content": {
                  "type": "text",
                  "text": "Your appointment is tomorrow."
                },
                "send_at": "2027-01-15T09:00:00Z"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Managed SMS schedule accepted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/ScheduledMessage"
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/MessageAdmissionLimited"
          },
          "400": {
            "description": "Invalid request, destination, content, or idempotency key. Error codes: INVALID_IDEMPOTENCY_KEY, INVALID_REQUEST, INVALID_SENDER, INVALID_DESTINATION, INVALID_CONTENT, INVALID_SCHEDULE_TIME.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks the required permission. Error codes: PERMISSION_DENIED.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "The resource is unknown or inaccessible. Error codes: SENDER_NOT_FOUND.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "The sender is not ready, or the preview rejected an idempotency conflict. Error codes: IDEMPOTENCY_CONFLICT.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "422": {
            "description": "The requested channel or content is unavailable for this sender. Error codes: SCHEDULE_UNQUALIFIED.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "The service is temporarily unavailable. Error codes: SCHEDULE_UNAVAILABLE, SENDER_UNAVAILABLE, UNAVAILABLE.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Messages"
        ],
        "operationId": "listScheduledMessages",
        "summary": "List scheduled managed SMS",
        "description": "Requires `messages:read`. Results are bounded and workspace scoped.",
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Scheduled SMS messages.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/ScheduledMessage"
                          }
                        },
                        "next_cursor": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "items"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "The service is temporarily unavailable. Error codes: UNAVAILABLE.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/links": {
      "get": {
        "tags": [
          "Short links"
        ],
        "operationId": "listShortLinks",
        "summary": "List short links",
        "description": "Requires the links:read scope. Results are bounded to the key's workspace and newest first. Pass the last link's created_at value as before to page.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "RFC3339 cursor from the previous page."
          }
        ],
        "responses": {
          "200": {
            "description": "Workspace short links, newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "message",
                    "data"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ShortLink"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the required scope or the short-link pilot is disabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Short links"
        ],
        "operationId": "createShortLink",
        "summary": "Create a short link",
        "description": "Requires links:write. A repeated Idempotency-Key with the same payload returns the existing link; a changed payload conflicts. The destination must be an http(s) URL outside the short-link host.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9._:-]{1,128}$"
            },
            "description": "Unique operation key; reuse it with the same payload on retry."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ShortLinkInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Link created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShortLinkEnvelope"
                }
              }
            }
          },
          "200": {
            "description": "Idempotent replay.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShortLinkEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Invalid destination, path or expiry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the required scope or the short-link pilot is disabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Idempotency conflict.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/links/{id}/disable": {
      "post": {
        "tags": [
          "Short links"
        ],
        "operationId": "disableShortLink",
        "summary": "Disable a short link",
        "description": "Requires links:write. The link stops redirecting immediately; existing printed copies remain valid only if renewed.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Link disabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShortLinkEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the required scope or the short-link pilot is disabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "The link is unknown or in another workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/links/{id}/renew": {
      "post": {
        "tags": [
          "Short links"
        ],
        "operationId": "renewShortLink",
        "summary": "Renew a short link",
        "description": "Requires links:write. Renewal applies the current plan policy and may extend or shorten the expiry.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Link renewed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShortLinkEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the required scope or the short-link pilot is disabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "The link is unknown or in another workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/otp/verifications": {
      "post": {
        "tags": [
          "OTP and Verify"
        ],
        "operationId": "startOtpVerification",
        "summary": "Start an OTP verification (preview)",
        "description": "Live customer Verify is a preview. It is available only on a deployment with the live preview enabled and a project whose delivery policy an operator approved in the admin console. Codes, destinations and provider responses are never returned. A queued handoff is not proof of delivery. Requires the otp:send scope and an Idempotency-Key. A code is generated server-side and delivered through the approved channel.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "8–200 visible ASCII characters. Replay the same key and body to return the stored result.",
            "schema": {
              "type": "string",
              "pattern": "^[!-~]{8,200}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "project_id": {
                    "type": "string",
                    "description": "Optional live project selector; the key already pins its project."
                  },
                  "goal": {
                    "type": "string",
                    "enum": [
                      "email_possession",
                      "phone_possession"
                    ]
                  },
                  "purpose": {
                    "type": "string",
                    "enum": [
                      "sign_up",
                      "sign_in",
                      "password_reset"
                    ]
                  },
                  "subject_id": {
                    "type": "string",
                    "pattern": "^[!-~]{1,256}$",
                    "description": "Your own opaque subject binding, such as a session id."
                  },
                  "destination": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "email",
                          "phone"
                        ]
                      },
                      "value": {
                        "type": "string",
                        "description": "A bare email address for email, or an E.164 number for phone."
                      }
                    },
                    "required": [
                      "type",
                      "value"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "goal",
                  "purpose",
                  "subject_id",
                  "destination"
                ],
                "additionalProperties": false
              },
              "example": {
                "goal": "phone_possession",
                "purpose": "sign_up",
                "subject_id": "opaque-signup-session",
                "destination": {
                  "type": "phone",
                  "value": "+254712345678"
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Durable acceptance; the code is being delivered.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "pattern": "^ver_[A-Z2-7]{26}$"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "pending",
                            "approved",
                            "failed",
                            "expired",
                            "cancelled"
                          ]
                        },
                        "goal": {
                          "type": "string",
                          "enum": [
                            "email_possession",
                            "phone_possession"
                          ]
                        },
                        "environment": {
                          "type": "string",
                          "const": "live"
                        },
                        "expires_at": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "delivery_status": {
                          "type": "string",
                          "enum": [
                            "queued",
                            "claimed",
                            "accepted",
                            "submission_unknown",
                            "not_submitted",
                            "rejected"
                          ],
                          "description": "Provider submission state across all handoffs; never proof of receipt."
                        },
                        "resend_available_at": {
                          "type": "string",
                          "format": "date-time",
                          "description": "Present while another handoff is still allowed."
                        },
                        "handoffs_remaining": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 2
                        }
                      },
                      "required": [
                        "id",
                        "status",
                        "goal",
                        "environment",
                        "expires_at",
                        "handoffs_remaining"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request, destination, purpose or Idempotency-Key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired or invalid project key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            }
          },
          "402": {
            "description": "The workspace has no prepaid unit for the selected channel.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the required scope, or no effective delivery policy resolves for the project.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "The verification is unknown to this project.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "Idempotency conflict, a verification already pending, delivery pending, or a resend limit.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "422": {
            "description": "Invalid Verify request or incorrect code.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Request limit or resend cooldown; respect Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            }
          },
          "503": {
            "description": "Verify is temporarily unavailable; retry the same command key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/otp/verifications/{id}": {
      "get": {
        "tags": [
          "OTP and Verify"
        ],
        "operationId": "getOtpVerification",
        "summary": "Read an OTP verification (preview)",
        "description": "Live customer Verify is a preview. It is available only on a deployment with the live preview enabled and a project whose delivery policy an operator approved in the admin console. Codes, destinations and provider responses are never returned. A queued handoff is not proof of delivery. Requires the otp:read scope and the X-Verify-Purpose and X-Verify-Subject headers from start.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^ver_[A-Z2-7]{26}$"
            }
          },
          {
            "name": "X-Verify-Purpose",
            "in": "header",
            "required": true,
            "description": "The challenge purpose used at start.",
            "schema": {
              "type": "string",
              "enum": [
                "sign_up",
                "sign_in",
                "password_reset"
              ]
            }
          },
          {
            "name": "X-Verify-Subject",
            "in": "header",
            "required": true,
            "description": "The subject_id used at start.",
            "schema": {
              "type": "string",
              "pattern": "^[!-~]{1,256}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Masked verification status.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "pattern": "^ver_[A-Z2-7]{26}$"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "pending",
                            "approved",
                            "failed",
                            "expired",
                            "cancelled"
                          ]
                        },
                        "goal": {
                          "type": "string",
                          "enum": [
                            "email_possession",
                            "phone_possession"
                          ]
                        },
                        "environment": {
                          "type": "string",
                          "const": "live"
                        },
                        "expires_at": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "delivery_status": {
                          "type": "string",
                          "enum": [
                            "queued",
                            "claimed",
                            "accepted",
                            "submission_unknown",
                            "not_submitted",
                            "rejected"
                          ],
                          "description": "Provider submission state across all handoffs; never proof of receipt."
                        },
                        "resend_available_at": {
                          "type": "string",
                          "format": "date-time",
                          "description": "Present while another handoff is still allowed."
                        },
                        "handoffs_remaining": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 2
                        }
                      },
                      "required": [
                        "id",
                        "status",
                        "goal",
                        "environment",
                        "expires_at",
                        "handoffs_remaining"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired or invalid project key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the required scope, or no effective delivery policy resolves for the project.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "The verification is unknown to this project.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "Idempotency conflict, a verification already pending, delivery pending, or a resend limit.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "Verify is temporarily unavailable; retry the same command key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/otp/verifications/{id}/check": {
      "post": {
        "tags": [
          "OTP and Verify"
        ],
        "operationId": "checkOtpVerification",
        "summary": "Check a submitted code (preview)",
        "description": "Live customer Verify is a preview. It is available only on a deployment with the live preview enabled and a project whose delivery policy an operator approved in the admin console. Codes, destinations and provider responses are never returned. A queued handoff is not proof of delivery. Requires the otp:verify scope and a fresh Idempotency-Key per user-entered answer. Only an approved result authorizes an action on your server.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^ver_[A-Z2-7]{26}$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "8–200 visible ASCII characters. Replay the same key and body to return the stored result.",
            "schema": {
              "type": "string",
              "pattern": "^[!-~]{8,200}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "purpose": {
                    "type": "string",
                    "enum": [
                      "sign_up",
                      "sign_in",
                      "password_reset"
                    ]
                  },
                  "subject_id": {
                    "type": "string",
                    "pattern": "^[!-~]{1,256}$"
                  },
                  "code": {
                    "type": "string",
                    "pattern": "^[0-9]{6}$",
                    "description": "Preserve leading zeroes."
                  }
                },
                "required": [
                  "purpose",
                  "subject_id",
                  "code"
                ],
                "additionalProperties": false
              },
              "example": {
                "purpose": "sign_up",
                "subject_id": "opaque-signup-session",
                "code": "004271"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Approved verification.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "pattern": "^ver_[A-Z2-7]{26}$"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "pending",
                            "approved",
                            "failed",
                            "expired",
                            "cancelled"
                          ]
                        },
                        "goal": {
                          "type": "string",
                          "enum": [
                            "email_possession",
                            "phone_possession"
                          ]
                        },
                        "environment": {
                          "type": "string",
                          "const": "live"
                        },
                        "expires_at": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "delivery_status": {
                          "type": "string",
                          "enum": [
                            "queued",
                            "claimed",
                            "accepted",
                            "submission_unknown",
                            "not_submitted",
                            "rejected"
                          ],
                          "description": "Provider submission state across all handoffs; never proof of receipt."
                        },
                        "resend_available_at": {
                          "type": "string",
                          "format": "date-time",
                          "description": "Present while another handoff is still allowed."
                        },
                        "handoffs_remaining": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 2
                        }
                      },
                      "required": [
                        "id",
                        "status",
                        "goal",
                        "environment",
                        "expires_at",
                        "handoffs_remaining"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired or invalid project key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the required scope, or no effective delivery policy resolves for the project.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "The verification is unknown to this project.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "Verification is no longer pending, or delivery is still pending; respect Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            }
          },
          "422": {
            "description": "Incorrect code; leading zeroes are significant.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Request limit or resend cooldown; respect Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "Verify is temporarily unavailable; retry the same command key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/otp/verifications/{id}/cancel": {
      "post": {
        "tags": [
          "OTP and Verify"
        ],
        "operationId": "cancelOtpVerification",
        "summary": "Cancel an OTP verification (preview)",
        "description": "Live customer Verify is a preview. It is available only on a deployment with the live preview enabled and a project whose delivery policy an operator approved in the admin console. Codes, destinations and provider responses are never returned. A queued handoff is not proof of delivery. Requires the otp:cancel scope and an Idempotency-Key. It can stop queued work but cannot recall a message a provider already accepted.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^ver_[A-Z2-7]{26}$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "8–200 visible ASCII characters. Replay the same key and body to return the stored result.",
            "schema": {
              "type": "string",
              "pattern": "^[!-~]{8,200}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "purpose": {
                    "type": "string",
                    "enum": [
                      "sign_up",
                      "sign_in",
                      "password_reset"
                    ]
                  },
                  "subject_id": {
                    "type": "string",
                    "pattern": "^[!-~]{1,256}$"
                  }
                },
                "required": [
                  "purpose",
                  "subject_id"
                ],
                "additionalProperties": false
              },
              "example": {
                "purpose": "sign_up",
                "subject_id": "opaque-signup-session"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verification cancelled.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "pattern": "^ver_[A-Z2-7]{26}$"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "pending",
                            "approved",
                            "failed",
                            "expired",
                            "cancelled"
                          ]
                        },
                        "goal": {
                          "type": "string",
                          "enum": [
                            "email_possession",
                            "phone_possession"
                          ]
                        },
                        "environment": {
                          "type": "string",
                          "const": "live"
                        },
                        "expires_at": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "delivery_status": {
                          "type": "string",
                          "enum": [
                            "queued",
                            "claimed",
                            "accepted",
                            "submission_unknown",
                            "not_submitted",
                            "rejected"
                          ],
                          "description": "Provider submission state across all handoffs; never proof of receipt."
                        },
                        "resend_available_at": {
                          "type": "string",
                          "format": "date-time",
                          "description": "Present while another handoff is still allowed."
                        },
                        "handoffs_remaining": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 2
                        }
                      },
                      "required": [
                        "id",
                        "status",
                        "goal",
                        "environment",
                        "expires_at",
                        "handoffs_remaining"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired or invalid project key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the required scope, or no effective delivery policy resolves for the project.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "The verification is unknown to this project.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "Verification is no longer pending.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "Verify is temporarily unavailable; retry the same command key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/otp/verifications/{id}/resend": {
      "post": {
        "tags": [
          "OTP and Verify"
        ],
        "operationId": "resendOtpVerification",
        "summary": "Resend an OTP verification (preview)",
        "description": "Live customer Verify is a preview. It is available only on a deployment with the live preview enabled and a project whose delivery policy an operator approved in the admin console. Codes, destinations and provider responses are never returned. A queued handoff is not proof of delivery. Requires the otp:send scope and an Idempotency-Key. It reuses the code, expiry and pinned route, queues one more handoff and charges one more prepaid unit. Rules: pending and not expired; at least 30 seconds since the last handoff (429 RESEND_COOLDOWN); the previous handoff is not queued or claimed (409 OTP_DELIVERY_PENDING); at most three handoffs per challenge (409 OTP_RESEND_LIMIT); more than 60 seconds of lifetime (409 OTP_NOT_PENDING); the effective policy still resolves the same route (403 OTP_ROUTE_UNAVAILABLE); and a funded unit (402). A replay with the same key and body returns the stored result without another handoff or charge.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^ver_[A-Z2-7]{26}$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "8–200 visible ASCII characters. Replay the same key and body to return the stored result.",
            "schema": {
              "type": "string",
              "pattern": "^[!-~]{8,200}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "purpose": {
                    "type": "string",
                    "enum": [
                      "sign_up",
                      "sign_in",
                      "password_reset"
                    ]
                  },
                  "subject_id": {
                    "type": "string",
                    "pattern": "^[!-~]{1,256}$"
                  }
                },
                "required": [
                  "purpose",
                  "subject_id"
                ],
                "additionalProperties": false
              },
              "example": {
                "purpose": "sign_up",
                "subject_id": "opaque-signup-session"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Another handoff queued with the same code and expiry.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "pattern": "^ver_[A-Z2-7]{26}$"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "pending",
                            "approved",
                            "failed",
                            "expired",
                            "cancelled"
                          ]
                        },
                        "goal": {
                          "type": "string",
                          "enum": [
                            "email_possession",
                            "phone_possession"
                          ]
                        },
                        "environment": {
                          "type": "string",
                          "const": "live"
                        },
                        "expires_at": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "delivery_status": {
                          "type": "string",
                          "enum": [
                            "queued",
                            "claimed",
                            "accepted",
                            "submission_unknown",
                            "not_submitted",
                            "rejected"
                          ],
                          "description": "Provider submission state across all handoffs; never proof of receipt."
                        },
                        "resend_available_at": {
                          "type": "string",
                          "format": "date-time",
                          "description": "Present while another handoff is still allowed."
                        },
                        "handoffs_remaining": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 2
                        }
                      },
                      "required": [
                        "id",
                        "status",
                        "goal",
                        "environment",
                        "expires_at",
                        "handoffs_remaining"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired or invalid project key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ]
                }
              }
            }
          },
          "402": {
            "description": "The workspace has no prepaid unit for the selected channel.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the required scope, or no effective delivery policy resolves for the project.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "The verification is unknown to this project.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "OTP_DELIVERY_PENDING, OTP_RESEND_LIMIT, OTP_NOT_PENDING or an idempotency conflict.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait when delivery is still pending.",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            }
          },
          "429": {
            "description": "RESEND_COOLDOWN or OTP_RATE_LIMITED; respect Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            }
          },
          "503": {
            "description": "Verify is temporarily unavailable; retry the same command key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/messages/scheduled/{id}": {
      "get": {
        "tags": [
          "Messages"
        ],
        "operationId": "getScheduledMessage",
        "summary": "Get a scheduled managed SMS",
        "description": "Requires `messages:read`. Returns the scheduled message, its send time, provider state and whether it can still be cancelled.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^msg_[a-f0-9]{16,64}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Scheduled SMS status.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/ScheduledMessage"
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "The service is temporarily unavailable. Error codes: UNAVAILABLE.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Messages"
        ],
        "operationId": "cancelScheduledMessage",
        "summary": "Cancel a scheduled managed SMS",
        "description": "Requires `messages:send`. Cancels a schedule before dispatch. Cancelling does not return the daily API-key quota already counted at acceptance.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^msg_[a-f0-9]{16,64}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Scheduled SMS cancelled.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/ScheduledMessage"
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "description": "The service is temporarily unavailable. Error codes: UNAVAILABLE.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code"
                          ]
                        },
                        "request_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "error",
                        "request_id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Use a scoped Bonga API key."
      }
    },
    "responses": {
      "RateLimited": {
        "description": "The configured API key request budget is exhausted. Error code: RATE_LIMITED.",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "success": {
                  "type": "boolean"
                },
                "message": {
                  "type": "string"
                },
                "data": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code"
                      ]
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error",
                    "request_id"
                  ]
                }
              },
              "required": [
                "success",
                "message",
                "data"
              ]
            }
          }
        },
        "headers": {
          "Retry-After": {
            "description": "Seconds until the current request window expires.",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        }
      },
      "MessageAdmissionLimited": {
        "description": "The API key request rate or accepted-recipient quota is exhausted. Error codes: RATE_LIMITED, API_KEY_DAILY_QUOTA_EXCEEDED.",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "success": {
                  "type": "boolean"
                },
                "message": {
                  "type": "string"
                },
                "data": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code"
                      ]
                    },
                    "request_id": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error",
                    "request_id"
                  ]
                }
              },
              "required": [
                "success",
                "message",
                "data"
              ]
            }
          }
        },
        "headers": {
          "Retry-After": {
            "description": "Seconds until the request window expires or the next workspace-local midnight.",
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          }
        }
      }
    },
    "schemas": {
      "Sender": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^snd_[a-z0-9]{8,40}$"
          },
          "channel": {
            "type": "string",
            "enum": [
              "sms",
              "whatsapp",
              "email"
            ]
          },
          "type": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "address": {
            "type": "string",
            "description": "Display address when known."
          },
          "slot": {
            "type": "integer",
            "description": "SIM slot when reported. Send using the sender ID, not the slot."
          },
          "connection_id": {
            "type": "string"
          },
          "ready": {
            "type": "boolean"
          },
          "readiness_reason": {
            "const": "not_qualified",
            "description": "Configured in the workspace; unavailable for v2 submission."
          },
          "content_types": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "receive": {
            "type": "boolean"
          },
          "receipts": {
            "type": "boolean"
          },
          "can_schedule": {
            "type": "boolean",
            "description": "Managed SMS scheduling is enabled for this sender."
          }
        },
        "required": [
          "id",
          "channel",
          "type",
          "label",
          "connection_id",
          "ready",
          "content_types",
          "receive",
          "receipts"
        ]
      },
      "Connection": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "channel": {
            "type": "string",
            "enum": [
              "sms",
              "whatsapp",
              "email"
            ]
          },
          "kind": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "ready": {
            "type": "boolean"
          },
          "readiness_reason": {
            "const": "not_qualified",
            "description": "Configured in the workspace; unavailable for v2 submission."
          },
          "revision": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "channel",
          "kind",
          "label",
          "ready"
        ]
      },
      "Message": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^msg_[a-f0-9]{16,64}$"
          },
          "workspace_id": {
            "type": "string"
          },
          "channel": {
            "type": "string",
            "enum": [
              "sms",
              "whatsapp",
              "email"
            ]
          },
          "sender_id": {
            "type": "string",
            "pattern": "^snd_[a-z0-9]{8,40}$"
          },
          "connection_id": {
            "type": "string"
          },
          "destination": {
            "type": "string"
          },
          "revision": {
            "type": "integer"
          },
          "purpose": {
            "type": "string"
          },
          "error": {
            "type": "object"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "enum": [
              "queued",
              "sent",
              "delivered",
              "read",
              "failed",
              "submission_unknown"
            ]
          }
        },
        "required": [
          "id",
          "channel",
          "sender_id",
          "destination",
          "revision",
          "status",
          "created_at",
          "updated_at"
        ]
      },
      "ScheduledMessage": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^msg_[a-f0-9]{16,64}$"
          },
          "channel": {
            "const": "sms"
          },
          "sender_id": {
            "type": "string",
            "pattern": "^snd_[a-z0-9]{8,40}$"
          },
          "connection_id": {
            "type": "string"
          },
          "destination": {
            "type": "string",
            "pattern": "^\\+[1-9][0-9]{6,14}$"
          },
          "status": {
            "enum": [
              "scheduled",
              "sent",
              "delivered",
              "read",
              "cancelled",
              "dispatching",
              "failed",
              "submission_unknown"
            ]
          },
          "send_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "can_cancel": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "channel",
          "sender_id",
          "destination",
          "status",
          "send_at",
          "created_at",
          "updated_at",
          "can_cancel"
        ]
      },
      "ShortLinkInput": {
        "type": "object",
        "required": [
          "destination"
        ],
        "properties": {
          "destination": {
            "type": "string",
            "format": "uri",
            "description": "HTTPS destination outside the short-link host."
          },
          "hostname": {
            "type": "string",
            "description": "One of the workspace's approved short-link hostnames."
          },
          "expiry_days": {
            "type": "integer",
            "minimum": 0,
            "maximum": 3650
          },
          "path": {
            "type": "string",
            "description": "Optional custom path."
          }
        },
        "additionalProperties": false
      },
      "ShortLink": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "The branded short URL to publish."
          },
          "destination": {
            "type": "string",
            "format": "uri"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "disabled_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Null while the link is active."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "grace_days": {
            "type": "integer"
          },
          "private_asset": {
            "type": "boolean"
          },
          "analytics": {
            "type": "boolean"
          }
        }
      },
      "ShortLinkEnvelope": {
        "type": "object",
        "required": [
          "success",
          "message",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean"
          },
          "message": {
            "type": "string"
          },
          "data": {
            "$ref": "#/components/schemas/ShortLink"
          }
        }
      },
      "ErrorEnvelope": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "message": {
            "type": "string"
          },
          "data": {
            "type": "object",
            "properties": {
              "request_id": {
                "type": "string"
              },
              "error": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
