{
  "openapi": "3.0.3",
  "info": {"title": "TelexicoSMS API", "version": "1.0", "description": "Send UK SMS through TelexicoSMS. Plain-English guide: https://telexicosms.com/developers/llms.txt", "contact": {"name": "Telexico", "email": "hello@telexico.com", "url": "https://telexicosms.com/developers/"}},
  "servers": [{"url": "https://telexicosms.com/api/v1"}],
  "security": [{"bearer": []}, {"apiKeyHeader": []}],
  "components": {
    "securitySchemes": {"bearer": {"type": "http", "scheme": "bearer", "description": "Your key, e.g. tsk_live_…"}, "apiKeyHeader": {"type": "apiKey", "in": "header", "name": "X-API-Key"}},
    "schemas": {
      "Error": {"type": "object", "properties": {"error": {"type": "object", "properties": {"code": {"type": "string"}, "message": {"type": "string"}}}}},
      "Message": {"type": "object", "properties": {"id": {"type": "string"}, "to": {"type": "string"}, "status": {"type": "string", "enum": ["queued", "sending", "sent", "delivered", "failed", "not_sent"]}, "parts": {"type": "integer"}, "reference": {"type": "string", "nullable": true}, "client_ref": {"type": "string", "nullable": true}, "sent_at": {"type": "string", "format": "date-time", "nullable": true}, "done_at": {"type": "string", "format": "date-time", "nullable": true}, "error": {"type": "object", "nullable": true, "properties": {"code": {"type": "string"}, "description": {"type": "string"}}}, "clicks": {"type": "integer"}}}
    }
  },
  "paths": {
    "/ping/": {"get": {"summary": "Test the connection (sends nothing, costs nothing)", "responses": {"200": {"description": "Key works"}, "401": {"description": "Key problem", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}}},
    "/": {"get": {"summary": "Who this key belongs to, its permissions and expiry", "responses": {"200": {"description": "Key details"}}}},
    "/sms/": {
      "post": {"summary": "Send a text to one or up to 100 UK mobiles",
        "parameters": [{"name": "Idempotency-Key", "in": "header", "required": false, "schema": {"type": "string"}, "description": "Retries with the same value never send twice"}],
        "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "required": ["to", "text"], "properties": {
          "to": {"oneOf": [{"type": "string"}, {"type": "array", "items": {"type": "string"}, "maxItems": 100}], "example": "07700900123"},
          "text": {"type": "string", "maxLength": 1530, "example": "Your order #1042 is ready to collect. Thanks!"},
          "from": {"type": "string", "maxLength": 11, "description": "Must equal the sender ID the key is locked to (or leave out)"},
          "reference": {"type": "string"}, "client_ref": {"type": "string"}, "send_at": {"type": "string", "format": "date-time"}, "optout_link": {"type": "boolean"}}}}}},
        "responses": {"201": {"description": "Accepted", "content": {"application/json": {"schema": {"type": "object", "properties": {"batch_id": {"type": "integer"}, "status": {"type": "string"}, "from": {"type": "string"}, "parts_per_message": {"type": "integer"}, "credits_charged": {"type": "integer"}, "messages": {"type": "array", "items": {"$ref": "#/components/schemas/Message"}}}}}}}, "202": {"description": "Accepted but the account is paused — sends automatically later"}, "402": {"description": "Out of credit or monthly limit reached"}, "422": {"description": "Invalid number, text or sender"}, "429": {"description": "Rate limited"}}},
      "get": {"summary": "Status of one message", "parameters": [{"name": "id", "in": "query", "required": true, "schema": {"type": "string"}}], "responses": {"200": {"description": "Message", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Message"}}}}}}
    },
    "/messages/": {"get": {"summary": "Message log, newest first", "parameters": [{"name": "from", "in": "query", "schema": {"type": "string", "format": "date"}}, {"name": "to", "in": "query", "schema": {"type": "string", "format": "date"}}, {"name": "status", "in": "query", "schema": {"type": "string"}}, {"name": "reference", "in": "query", "schema": {"type": "string"}}, {"name": "limit", "in": "query", "schema": {"type": "integer"}}, {"name": "page", "in": "query", "schema": {"type": "integer"}}], "responses": {"200": {"description": "Messages"}}}},
    "/balance/": {"get": {"summary": "Credits available", "responses": {"200": {"description": "Balance"}}}},
    "/optouts/": {
      "get": {"summary": "Is this number opted out?", "parameters": [{"name": "to", "in": "query", "required": true, "schema": {"type": "string"}}], "responses": {"200": {"description": "Opt-out status"}}},
      "post": {"summary": "Opt a number out", "requestBody": {"content": {"application/json": {"schema": {"type": "object", "properties": {"to": {"type": "string"}}}}}}, "responses": {"200": {"description": "Opted out"}}}
    }
  }
}
