{
  "openapi": "3.1.0",
  "info": {
    "title": "One Dash Zero — Chat & WhatsApp AI receptionist (agent purchase)",
    "version": "1.0.0",
    "description": "Buy a Chat & WhatsApp AI receptionist for a business in the US, Canada, Puerto Rico, the Dominican Republic, Ecuador, Panama or El Salvador. 200 conversations per month on the business's own WhatsApp Business number (no new or rented number). Paid with Stripe machine payments (MPP, https://mpp.dev): call without payment to receive an HTTP 402 challenge, pay it, and repeat the same request with the payment credential. After payment, the business owner receives an email, signs in, names and tests the receptionist, then connects their own WhatsApp Business number when ready.",
    "contact": {
      "email": "sofia@onedashzero.ai",
      "url": "https://onedashzero.ai/agents"
    }
  },
  "x-service-info": {
    "categories": [
      "business-software",
      "customer-service",
      "messaging"
    ],
    "docs": {
      "homepage": "https://onedashzero.ai/agents",
      "apiReference": "https://onedashzero.ai/agents/openapi.json",
      "llms": "https://onedashzero.ai/llms.txt"
    }
  },
  "servers": [
    {
      "url": "https://api.1-0.dev"
    }
  ],
  "paths": {
    "/api/agent-purchase/v1/whatsapp-receptionist": {
      "post": {
        "operationId": "buyWhatsAppReceptionist",
        "summary": "Buy a Chat & WhatsApp AI receptionist for a business (US, CA, PR, DO, EC, PA, SV)",
        "description": "Without a payment credential this returns 402 with an MPP challenge (WWW-Authenticate: Payment ...). Pay it and repeat the identical request with the credential in the Authorization header. Idempotent per owner_email + business_name: a repeated request for a business already bought returns the same account with HTTP 200 and is never charged again. Sold for country US, CA, PR, DO, EC, PA or SV; any other country returns 400 country_not_supported.",
        "x-payment-info": {
          "offers": [
            {
              "amount": "1900",
              "currency": "usd",
              "intent": "charge",
              "method": "stripe",
              "description": "term=month: US$19.00, 1 month"
            },
            {
              "amount": "19000",
              "currency": "usd",
              "intent": "charge",
              "method": "stripe",
              "description": "term=year: US$190.00, 12 months"
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PurchaseRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Paid and set up (or already bought: replayed is true, no charge). The owner has been emailed a link to sign in and set up the receptionist. A paid response carries a Payment-Receipt header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PurchaseResult"
                }
              }
            }
          },
          "400": {
            "description": "Invalid field (code invalid_field) or unsupported country (code country_not_supported: anything other than US, CA, PR, DO, EC, PA, SV).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Payment required: an MPP challenge in the WWW-Authenticate header (method stripe, intent charge; cards through Stripe Shared Payment Tokens). Also returned when a presented credential is refused.",
            "headers": {
              "WWW-Authenticate": {
                "schema": {
                  "type": "string"
                },
                "description": "Payment id=..., realm=..., method=\"stripe\", intent=\"charge\", request=..."
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "409": {
            "description": "A payment for the same owner_email + business_name is in progress (code in_progress). Retry after the Retry-After seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Payment refused by the processor (code payment_error, nothing charged), or paid but the account could not be set up yet (code provisioning_failed): repeat the same request — it is not charged again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Agent payments are not enabled yet (code not_configured).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "PurchaseRequest": {
        "type": "object",
        "required": [
          "business_name",
          "owner_full_name",
          "owner_email",
          "owner_whatsapp_number",
          "country",
          "term"
        ],
        "additionalProperties": false,
        "properties": {
          "business_name": {
            "type": "string",
            "description": "The business's name.",
            "maxLength": 120
          },
          "owner_full_name": {
            "type": "string",
            "description": "The business owner's full name. The owner receives the setup email.",
            "maxLength": 120
          },
          "owner_email": {
            "type": "string",
            "description": "The owner's email. Signs in to the One Dash Zero FONE app with a code sent here.",
            "format": "email"
          },
          "owner_whatsapp_number": {
            "type": "string",
            "description": "The business's WhatsApp Business number, E.164 (e.g. +18095551234). The owner connects this number; no new number is issued.",
            "pattern": "^\\+[1-9][0-9]{7,14}$"
          },
          "country": {
            "type": "string",
            "description": "Country of the business (ISO 3166-1 alpha-2). The account is created in this country and cannot change.",
            "enum": [
              "US",
              "CA",
              "PR",
              "DO",
              "EC",
              "PA",
              "SV"
            ]
          },
          "language": {
            "type": "string",
            "description": "Optional. Language of the owner email and the receptionist. Defaults by country: en for US, CA, PR; es for DO, EC, PA, SV.",
            "enum": [
              "es",
              "en"
            ]
          },
          "term": {
            "type": "string",
            "description": "month = US$19.00 for 1 month; year = US$190.00 for 12 months.",
            "enum": [
              "month",
              "year"
            ]
          }
        }
      },
      "PurchaseResult": {
        "type": "object",
        "required": [
          "ok",
          "account_id",
          "status",
          "plan",
          "paid_through",
          "owner_emailed"
        ],
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "account_id": {
            "type": "string",
            "description": "The One Dash Zero account created for the business."
          },
          "status": {
            "type": "string",
            "description": "awaiting_owner_setup: the owner must sign in, name and test the receptionist, and connect their WhatsApp Business number.",
            "enum": [
              "awaiting_owner_setup"
            ]
          },
          "plan": {
            "type": "string",
            "description": "Plan id.",
            "enum": [
              "do_chat"
            ]
          },
          "plan_name": {
            "type": "string",
            "description": "Chat & WhatsApp"
          },
          "conversations_per_month": {
            "type": "integer",
            "const": 200
          },
          "term": {
            "type": "string",
            "description": "month or year",
            "enum": [
              "month",
              "year"
            ]
          },
          "amount_usd": {
            "type": "string",
            "description": "Amount charged in US$, e.g. 19.00."
          },
          "paid_through": {
            "type": "string",
            "description": "Last day of the paid period (YYYY-MM-DD). After it, the owner can renew in the FONE app (Account → Billing).",
            "format": "date"
          },
          "owner_emailed": {
            "type": "boolean",
            "description": "The owner was sent the set-up email."
          },
          "replayed": {
            "type": "boolean",
            "description": "True when this business was already bought: no charge was made."
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "ok",
          "code",
          "error"
        ],
        "properties": {
          "ok": {
            "type": "boolean",
            "const": false
          },
          "code": {
            "type": "string"
          },
          "field": {
            "type": "string"
          },
          "error": {
            "type": "string"
          }
        }
      }
    }
  }
}