{
  "openapi": "3.0.3",
  "info": {
    "title": "NextSMS REST API v1",
    "version": "1.1.0",
    "description": "Server-to-server customer API. Keep keys on your server. Identity verification and account IP policy apply. API quotas are configurable and shared across keys and both REST contracts. Respect Retry-After. Poll no faster than once per five seconds per message. Acceptance is not delivery. Only operator-reported delivery timestamps are exposed. Missing timestamps remain null. Panel/admin, SOAP and SMPP are separate contracts."
  },
  "servers": [
    {
      "url": "https://api.nextsms.ir",
      "description": "Production; requests can send and charge real SMS."
    }
  ],
  "externalDocs": {
    "url": "https://nextsms.ir/docs"
  },
  "paths": {
    "/api/v1/messages": {
      "get": {
        "operationId": "recentMessages",
        "summary": "Latest 100 pattern sends; use reports for full history",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecentResult"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "401": {
            "description": "Invalid/revoked key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "402": {
            "description": "Insufficient balance",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "403": {
            "description": "Identity, account or IP policy denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "404": {
            "description": "Owned resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "409": {
            "description": "Idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "415": {
            "description": "Unsupported content type",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "423": {
            "description": "Safety review required; keep the same key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "When present, wait this many seconds. No automatic resend.",
                "schema": {
                  "type": "integer",
                  "format": "int64",
                  "minimum": 1
                }
              },
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "503": {
            "description": "Unavailable or overloaded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "When present, wait this many seconds. No automatic resend.",
                "schema": {
                  "type": "integer",
                  "format": "int64",
                  "minimum": 1
                }
              },
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          }
        }
      },
      "post": {
        "operationId": "sendPattern",
        "summary": "Submit one approved pattern message",
        "responses": {
          "200": {
            "description": "Replay of the same request; no second charge or send.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SendResult"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "401": {
            "description": "Invalid/revoked key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "402": {
            "description": "Insufficient balance",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "403": {
            "description": "Identity, account or IP policy denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "404": {
            "description": "Owned resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "409": {
            "description": "Idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "415": {
            "description": "Unsupported content type",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "423": {
            "description": "Safety review required; keep the same key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "When present, wait this many seconds. No automatic resend.",
                "schema": {
                  "type": "integer",
                  "format": "int64",
                  "minimum": 1
                }
              },
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "503": {
            "description": "Unavailable or overloaded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "When present, wait this many seconds. No automatic resend.",
                "schema": {
                  "type": "integer",
                  "format": "int64",
                  "minimum": 1
                }
              },
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "201": {
            "description": "New submission. Inspect message.status; this is not a delivery guarantee.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SendResult"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Persist before sending. Retry the identical request with the SAME key. Never automatically resend an uncertain submission.",
              "pattern": "^[a-zA-Z0-9_-]{8,100}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatternSend"
              },
              "example": {
                "patternId": "welcome",
                "recipient": "09120000000",
                "parameters": {
                  "token": "12345"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/messages/{id}": {
      "get": {
        "operationId": "getMessage",
        "summary": "Read stored message status without triggering a resend",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageResult"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "401": {
            "description": "Invalid/revoked key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "402": {
            "description": "Insufficient balance",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "403": {
            "description": "Identity, account or IP policy denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "404": {
            "description": "Owned resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "409": {
            "description": "Idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "415": {
            "description": "Unsupported content type",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "423": {
            "description": "Safety review required; keep the same key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "When present, wait this many seconds. No automatic resend.",
                "schema": {
                  "type": "integer",
                  "format": "int64",
                  "minimum": 1
                }
              },
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "503": {
            "description": "Unavailable or overloaded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "When present, wait this many seconds. No automatic resend.",
                "schema": {
                  "type": "integer",
                  "format": "int64",
                  "minimum": 1
                }
              },
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ]
      }
    },
    "/api/v1/reports/messages": {
      "get": {
        "operationId": "listMessages",
        "summary": "Filtered, cursor-paginated send history",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReportResult"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "401": {
            "description": "Invalid/revoked key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "402": {
            "description": "Insufficient balance",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "403": {
            "description": "Identity, account or IP policy denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "404": {
            "description": "Owned resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "409": {
            "description": "Idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "415": {
            "description": "Unsupported content type",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "423": {
            "description": "Safety review required; keep the same key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "When present, wait this many seconds. No automatic resend.",
                "schema": {
                  "type": "integer",
                  "format": "int64",
                  "minimum": 1
                }
              },
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "503": {
            "description": "Unavailable or overloaded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "When present, wait this many seconds. No automatic resend.",
                "schema": {
                  "type": "integer",
                  "format": "int64",
                  "minimum": 1
                }
              },
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          }
        },
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Recipient, UUID or pattern name; masked audiences are not searchable by recipient.",
              "maxLength": 300
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "overdue",
                "queued",
                "processing",
                "accepted",
                "delivered",
                "undelivered",
                "failed",
                "unknown",
                "cancelled",
                "rejected",
                "blocked"
              ]
            }
          },
          {
            "name": "unit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "IRR",
                "SMS"
              ]
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Inclusive start.",
              "format": "date-time"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Exclusive end; must be after from.",
              "format": "date-time"
            }
          },
          {
            "name": "asOf",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Reuse the first page value for a stable upper creation-time bound; delivery status may still change.",
              "format": "date-time"
            }
          },
          {
            "name": "archive",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "true",
                "false"
              ],
              "default": "false"
            }
          },
          {
            "name": "sender",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "channel",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "api",
                "panel",
                "all"
              ]
            }
          },
          {
            "name": "language",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "fa",
                "en",
                "all"
              ]
            }
          },
          {
            "name": "destination",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "mci",
                "irancell",
                "rightel",
                "other",
                "all"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Opaque nextCursor; reuse all filters and asOf.",
              "maxLength": 300
            }
          }
        ]
      }
    },
    "/api/v1/reports/messages/export": {
      "get": {
        "operationId": "exportMessages",
        "summary": "Stream all matching rows as UTF-8 CSV",
        "responses": {
          "200": {
            "description": "CSV attachment, scoped to this account",
            "content": {
              "text/csv": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "401": {
            "description": "Invalid/revoked key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "402": {
            "description": "Insufficient balance",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "403": {
            "description": "Identity, account or IP policy denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "404": {
            "description": "Owned resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "409": {
            "description": "Idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "415": {
            "description": "Unsupported content type",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "423": {
            "description": "Safety review required; keep the same key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "When present, wait this many seconds. No automatic resend.",
                "schema": {
                  "type": "integer",
                  "format": "int64",
                  "minimum": 1
                }
              },
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          },
          "503": {
            "description": "Unavailable or overloaded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "When present, wait this many seconds. No automatic resend.",
                "schema": {
                  "type": "integer",
                  "format": "int64",
                  "minimum": 1
                }
              },
              "NextSMS-API-Contract": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "native-rest"
                  ]
                }
              },
              "NextSMS-API-Version": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "v1"
                  ]
                }
              },
              "Link": {
                "schema": {
                  "type": "string"
                },
                "description": "Version policy and changelog links."
              },
              "Deprecation": {
                "schema": {
                  "type": "string",
                  "pattern": "^@[0-9]+$"
                },
                "description": "RFC 9745 structured date. Only present after a retirement plan is published; does not change response semantics."
              },
              "Sunset": {
                "schema": {
                  "type": "string"
                },
                "description": "RFC 8594 HTTP-date in GMT. Only present for a published retirement plan."
              }
            }
          }
        },
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Recipient, UUID or pattern name; masked audiences are not searchable by recipient.",
              "maxLength": 300
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "overdue",
                "queued",
                "processing",
                "accepted",
                "delivered",
                "undelivered",
                "failed",
                "unknown",
                "cancelled",
                "rejected",
                "blocked"
              ]
            }
          },
          {
            "name": "unit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "IRR",
                "SMS"
              ]
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Inclusive start.",
              "format": "date-time"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Exclusive end; must be after from.",
              "format": "date-time"
            }
          },
          {
            "name": "asOf",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Reuse the first page value for a stable upper creation-time bound; delivery status may still change.",
              "format": "date-time"
            }
          },
          {
            "name": "archive",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "true",
                "false"
              ],
              "default": "false"
            }
          },
          {
            "name": "sender",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "channel",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "api",
                "panel",
                "all"
              ]
            }
          },
          {
            "name": "language",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "fa",
                "en",
                "all"
              ]
            }
          },
          {
            "name": "destination",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "mci",
                "irancell",
                "rightel",
                "other",
                "all"
              ]
            }
          }
        ],
        "description": "Six exports per hour per account. Includes BOM; timestamps use Tehran time. cost_rial and cost_toman are monetary values; charged_quantity follows billing_unit. Split large date ranges. No JSON envelope on success."
      }
    }
  },
  "components": {
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "nextsmsCode": {
                "type": "string"
              },
              "retryAfterSeconds": {
                "type": "integer",
                "format": "int64",
                "minimum": 1
              },
              "retryable": {
                "type": "boolean"
              },
              "submissionStatus": {
                "type": "string",
                "enum": [
                  "unknown",
                  "not_accepted"
                ]
              }
            },
            "required": [
              "code",
              "message"
            ]
          }
        },
        "required": [
          "error"
        ]
      },
      "Timing": {
        "type": "object",
        "properties": {
          "delivered_at": {
            "type": "string",
            "description": "ISO 8601 instant with offset; display using Asia/Tehran.",
            "format": "date-time",
            "nullable": true
          }
        },
        "required": [
          "delivered_at"
        ],
        "nullable": true
      },
      "Message": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "description": "queued/processing are not delivery. accepted means upstream acceptance; delivered requires a delivery report. unknown never authorizes a resend.",
            "enum": [
              "queued",
              "processing",
              "accepted",
              "delivered",
              "undelivered",
              "failed",
              "unknown",
              "cancelled",
              "rejected",
              "blocked"
            ]
          },
          "recipient": {
            "type": "string",
            "description": "May be masked for protected audiences."
          },
          "body": {
            "type": "string"
          },
          "sender": {
            "type": "string"
          },
          "cost": {
            "type": "integer",
            "format": "int64",
            "description": "Historical rial amount, including the price snapshot. This is NOT a count of SMS units.",
            "minimum": 0
          },
          "segments": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "billing_unit": {
            "type": "string",
            "enum": [
              "IRR",
              "SMS"
            ]
          },
          "charged_quantity": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "created_at": {
            "type": "string",
            "description": "ISO 8601 instant with offset; display using Asia/Tehran.",
            "format": "date-time"
          },
          "timing": {
            "$ref": "#/components/schemas/Timing"
          },
          "error": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "id",
          "status",
          "cost",
          "segments",
          "billing_unit",
          "charged_quantity"
        ]
      },
      "PatternSend": {
        "type": "object",
        "properties": {
          "patternId": {
            "type": "string",
            "description": "Approved pattern UUID or unique English alias.",
            "minLength": 2,
            "maxLength": 64
          },
          "recipient": {
            "type": "string",
            "description": "Iranian mobile: 09…, 989…, +989… or 00989…. Persian digits are normalized.",
            "maxLength": 30
          },
          "parameters": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "description": "Exactly the pattern variables, with no extra keys.",
              "minLength": 1,
              "maxLength": 200,
              "pattern": "^[^{}\\r\\n\\x00-\\x1f]+$"
            }
          }
        },
        "required": [
          "patternId",
          "recipient",
          "parameters"
        ],
        "additionalProperties": false
      },
      "SendResult": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "message": {
                "$ref": "#/components/schemas/Message"
              },
              "replayed": {
                "type": "boolean"
              },
              "jobId": {
                "type": "string",
                "description": "Internal asynchronous job reference; track delivery by message.id.",
                "format": "uuid"
              }
            },
            "required": [
              "message",
              "replayed"
            ]
          }
        },
        "required": [
          "data"
        ]
      },
      "MessageResult": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/Message"
          }
        },
        "required": [
          "data"
        ]
      },
      "RecentResult": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Message"
            },
            "maxItems": 100
          }
        },
        "required": [
          "data"
        ]
      },
      "ReportResult": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Message"
                }
              },
              "nextCursor": {
                "type": "string",
                "nullable": true
              },
              "asOf": {
                "type": "string",
                "description": "ISO 8601 instant with offset; display using Asia/Tehran.",
                "format": "date-time"
              },
              "total": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "limit": {
                "type": "integer",
                "format": "int64",
                "minimum": 1,
                "maximum": 200
              },
              "billingMode": {
                "type": "string",
                "enum": [
                  "money",
                  "sms"
                ]
              }
            },
            "required": [
              "items",
              "nextCursor",
              "asOf",
              "total",
              "limit",
              "billingMode"
            ]
          }
        },
        "required": [
          "data"
        ]
      }
    },
    "securitySchemes": {
      "BearerKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "NextSMS API key"
      }
    }
  },
  "security": [
    {
      "BearerKey": []
    }
  ],
  "x-nextsms-lifecycle": {
    "contract": "native-rest",
    "version": "v1",
    "catalog": "https://api.nextsms.ir/api/contracts/lifecycle.json",
    "policy": "https://nextsms.ir/docs/versions",
    "changelog": "https://nextsms.ir/docs/versions#changelog"
  }
}
