{
  "openapi": "3.0.3",
  "info": {
    "title": "Mumm Seller API",
    "version": "1.0.0",
    "description": "Merchant-controlled seller participation. Read/reply/offer scopes; independent from Rebilder. Agreement is not payment or reservation."
  },
  "servers": [
    {
      "url": "https://www.trymumm.com/api/v1/seller"
    }
  ],
  "security": [
    {
      "SellerCredential": []
    }
  ],
  "components": {
    "securitySchemes": {
      "SellerCredential": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "schemas": {
      "OfferCommand": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "action",
          "operationId",
          "expectedOfferId",
          "amountCents",
          "currency",
          "terms",
          "expiresAt",
          "checkoutUrl"
        ],
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "offer"
            ]
          },
          "operationId": {
            "type": "string",
            "format": "uuid"
          },
          "expectedOfferId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "amountCents": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "currency": {
            "type": "string",
            "description": "Currency of amountCents. A credential with an existing USD minimum amount authorizes USD offers only; use a credential without that USD minimum for other currencies and enforce currency-specific limits in your own agent.",
            "enum": [
              "USD",
              "EUR",
              "GBP",
              "CAD",
              "AUD"
            ]
          },
          "terms": {
            "type": "string",
            "minLength": 20,
            "maxLength": 4000
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "checkoutUrl": {
            "type": "string",
            "format": "uri",
            "nullable": true,
            "maxLength": 2000
          }
        }
      },
      "ReplyCommand": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "action",
          "operationId",
          "content"
        ],
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "reply"
            ]
          },
          "operationId": {
            "type": "string",
            "format": "uuid"
          },
          "content": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4000
          }
        }
      }
    }
  },
  "paths": {
    "/requests": {
      "get": {
        "summary": "List business requests newest first, 50 per page",
        "parameters": [
          {
            "in": "header",
            "name": "Mumm-Protocol",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "mumm-seller/1"
              ]
            }
          },
          {
            "in": "query",
            "name": "before",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Use nextBefore from the previous response."
          }
        ],
        "responses": {
          "200": {
            "description": "requests array and nextBefore cursor (null at end)"
          },
          "400": {
            "description": "Invalid version or fields"
          },
          "401": {
            "description": "Missing, expired or revoked credential"
          },
          "403": {
            "description": "Insufficient authority"
          },
          "404": {
            "description": "Unavailable resource"
          },
          "409": {
            "description": "State or retry conflict"
          },
          "413": {
            "description": "Body exceeds 16 KiB"
          },
          "415": {
            "description": "Use JSON"
          },
          "429": {
            "description": "Rate limited; retry after 60 seconds"
          },
          "503": {
            "description": "Service unavailable; retry exact operation"
          }
        }
      }
    },
    "/requests/{id}": {
      "parameters": [
        {
          "in": "path",
          "name": "id",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "in": "header",
          "name": "Mumm-Protocol",
          "required": true,
          "schema": {
            "type": "string",
            "enum": [
              "mumm-seller/1"
            ]
          }
        }
      ],
      "get": {
        "summary": "Read shared request, messages, current offer and agreement state",
        "parameters": [
          {
            "in": "query",
            "name": "beforeMessage",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Use nextMessageBefore to fetch older messages; max100 per page."
          }
        ],
        "responses": {
          "200": {
            "description": "request, messages, nextMessageBefore, offer, state. No opposing private context."
          },
          "400": {
            "description": "Invalid version or fields"
          },
          "401": {
            "description": "Missing, expired or revoked credential"
          },
          "403": {
            "description": "Insufficient authority"
          },
          "404": {
            "description": "Unavailable resource"
          },
          "409": {
            "description": "State or retry conflict"
          },
          "413": {
            "description": "Body exceeds 16 KiB"
          },
          "415": {
            "description": "Use JSON"
          },
          "429": {
            "description": "Rate limited; retry after 60 seconds"
          },
          "503": {
            "description": "Service unavailable; retry exact operation"
          }
        }
      },
      "post": {
        "summary": "Reply or issue an offer within seller-granted authority",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/ReplyCommand"
                  },
                  {
                    "$ref": "#/components/schemas/OfferCommand"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "ok and operationId; identical retries are idempotent"
          },
          "400": {
            "description": "Invalid version or fields"
          },
          "401": {
            "description": "Missing, expired or revoked credential"
          },
          "403": {
            "description": "Insufficient authority"
          },
          "404": {
            "description": "Unavailable resource"
          },
          "409": {
            "description": "State or retry conflict"
          },
          "413": {
            "description": "Body exceeds 16 KiB"
          },
          "415": {
            "description": "Use JSON"
          },
          "429": {
            "description": "Rate limited; retry after 60 seconds"
          },
          "503": {
            "description": "Service unavailable; retry exact operation"
          }
        }
      }
    }
  }
}
