{
  "openapi": "3.0.3",
  "info": {
    "title": "AppHiveSL SMS API",
    "description": "AppHiveSL SMS API v2.0.4. Send single and bulk SMS with Basic Auth (clientid/clientsecret) plus the X-Wallet token header, check delivery status, and fetch your wallet balance.",
    "version": "2.0.4"
  },
  "servers": [
    { "url": "https://api.sierrahive.com", "description": "Production" }
  ],
  "security": [
    { "basicAuth": [] },
    { "walletToken": [] }
  ],
  "tags": [{ "name": "SMS", "description": "SMS sending and status" }],
  "paths": {
    "/v1/messages/sms": {
      "post": {
        "tags": ["SMS"],
        "summary": "Send single SMS (POST)",
        "description": "Send a single SMS with JSON body. Uses Basic Auth (clientid/clientsecret) and X-Wallet: Token header.",
        "operationId": "sendSingleSmsPost",
        "parameters": [
          { "name": "X-Wallet", "in": "header", "required": true, "schema": { "type": "string", "example": "Token YOUR_TOKEN" } }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["From", "To", "Content"],
                "properties": {
                  "From": { "type": "string" },
                  "To": { "type": "string" },
                  "Content": { "type": "string" },
                  "Reference": { "type": "string" },
                  "CallbackUrl": { "type": "string", "format": "uri" }
                }
              }
            }
          }
        },
        "responses": { "200": { "description": "Success" } }
      }
    },
    "/v1/messages/sms/bulk/otm": {
      "post": {
        "tags": ["SMS"],
        "summary": "Send one-to-many (bulk)",
        "description": "One message to many recipients. Basic Auth + X-Wallet header.",
        "operationId": "sendBulkOtm",
        "parameters": [
          { "name": "X-Wallet", "in": "header", "required": true, "schema": { "type": "string", "example": "Token YOUR_TOKEN" } }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["From", "Content", "Recipients"],
                "properties": {
                  "From": { "type": "string" },
                  "Content": { "type": "string" },
                  "CallbackUrl": { "type": "string", "format": "uri" },
                  "Recipients": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": ["To"],
                      "properties": {
                        "To": { "type": "string" },
                        "Reference": { "type": "string" }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": { "200": { "description": "Success" } }
      }
    },
    "/v1/transactions/{ticket}/status": {
      "get": {
        "tags": ["SMS"],
        "summary": "Get message status",
        "description": "Fetch status/details for a ticket returned by send requests. Basic Auth.",
        "operationId": "getMessageStatus",
        "parameters": [
          { "name": "ticket", "in": "path", "required": true, "schema": { "type": "string" } }
        ],
        "responses": { "200": { "description": "Success" } }
      }
    },
    "/v1/account/balance": {
      "get": {
        "tags": ["SMS"],
        "summary": "Get account balance",
        "description": "Fetch current wallet balance. Uses Basic Auth (clientid/clientsecret) and X-Wallet: Token header.",
        "operationId": "getAccountBalance",
        "parameters": [
          { "name": "X-Wallet", "in": "header", "required": true, "schema": { "type": "string", "example": "Token YOUR_TOKEN" } }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "balance": { "type": "number", "example": 774.18 },
                    "currency": { "type": "string", "example": "SLE" },
                    "asOf": { "type": "string", "format": "date-time", "example": "2026-07-21T18:13:58.3306883Z" }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "basicAuth": {
        "type": "http",
        "scheme": "basic",
        "description": "Client ID as username, client secret as password"
      },
      "walletToken": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Wallet",
        "description": "Token YOUR_TOKEN"
      }
    }
  }
}
