{
  "openapi": "3.1.0",
  "info": {
    "title": "WebstudioSMS SMS API",
    "version": "2.0.0",
    "description": "Wholesale SMS Gateway API for sending messages, checking delivery status, and monitoring account balance."
  },
  "servers": [
    {
      "url": "https://sms.webstudiosms.com/api/v1",
      "description": "Production Gateway"
    }
  ],
  "paths": {
    "/sms/send": {
      "post": {
        "summary": "Send SMS",
        "description": "Submit an SMS message for immediate delivery.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "to",
                  "message"
                ],
                "properties": {
                  "to": {
                    "type": "string",
                    "example": "+9779841234567",
                    "description": "Recipient phone number in E.164 format"
                  },
                  "message": {
                    "type": "string",
                    "example": "Your verification code is 849201",
                    "description": "Message content (plain text or unicode)"
                  },
                  "sender": {
                    "type": "string",
                    "example": "WEBSTUDIOSMS",
                    "description": "Approved Sender ID (optional)"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Message accepted for delivery",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "message_id": {
                      "type": "string",
                      "example": "WS-MSG-MWLYKL8N-B6E7F08C"
                    },
                    "status": {
                      "type": "string",
                      "example": "accepted"
                    },
                    "sms_count": {
                      "type": "integer",
                      "example": 1
                    },
                    "recipient": {
                      "type": "string",
                      "example": "9779841234567"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/sms/{messageId}": {
      "get": {
        "summary": "Check Status",
        "description": "Check delivery status of a submitted message.",
        "parameters": [
          {
            "name": "messageId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "WS-MSG-MWLYKL8N-B6E7F08C"
          }
        ],
        "responses": {
          "200": {
            "description": "Message status",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "message_id": {
                          "type": "string",
                          "example": "WS-MSG-MWLYKL8N-B6E7F08C"
                        },
                        "recipient": {
                          "type": "string",
                          "example": "9779841234567"
                        },
                        "sender": {
                          "type": "string",
                          "example": "WEBSTUDIOSMS"
                        },
                        "status": {
                          "type": "string",
                          "example": "delivered"
                        },
                        "dlr_status": {
                          "type": "string",
                          "example": "DELIVRD"
                        },
                        "delivered_at": {
                          "type": "string",
                          "example": "2026-11-18T10:08:23.038Z"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/account/balance": {
      "get": {
        "summary": "Check Balance",
        "description": "Check current available account balance.",
        "responses": {
          "200": {
            "description": "Available balance",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "customer_code": {
                          "type": "string",
                          "example": "CUST-ARYAN-01"
                        },
                        "currency": {
                          "type": "string",
                          "example": "USD"
                        },
                        "balance": {
                          "type": "number",
                          "example": 1250.5
                        },
                        "credit_limit": {
                          "type": "number",
                          "example": 500
                        },
                        "available_credit": {
                          "type": "number",
                          "example": 1750.5
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}