{
  "openapi": "3.1.0",
  "info": {
    "title": "Wsend Link Preview Actions API",
    "version": "1.0.0",
    "description": "No-auth, read-only actions for the public Wsend GPT. These endpoints only preview direct chat links, QR payload URLs, and public Wsend resources. They do not send messages, create Wsend profiles, submit forms, or store user data.",
    "termsOfService": "https://wsend.pro/terms-conditions/"
  },
  "servers": [
    {
      "url": "https://wsend.pro"
    }
  ],
  "paths": {
    "/api/gpt/v1/resources": {
      "get": {
        "operationId": "getWsendPublicResources",
        "summary": "Get public Wsend resources",
        "description": "Returns public discovery, policy, sitemap, and support URLs for Wsend.",
        "responses": {
          "200": {
            "description": "Public Wsend resources.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResourcesResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/gpt/v1/link-preview": {
      "post": {
        "operationId": "previewWsendChatLinkForGpt",
        "summary": "Preview a direct chat link",
        "description": "Normalizes a phone number and optional message into a wa.me preview URL. It does not send messages or create a Wsend profile.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PreviewRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Preview URL generated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LinkPreviewResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          }
        }
      }
    },
    "/api/gpt/v1/qr-preview": {
      "post": {
        "operationId": "previewWsendQrPayloadForGpt",
        "summary": "Preview a QR payload",
        "description": "Normalizes a phone number and optional message into the URL payload that a QR code should encode. It does not create or download files.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PreviewRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "QR payload preview generated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QrPreviewResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          }
        }
      }
    }
  },
  "components": {
    "responses": {
      "BadRequest": {
        "description": "The preview request is invalid.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      }
    },
    "schemas": {
      "PreviewRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "phone"
        ],
        "properties": {
          "country_code": {
            "type": "string",
            "description": "Optional international calling code, such as 20 or +20.",
            "pattern": "^\\+?[0-9]{1,3}$"
          },
          "phone": {
            "type": "string",
            "description": "Phone number to preview. Separators such as spaces, hyphens, and parentheses are accepted and removed.",
            "minLength": 6,
            "maxLength": 32,
            "pattern": "^[0-9+() .-]+$"
          },
          "message": {
            "type": "string",
            "description": "Optional prefilled message for the preview URL.",
            "maxLength": 500
          }
        }
      },
      "LinkPreviewResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "previewOnly",
          "phoneDigits",
          "chatUrl"
        ],
        "properties": {
          "previewOnly": {
            "type": "boolean",
            "const": true
          },
          "phoneDigits": {
            "type": "string",
            "pattern": "^[0-9]{6,15}$"
          },
          "chatUrl": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "QrPreviewResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "previewOnly",
          "phoneDigits",
          "qrPayload"
        ],
        "properties": {
          "previewOnly": {
            "type": "boolean",
            "const": true
          },
          "phoneDigits": {
            "type": "string",
            "pattern": "^[0-9]{6,15}$"
          },
          "qrPayload": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "ResourcesResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "previewOnly",
          "scope",
          "data"
        ],
        "properties": {
          "previewOnly": {
            "type": "boolean",
            "const": true
          },
          "scope": {
            "type": "string"
          },
          "data": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string"
          },
          "error_description": {
            "type": "string"
          }
        }
      }
    }
  }
}