{
    "openapi": "3.1.0",
    "info": {
        "title": "OpaSocial API",
        "version": "2.0.0",
        "description": "The customer API. Amounts are USD decimal strings to eight places, never floating point. Prices are per unit; the catalogue shows them per 1,000."
    },
    "servers": [
        {
            "url": "https://opasocial.com",
            "description": "OpaSocial"
        }
    ],
    "security": [
        {
            "bearerApiKey": []
        }
    ],
    "paths": {
        "/api/v2/account": {
            "get": {
                "summary": "Read USD account balance",
                "operationId": "ReadUSDaccountbalance",
                "description": "Read USD account balance",
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Account"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Safe refusal; no raw provider response.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "account:read"
                ]
            }
        },
        "/api/v2/services": {
            "get": {
                "summary": "Browse eligible services",
                "operationId": "Browseeligibleservices",
                "description": "Up to 100 scanned offers per cursor. Filtered pages may contain fewer eligible services. Follow next_after until null.",
                "parameters": [
                    {
                        "name": "after",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 0,
                            "default": 0
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "services": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Service"
                                            }
                                        },
                                        "next_after": {
                                            "anyOf": [
                                                {
                                                    "type": "integer",
                                                    "minimum": 1
                                                },
                                                {
                                                    "type": "null"
                                                }
                                            ]
                                        }
                                    },
                                    "required": [
                                        "services",
                                        "next_after"
                                    ],
                                    "additionalProperties": false
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Safe refusal; no raw provider response.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "orders:read"
                ]
            }
        },
        "/api/v2/services/{offer}/delivery": {
            "get": {
                "summary": "Read delivery availability",
                "operationId": "Readdeliveryavailability",
                "description": "Read delivery availability",
                "parameters": [
                    {
                        "name": "offer",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "scheduled": {
                                            "type": "boolean"
                                        },
                                        "service_managed": {
                                            "type": "boolean"
                                        }
                                    },
                                    "required": [
                                        "scheduled",
                                        "service_managed"
                                    ],
                                    "additionalProperties": false
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Safe refusal; no raw provider response.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "drip_feeds:read"
                ]
            }
        },
        "/api/v2/orders": {
            "post": {
                "summary": "Place an order",
                "operationId": "Placeanorder",
                "description": "Place an order",
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "Idempotent replay of original resource",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Order"
                                }
                            }
                        }
                    },
                    "201": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Order"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Safe refusal; no raw provider response.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "orders:write"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/OrderInput"
                            }
                        }
                    }
                }
            }
        },
        "/api/v2/validate-order": {
            "post": {
                "summary": "Validate order without creating it",
                "operationId": "Validateorderwithoutcreatingit",
                "description": "Validate order without creating it",
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "valid": {
                                            "const": true
                                        },
                                        "simulation": {
                                            "const": true
                                        },
                                        "offer_id": {
                                            "type": "integer",
                                            "minimum": 1
                                        },
                                        "input_type": {
                                            "type": "string"
                                        },
                                        "preview": {
                                            "type": "object",
                                            "properties": {
                                                "quantity": {
                                                    "type": "integer",
                                                    "minimum": 1
                                                },
                                                "unit_rate_usd": {
                                                    "type": "string",
                                                    "pattern": "^\\d{1,12}(\\.\\d{1,8})?$",
                                                    "description": "USD decimal string; never binary floating point."
                                                },
                                                "total_usd": {
                                                    "type": "string",
                                                    "pattern": "^\\d{1,12}(\\.\\d{1,8})?$",
                                                    "description": "USD decimal string; never binary floating point."
                                                },
                                                "currency": {
                                                    "const": "USD"
                                                }
                                            },
                                            "required": [
                                                "quantity",
                                                "unit_rate_usd",
                                                "total_usd",
                                                "currency"
                                            ],
                                            "additionalProperties": false
                                        },
                                        "agency_approval_required": {
                                            "type": "boolean"
                                        },
                                        "funds_reserved": {
                                            "const": false
                                        },
                                        "notice": {
                                            "type": "string"
                                        }
                                    },
                                    "required": [
                                        "valid",
                                        "simulation",
                                        "offer_id",
                                        "input_type",
                                        "preview",
                                        "agency_approval_required",
                                        "funds_reserved",
                                        "notice"
                                    ],
                                    "additionalProperties": false
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Safe refusal; no raw provider response.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "orders:write"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "offer_id": {
                                        "type": "integer",
                                        "minimum": 1
                                    },
                                    "target": {
                                        "type": "string",
                                        "maxLength": 2048
                                    },
                                    "quantity": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "minimum": 1,
                                        "maximum": 1000000000
                                    },
                                    "details": {
                                        "type": "object",
                                        "description": "Fields for the enabled service type; see service-input table in phase-08-contracts.md."
                                    },
                                    "idempotency_key": {
                                        "type": "string",
                                        "maxLength": 191
                                    },
                                    "client_ref": {
                                        "type": "string",
                                        "maxLength": 160
                                    },
                                    "max_rate": {
                                        "type": "string",
                                        "pattern": "^\\d{1,12}(\\.\\d{1,8})?$",
                                        "description": "Maximum USD per UNIT, not catalogue per-1000 rate."
                                    },
                                    "max_total": {
                                        "type": "string",
                                        "pattern": "^\\d{1,12}(\\.\\d{1,8})?$",
                                        "description": "USD decimal string; never binary floating point."
                                    },
                                    "agency_project_id": {
                                        "type": "integer",
                                        "minimum": 1
                                    }
                                },
                                "required": [
                                    "offer_id",
                                    "target"
                                ],
                                "additionalProperties": false
                            }
                        }
                    }
                }
            }
        },
        "/api/v2/orders/status": {
            "post": {
                "summary": "Read mixed batch status",
                "operationId": "Readmixedbatchstatus",
                "description": "Read mixed batch status",
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "orders": {
                                            "type": "array",
                                            "items": {
                                                "oneOf": [
                                                    {
                                                        "$ref": "#/components/schemas/Order"
                                                    },
                                                    {
                                                        "type": "object",
                                                        "properties": {
                                                            "order": {
                                                                "type": "integer",
                                                                "minimum": 1
                                                            },
                                                            "error": {
                                                                "const": "not_found"
                                                            }
                                                        },
                                                        "required": [
                                                            "order",
                                                            "error"
                                                        ],
                                                        "additionalProperties": false
                                                    }
                                                ]
                                            }
                                        }
                                    },
                                    "required": [
                                        "orders"
                                    ],
                                    "additionalProperties": false
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Safe refusal; no raw provider response.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "orders:read"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "orders": {
                                        "type": "array",
                                        "items": {
                                            "type": "integer",
                                            "minimum": 1
                                        },
                                        "minItems": 1,
                                        "maxItems": 100,
                                        "uniqueItems": true
                                    }
                                },
                                "required": [
                                    "orders"
                                ],
                                "additionalProperties": false
                            }
                        }
                    }
                }
            }
        },
        "/api/v2/orders/{order}": {
            "get": {
                "summary": "Read own order",
                "operationId": "Readownorder",
                "description": "Read own order",
                "parameters": [
                    {
                        "name": "order",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Order"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Safe refusal; no raw provider response.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "orders:read"
                ]
            }
        },
        "/api/v2/orders/{order}/cancel": {
            "post": {
                "summary": "Request order cancel",
                "operationId": "Requestordercancel",
                "description": "Provider request only; acknowledgement never changes order status or refunds money.",
                "parameters": [
                    {
                        "name": "order",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ActionRequest"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Safe refusal; no raw provider response.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "orders:cancel"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "idempotency_key": {
                                        "type": "string",
                                        "maxLength": 191
                                    }
                                },
                                "required": [
                                    "idempotency_key"
                                ],
                                "additionalProperties": false
                            }
                        }
                    }
                }
            }
        },
        "/api/v2/orders/{order}/refill": {
            "post": {
                "summary": "Request order refill",
                "operationId": "Requestorderrefill",
                "description": "Provider request only; acknowledgement never changes order status or refunds money.",
                "parameters": [
                    {
                        "name": "order",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ActionRequest"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Safe refusal; no raw provider response.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "orders:refill"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "idempotency_key": {
                                        "type": "string",
                                        "maxLength": 191
                                    }
                                },
                                "required": [
                                    "idempotency_key"
                                ],
                                "additionalProperties": false
                            }
                        }
                    }
                }
            }
        },
        "/api/v2/requests/{actionRequest}": {
            "get": {
                "summary": "Read own action request",
                "operationId": "Readownactionrequest",
                "description": "Read own action request",
                "parameters": [
                    {
                        "name": "actionRequest",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ActionRequest"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Safe refusal; no raw provider response.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "orders:read"
                ]
            }
        },
        "/api/v2/drip-feeds": {
            "post": {
                "summary": "Create drip feed",
                "operationId": "Createdripfeed",
                "description": "Create drip feed",
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "Idempotent replay of original resource",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "oneOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "mode": {
                                                    "const": "scheduled"
                                                },
                                                "plan": {
                                                    "$ref": "#/components/schemas/DripPlan"
                                                }
                                            },
                                            "required": [
                                                "mode",
                                                "plan"
                                            ],
                                            "additionalProperties": false
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "mode": {
                                                    "const": "service_managed"
                                                },
                                                "order": {
                                                    "$ref": "#/components/schemas/Order"
                                                }
                                            },
                                            "required": [
                                                "mode",
                                                "order"
                                            ],
                                            "additionalProperties": false
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "201": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "oneOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "mode": {
                                                    "const": "scheduled"
                                                },
                                                "plan": {
                                                    "$ref": "#/components/schemas/DripPlan"
                                                }
                                            },
                                            "required": [
                                                "mode",
                                                "plan"
                                            ],
                                            "additionalProperties": false
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "mode": {
                                                    "const": "service_managed"
                                                },
                                                "order": {
                                                    "$ref": "#/components/schemas/Order"
                                                }
                                            },
                                            "required": [
                                                "mode",
                                                "order"
                                            ],
                                            "additionalProperties": false
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Safe refusal; no raw provider response.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "drip_feeds:write"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/DripInput"
                            }
                        }
                    }
                }
            },
            "get": {
                "summary": "List own scheduled drips",
                "operationId": "Listownscheduleddrips",
                "description": "List own scheduled drips",
                "parameters": [
                    {
                        "name": "after",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 0,
                            "default": 0
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "plans": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "plan_id": {
                                                        "type": "integer",
                                                        "minimum": 1
                                                    },
                                                    "status": {
                                                        "type": "string"
                                                    },
                                                    "paused": {
                                                        "type": "boolean"
                                                    },
                                                    "charge_usd": {
                                                        "type": "string",
                                                        "pattern": "^\\d{1,12}(\\.\\d{1,8})?$",
                                                        "description": "USD decimal string; never binary floating point."
                                                    },
                                                    "returned_usd": {
                                                        "type": "string",
                                                        "pattern": "^\\d{1,12}(\\.\\d{1,8})?$",
                                                        "description": "USD decimal string; never binary floating point."
                                                    }
                                                },
                                                "required": [
                                                    "plan_id",
                                                    "status",
                                                    "paused",
                                                    "charge_usd",
                                                    "returned_usd"
                                                ],
                                                "additionalProperties": false
                                            }
                                        },
                                        "next_after": {
                                            "anyOf": [
                                                {
                                                    "type": "integer",
                                                    "minimum": 1
                                                },
                                                {
                                                    "type": "null"
                                                }
                                            ]
                                        }
                                    },
                                    "required": [
                                        "plans",
                                        "next_after"
                                    ],
                                    "additionalProperties": false
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Safe refusal; no raw provider response.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "drip_feeds:read"
                ]
            }
        },
        "/api/v2/drip-feeds/{plan}": {
            "get": {
                "summary": "Read scheduled drip runs",
                "operationId": "Readscheduleddripruns",
                "description": "Read scheduled drip runs",
                "parameters": [
                    {
                        "name": "plan",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "default": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "plan": {
                                            "$ref": "#/components/schemas/DripPlan"
                                        }
                                    },
                                    "required": [
                                        "plan"
                                    ],
                                    "additionalProperties": false
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Safe refusal; no raw provider response.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "drip_feeds:read"
                ]
            }
        },
        "/api/v2/drip-feeds/{plan}/{action}": {
            "post": {
                "summary": "Control future scheduled runs",
                "operationId": "Controlfuturescheduledruns",
                "description": "Control future scheduled runs",
                "parameters": [
                    {
                        "name": "plan",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "name": "action",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "enum": [
                                "pause",
                                "resume",
                                "cancel"
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "plan": {
                                            "$ref": "#/components/schemas/DripPlan"
                                        }
                                    },
                                    "required": [
                                        "plan"
                                    ],
                                    "additionalProperties": false
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Safe refusal; no raw provider response.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "drip_feeds:write"
                ]
            }
        },
        "/api/v2/subscriptions": {
            "post": {
                "summary": "API create subscription",
                "operationId": "APIcreatesubscription",
                "description": "API create subscription",
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "Idempotent replay of original resource",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "subscription": {
                                            "$ref": "#/components/schemas/Subscription"
                                        }
                                    },
                                    "required": [
                                        "subscription"
                                    ],
                                    "additionalProperties": false
                                }
                            }
                        }
                    },
                    "201": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "subscription": {
                                            "$ref": "#/components/schemas/Subscription"
                                        }
                                    },
                                    "required": [
                                        "subscription"
                                    ],
                                    "additionalProperties": false
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Safe refusal; no raw provider response.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "subscriptions:write"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/SubscriptionInput"
                            }
                        }
                    }
                }
            },
            "get": {
                "summary": "API list subscriptions",
                "operationId": "APIlistsubscriptions",
                "description": "API list subscriptions",
                "parameters": [
                    {
                        "name": "after",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 0,
                            "default": 0
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "subscriptions": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Subscription"
                                            }
                                        },
                                        "next_after": {
                                            "anyOf": [
                                                {
                                                    "type": "integer",
                                                    "minimum": 1
                                                },
                                                {
                                                    "type": "null"
                                                }
                                            ]
                                        }
                                    },
                                    "required": [
                                        "subscriptions",
                                        "next_after"
                                    ],
                                    "additionalProperties": false
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Safe refusal; no raw provider response.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "subscriptions:read"
                ]
            }
        },
        "/api/v2/subscriptions/{subscription}": {
            "get": {
                "summary": "API read subscription",
                "operationId": "APIreadsubscription",
                "description": "API read subscription",
                "parameters": [
                    {
                        "name": "subscription",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "subscription": {
                                            "$ref": "#/components/schemas/Subscription"
                                        }
                                    },
                                    "required": [
                                        "subscription"
                                    ],
                                    "additionalProperties": false
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Safe refusal; no raw provider response.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "subscriptions:read"
                ]
            }
        },
        "/api/v2/subscriptions/{subscription}/posts": {
            "get": {
                "summary": "API read subscription posts",
                "operationId": "APIreadsubscriptionposts",
                "description": "API read subscription posts",
                "parameters": [
                    {
                        "name": "subscription",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "name": "after",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 0,
                            "default": 0
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "posts": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/SubscriptionPost"
                                            }
                                        },
                                        "next_after": {
                                            "anyOf": [
                                                {
                                                    "type": "integer",
                                                    "minimum": 1
                                                },
                                                {
                                                    "type": "null"
                                                }
                                            ]
                                        }
                                    },
                                    "required": [
                                        "posts",
                                        "next_after"
                                    ],
                                    "additionalProperties": false
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Safe refusal; no raw provider response.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "subscriptions:read"
                ]
            }
        },
        "/api/v2/subscriptions/{subscription}/{action}": {
            "post": {
                "summary": "API control subscription",
                "operationId": "APIcontrolsubscription",
                "description": "API control subscription",
                "parameters": [
                    {
                        "name": "subscription",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "name": "action",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "enum": [
                                "pause",
                                "resume",
                                "cancel"
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "subscription": {
                                            "$ref": "#/components/schemas/Subscription"
                                        }
                                    },
                                    "required": [
                                        "subscription"
                                    ],
                                    "additionalProperties": false
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Safe refusal; no raw provider response.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "subscriptions:write"
                ]
            }
        },
        "/api/v2/webhooks": {
            "get": {
                "summary": "List webhook endpoints",
                "operationId": "Listwebhookendpoints",
                "description": "List webhook endpoints",
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "endpoints": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/WebhookEndpoint"
                                            }
                                        }
                                    },
                                    "required": [
                                        "endpoints"
                                    ],
                                    "additionalProperties": false
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Safe refusal; no raw provider response.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "webhooks:manage"
                ]
            },
            "post": {
                "summary": "Register webhook endpoint",
                "operationId": "Registerwebhookendpoint",
                "description": "Public HTTPS port 443; no query, fragment, credentials, private address or redirect. Also needs each selected event scope. Five enabled endpoints per account. Secret returned once.",
                "parameters": [],
                "responses": {
                    "201": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "endpoint": {
                                            "$ref": "#/components/schemas/WebhookEndpoint"
                                        },
                                        "signing_secret": {
                                            "type": "string"
                                        }
                                    },
                                    "required": [
                                        "endpoint",
                                        "signing_secret"
                                    ],
                                    "additionalProperties": false
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Safe refusal; no raw provider response.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "webhooks:manage"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "url": {
                                        "type": "string",
                                        "format": "uri",
                                        "maxLength": 1024
                                    },
                                    "events": {
                                        "type": "array",
                                        "items": {
                                            "enum": [
                                                "order.status",
                                                "order.settled",
                                                "service.price_changed",
                                                "subscription.changed",
                                                "subscription.post",
                                                "drip.changed"
                                            ]
                                        },
                                        "minItems": 1,
                                        "maxItems": 6,
                                        "uniqueItems": true
                                    }
                                },
                                "required": [
                                    "url",
                                    "events"
                                ],
                                "additionalProperties": false
                            }
                        }
                    }
                }
            }
        },
        "/api/v2/webhooks/{endpoint}": {
            "patch": {
                "summary": "Update webhook opt in",
                "operationId": "Updatewebhookoptin",
                "description": "Update webhook opt in",
                "parameters": [
                    {
                        "name": "endpoint",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "endpoint": {
                                            "$ref": "#/components/schemas/WebhookEndpoint"
                                        }
                                    },
                                    "required": [
                                        "endpoint"
                                    ],
                                    "additionalProperties": false
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Safe refusal; no raw provider response.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "webhooks:manage"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "enabled": {
                                        "type": "boolean"
                                    },
                                    "events": {
                                        "type": "array",
                                        "items": {
                                            "enum": [
                                                "order.status",
                                                "order.settled",
                                                "service.price_changed",
                                                "subscription.changed",
                                                "subscription.post",
                                                "drip.changed"
                                            ]
                                        },
                                        "minItems": 1,
                                        "maxItems": 6,
                                        "uniqueItems": true
                                    }
                                },
                                "required": [],
                                "additionalProperties": false
                            }
                        }
                    }
                }
            }
        },
        "/api/v2/webhooks/{endpoint}/activate-secret": {
            "post": {
                "summary": "Activate webhook signing secret",
                "operationId": "Activatewebhooksigningsecret",
                "description": "Activate webhook signing secret",
                "parameters": [
                    {
                        "name": "endpoint",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "endpoint": {
                                            "$ref": "#/components/schemas/WebhookEndpoint"
                                        }
                                    },
                                    "required": [
                                        "endpoint"
                                    ],
                                    "additionalProperties": false
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Safe refusal; no raw provider response.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "webhooks:manage"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "proof": {
                                        "type": "string",
                                        "pattern": "^[a-f0-9]{64}$"
                                    }
                                },
                                "required": [
                                    "proof"
                                ],
                                "additionalProperties": false
                            }
                        }
                    }
                }
            }
        },
        "/api/v2/webhooks/{endpoint}/deliveries": {
            "get": {
                "summary": "Read webhook delivery history",
                "operationId": "Readwebhookdeliveryhistory",
                "description": "Read webhook delivery history",
                "parameters": [
                    {
                        "name": "endpoint",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "name": "after",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 0,
                            "default": 0
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "deliveries": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "minimum": 1
                                                    },
                                                    "event_id": {
                                                        "type": "string",
                                                        "format": "uuid"
                                                    },
                                                    "type": {
                                                        "enum": [
                                                            "order.status",
                                                            "order.settled",
                                                            "service.price_changed",
                                                            "subscription.changed",
                                                            "subscription.post",
                                                            "drip.changed"
                                                        ]
                                                    },
                                                    "state": {
                                                        "type": "string"
                                                    },
                                                    "generation": {
                                                        "type": "integer",
                                                        "minimum": 0
                                                    },
                                                    "attempts": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "object",
                                                            "properties": {
                                                                "id": {
                                                                    "type": "string",
                                                                    "format": "uuid"
                                                                },
                                                                "http_status": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "integer"
                                                                        },
                                                                        {
                                                                            "type": "null"
                                                                        }
                                                                    ]
                                                                },
                                                                "error": {
                                                                    "anyOf": [
                                                                        {
                                                                            "type": "string"
                                                                        },
                                                                        {
                                                                            "type": "null"
                                                                        }
                                                                    ]
                                                                },
                                                                "created_at": {
                                                                    "type": "string",
                                                                    "format": "date-time"
                                                                }
                                                            },
                                                            "required": [
                                                                "id",
                                                                "http_status",
                                                                "error",
                                                                "created_at"
                                                            ],
                                                            "additionalProperties": false
                                                        }
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "event_id",
                                                    "type",
                                                    "state",
                                                    "generation",
                                                    "attempts"
                                                ],
                                                "additionalProperties": false
                                            }
                                        },
                                        "next_after": {
                                            "anyOf": [
                                                {
                                                    "type": "integer",
                                                    "minimum": 1
                                                },
                                                {
                                                    "type": "null"
                                                }
                                            ]
                                        }
                                    },
                                    "required": [
                                        "deliveries",
                                        "next_after"
                                    ],
                                    "additionalProperties": false
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Safe refusal; no raw provider response.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "webhooks:manage"
                ]
            }
        },
        "/api/v2/webhooks/{endpoint}/rotate": {
            "post": {
                "summary": "Prepare webhook signing secret",
                "operationId": "Preparewebhooksigningsecret",
                "description": "Prepare webhook signing secret",
                "parameters": [
                    {
                        "name": "endpoint",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "pending_signing_secret": {
                                            "type": "string"
                                        },
                                        "activation_message": {
                                            "type": "string"
                                        }
                                    },
                                    "required": [
                                        "pending_signing_secret",
                                        "activation_message"
                                    ],
                                    "additionalProperties": false
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Safe refusal; no raw provider response.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "webhooks:manage"
                ]
            }
        },
        "/api/v2/webhooks/{endpoint}/deliveries/{delivery}/replay": {
            "post": {
                "summary": "Replay webhook business event",
                "operationId": "Replaywebhookbusinessevent",
                "description": "Replay webhook business event",
                "parameters": [
                    {
                        "name": "endpoint",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "name": "delivery",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "delivery": {
                                            "type": "integer",
                                            "minimum": 1
                                        },
                                        "event_id": {
                                            "type": "string",
                                            "format": "uuid"
                                        },
                                        "state": {
                                            "const": "pending"
                                        }
                                    },
                                    "required": [
                                        "delivery",
                                        "event_id",
                                        "state"
                                    ],
                                    "additionalProperties": false
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Safe refusal; no raw provider response.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "webhooks:manage"
                ]
            }
        },
        "/api/v2": {
            "post": {
                "summary": "Standard SMM panel API compatibility",
                "operationId": "Legacyactioncompatibility",
                "description": "The standard key + action API used by SMM panels (Decision 95), with OpaSocial extras accepted on top. Bearer key OR body key is required; query key cannot authenticate. JSON or form encoding. status, refill and cancel take `order` or a comma list in `orders`; refill_status takes `refill` or `refills`. add with `runs` and `interval` is a drip feed with `quantity` per run. It uses OpaSocial's own scheduled plan first, returned as order number 1000000000 + plan ID, otherwise a provider-managed order. Errors are {\"error\": code}. Unknown actions including create_order are refused.",
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "description": "Action-dependent response; see legacy action table in phase-08-contracts.md."
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Safe refusal; no raw provider response.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "key": {
                                        "type": "string"
                                    },
                                    "action": {
                                        "enum": [
                                            "balance",
                                            "services",
                                            "add",
                                            "status",
                                            "orders",
                                            "refill",
                                            "cancel",
                                            "refill_status"
                                        ]
                                    },
                                    "service": {
                                        "type": "integer",
                                        "minimum": 1
                                    },
                                    "link": {
                                        "type": "string",
                                        "maxLength": 2048
                                    },
                                    "quantity": {
                                        "type": "integer",
                                        "minimum": 1
                                    },
                                    "order": {
                                        "type": "integer",
                                        "minimum": 1
                                    },
                                    "orders": {
                                        "type": "string",
                                        "maxLength": 2200
                                    },
                                    "refill": {
                                        "type": "integer",
                                        "minimum": 1
                                    },
                                    "refills": {
                                        "type": "string",
                                        "maxLength": 2200,
                                        "description": "Comma list of up to 100 refill IDs."
                                    },
                                    "runs": {
                                        "type": "integer",
                                        "minimum": 2,
                                        "maximum": 500
                                    },
                                    "interval": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "description": "Minutes between runs."
                                    },
                                    "idempotency_key": {
                                        "type": "string"
                                    },
                                    "max_rate": {
                                        "type": "string",
                                        "pattern": "^\\d{1,12}(\\.\\d{1,8})?$",
                                        "description": "USD decimal string; never binary floating point."
                                    },
                                    "max_total": {
                                        "type": "string",
                                        "pattern": "^\\d{1,12}(\\.\\d{1,8})?$",
                                        "description": "USD decimal string; never binary floating point."
                                    },
                                    "client_ref": {
                                        "type": "string"
                                    },
                                    "agency_project_id": {
                                        "type": "integer",
                                        "minimum": 1
                                    }
                                },
                                "required": [
                                    "action"
                                ],
                                "additionalProperties": true
                            }
                        },
                        "application/x-www-form-urlencoded": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "key": {
                                        "type": "string"
                                    },
                                    "action": {
                                        "enum": [
                                            "balance",
                                            "services",
                                            "add",
                                            "status",
                                            "orders",
                                            "refill",
                                            "cancel",
                                            "refill_status"
                                        ]
                                    },
                                    "service": {
                                        "type": "integer",
                                        "minimum": 1
                                    },
                                    "link": {
                                        "type": "string",
                                        "maxLength": 2048
                                    },
                                    "quantity": {
                                        "type": "integer",
                                        "minimum": 1
                                    },
                                    "order": {
                                        "type": "integer",
                                        "minimum": 1
                                    },
                                    "orders": {
                                        "type": "string",
                                        "maxLength": 2200
                                    },
                                    "refill": {
                                        "type": "integer",
                                        "minimum": 1
                                    },
                                    "idempotency_key": {
                                        "type": "string"
                                    },
                                    "max_rate": {
                                        "type": "string",
                                        "pattern": "^\\d{1,12}(\\.\\d{1,8})?$",
                                        "description": "USD decimal string; never binary floating point."
                                    },
                                    "max_total": {
                                        "type": "string",
                                        "pattern": "^\\d{1,12}(\\.\\d{1,8})?$",
                                        "description": "USD decimal string; never binary floating point."
                                    },
                                    "client_ref": {
                                        "type": "string"
                                    },
                                    "agency_project_id": {
                                        "type": "integer",
                                        "minimum": 1
                                    }
                                },
                                "required": [
                                    "action"
                                ],
                                "additionalProperties": true
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerApiKey": []
                    },
                    []
                ]
            }
        }
    },
    "components": {
        "securitySchemes": {
            "bearerApiKey": {
                "type": "http",
                "scheme": "bearer",
                "bearerFormat": "opk_..."
            }
        },
        "schemas": {
            "Account": {
                "type": "object",
                "properties": {
                    "balance": {
                        "type": "string",
                        "pattern": "^\\d{1,12}(\\.\\d{1,8})?$",
                        "description": "USD decimal string; never binary floating point."
                    },
                    "currency": {
                        "const": "USD"
                    }
                },
                "required": [
                    "balance",
                    "currency"
                ],
                "additionalProperties": false
            },
            "ActionRequest": {
                "type": "object",
                "properties": {
                    "request": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "order": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "kind": {
                        "enum": [
                            "refill",
                            "cancel"
                        ]
                    },
                    "status": {
                        "enum": [
                            "pending",
                            "completed",
                            "rejected"
                        ]
                    },
                    "created_at": {
                        "anyOf": [
                            {
                                "type": "string",
                                "format": "date-time"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    }
                },
                "required": [
                    "request",
                    "order",
                    "kind",
                    "status",
                    "created_at"
                ],
                "additionalProperties": false
            },
            "DripInput": {
                "type": "object",
                "properties": {
                    "offer_id": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "target": {
                        "type": "string",
                        "maxLength": 2048
                    },
                    "quantity": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "idempotency_key": {
                        "type": "string",
                        "maxLength": 191
                    },
                    "client_ref": {
                        "type": "string",
                        "maxLength": 160
                    },
                    "max_rate": {
                        "type": "string",
                        "pattern": "^\\d{1,12}(\\.\\d{1,8})?$",
                        "description": "USD decimal string; never binary floating point."
                    },
                    "max_total": {
                        "type": "string",
                        "pattern": "^\\d{1,12}(\\.\\d{1,8})?$",
                        "description": "USD decimal string; never binary floating point."
                    },
                    "mode": {
                        "enum": [
                            "scheduled",
                            "service_managed"
                        ]
                    },
                    "runs": {
                        "type": "integer",
                        "minimum": 2,
                        "maximum": 500
                    },
                    "interval_minutes": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 525600
                    }
                },
                "required": [
                    "offer_id",
                    "target",
                    "quantity",
                    "idempotency_key",
                    "mode",
                    "runs",
                    "interval_minutes"
                ],
                "additionalProperties": false
            },
            "DripPlan": {
                "type": "object",
                "properties": {
                    "plan_id": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "status": {
                        "type": "string"
                    },
                    "status_accessibility": {
                        "type": "object"
                    },
                    "paused": {
                        "type": "boolean"
                    },
                    "total_quantity": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "run_count": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "interval_minutes": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "charge_usd": {
                        "type": "string",
                        "pattern": "^\\d{1,12}(\\.\\d{1,8})?$",
                        "description": "USD decimal string; never binary floating point."
                    },
                    "refund_settled_usd": {
                        "type": "string",
                        "pattern": "^\\d{1,12}(\\.\\d{1,8})?$",
                        "description": "USD decimal string; never binary floating point."
                    },
                    "remaining_refund_cap_usd": {
                        "type": "string",
                        "pattern": "^\\d{1,12}(\\.\\d{1,8})?$",
                        "description": "USD decimal string; never binary floating point."
                    },
                    "runs_page": {
                        "type": "object",
                        "properties": {
                            "page": {
                                "type": "integer",
                                "minimum": 1
                            },
                            "per_page": {
                                "type": "integer",
                                "minimum": 1
                            },
                            "last_page": {
                                "type": "integer",
                                "minimum": 1
                            },
                            "total": {
                                "type": "integer",
                                "minimum": 1
                            }
                        },
                        "required": [
                            "page",
                            "per_page",
                            "last_page",
                            "total"
                        ],
                        "additionalProperties": false
                    },
                    "runs": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/DripRun"
                        }
                    },
                    "channel": {
                        "type": "string",
                        "enum": [
                            "api",
                            "website"
                        ]
                    },
                    "authorization_required": {
                        "type": "boolean"
                    }
                },
                "required": [
                    "plan_id",
                    "status",
                    "status_accessibility",
                    "paused",
                    "total_quantity",
                    "run_count",
                    "interval_minutes",
                    "charge_usd",
                    "refund_settled_usd",
                    "remaining_refund_cap_usd",
                    "runs_page",
                    "runs",
                    "channel",
                    "authorization_required"
                ],
                "additionalProperties": false
            },
            "DripRun": {
                "type": "object",
                "properties": {
                    "sequence": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "planned_at": {
                        "anyOf": [
                            {
                                "type": "string",
                                "format": "date-time"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "released_at": {
                        "anyOf": [
                            {
                                "type": "string",
                                "format": "date-time"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "terminal_at": {
                        "anyOf": [
                            {
                                "type": "string",
                                "format": "date-time"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "status": {
                        "type": "string"
                    },
                    "status_accessibility": {
                        "type": "object"
                    },
                    "allocated_quantity": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "allocated_usd": {
                        "type": "string",
                        "pattern": "^\\d{1,12}(\\.\\d{1,8})?$",
                        "description": "USD decimal string; never binary floating point."
                    },
                    "child_order_reference": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "child_status": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "settlement_usd": {
                        "type": "string",
                        "pattern": "^\\d{1,12}(\\.\\d{1,8})?$",
                        "description": "USD decimal string; never binary floating point."
                    },
                    "submitted_at": {
                        "anyOf": [
                            {
                                "type": "string",
                                "format": "date-time"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "delivered_quantity": {
                        "anyOf": [
                            {
                                "type": "integer",
                                "minimum": 0
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "review_required": {
                        "type": "boolean"
                    }
                },
                "required": [
                    "sequence",
                    "planned_at",
                    "released_at",
                    "terminal_at",
                    "status",
                    "status_accessibility",
                    "allocated_quantity",
                    "allocated_usd",
                    "child_order_reference",
                    "child_status",
                    "settlement_usd",
                    "submitted_at",
                    "delivered_quantity",
                    "review_required"
                ],
                "additionalProperties": false
            },
            "Error": {
                "type": "object",
                "properties": {
                    "error": {
                        "type": "string"
                    },
                    "correlation_id": {
                        "type": "string"
                    },
                    "fields": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    }
                },
                "required": [
                    "error"
                ],
                "additionalProperties": false
            },
            "Order": {
                "type": "object",
                "properties": {
                    "order": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "status": {
                        "type": "string"
                    },
                    "charge": {
                        "type": "string",
                        "pattern": "^\\d{1,12}(\\.\\d{1,8})?$",
                        "description": "USD decimal string; never binary floating point."
                    },
                    "returned": {
                        "type": "string",
                        "pattern": "^\\d{1,12}(\\.\\d{1,8})?$",
                        "description": "USD decimal string; never binary floating point."
                    },
                    "quantity": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "start_count": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "From the last verified status poll; 0 before the first."
                    },
                    "remains": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "From the last verified status poll; the whole quantity before the first, 0 once completed."
                    },
                    "currency": {
                        "const": "USD"
                    },
                    "duplicate_flagged": {
                        "type": "boolean"
                    },
                    "client_ref": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "created_at": {
                        "anyOf": [
                            {
                                "type": "string",
                                "format": "date-time"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    }
                },
                "required": [
                    "order",
                    "status",
                    "charge",
                    "returned",
                    "quantity",
                    "currency",
                    "duplicate_flagged",
                    "client_ref",
                    "created_at"
                ],
                "additionalProperties": false
            },
            "OrderInput": {
                "type": "object",
                "properties": {
                    "offer_id": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "target": {
                        "type": "string",
                        "maxLength": 2048
                    },
                    "quantity": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "minimum": 1,
                        "maximum": 1000000000
                    },
                    "details": {
                        "type": "object",
                        "description": "Fields for the enabled service type; see service-input table in phase-08-contracts.md."
                    },
                    "idempotency_key": {
                        "type": "string",
                        "maxLength": 191
                    },
                    "client_ref": {
                        "type": "string",
                        "maxLength": 160
                    },
                    "max_rate": {
                        "type": "string",
                        "pattern": "^\\d{1,12}(\\.\\d{1,8})?$",
                        "description": "Maximum USD per UNIT, not catalogue per-1000 rate."
                    },
                    "max_total": {
                        "type": "string",
                        "pattern": "^\\d{1,12}(\\.\\d{1,8})?$",
                        "description": "USD decimal string; never binary floating point."
                    },
                    "agency_project_id": {
                        "type": "integer",
                        "minimum": 1
                    }
                },
                "required": [
                    "offer_id",
                    "target",
                    "idempotency_key"
                ],
                "additionalProperties": false
            },
            "Service": {
                "type": "object",
                "properties": {
                    "offer_id": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "service": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "name": {
                        "type": "string"
                    },
                    "category": {
                        "type": "string"
                    },
                    "platform": {
                        "type": "string"
                    },
                    "type": {
                        "type": "string"
                    },
                    "unit_rate_usd": {
                        "type": "string",
                        "pattern": "^\\d{1,12}(\\.\\d{1,8})?$",
                        "description": "USD decimal string; never binary floating point."
                    },
                    "rate": {
                        "type": "string",
                        "pattern": "^\\d{1,12}(\\.\\d{1,8})?$",
                        "description": "USD per 1000 units, except package types: per package."
                    },
                    "min": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "max": {
                        "anyOf": [
                            {
                                "type": "integer",
                                "minimum": 1
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "refill": {
                        "type": "boolean",
                        "description": "Whether refills can be requested on this service."
                    },
                    "insights": {
                        "type": "object",
                        "description": "Only for keys granted insights:read (Decision 95): the offer's status and its measured figures over 30 days. measured is null below the minimum sample. Never a provider, route or cost.",
                        "required": [
                            "status",
                            "status_accessibility",
                            "measured",
                            "as_of"
                        ],
                        "properties": {
                            "status": {
                                "enum": [
                                    "available",
                                    "delayed",
                                    "paused",
                                    "under_review",
                                    "insufficient_data"
                                ]
                            },
                            "status_accessibility": {
                                "type": "object"
                            },
                            "measured": {
                                "type": [
                                    "object",
                                    "null"
                                ]
                            },
                            "as_of": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            }
                        }
                    },
                    "cancel": {
                        "type": "boolean",
                        "description": "Whether cancellation can be requested on this service."
                    },
                    "currency": {
                        "const": "USD"
                    }
                },
                "required": [
                    "offer_id",
                    "service",
                    "name",
                    "category",
                    "platform",
                    "type",
                    "unit_rate_usd",
                    "rate",
                    "min",
                    "max",
                    "refill",
                    "cancel",
                    "currency"
                ],
                "additionalProperties": false
            },
            "Subscription": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "offer_id": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "username": {
                        "type": "string"
                    },
                    "label": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "status": {
                        "enum": [
                            "active",
                            "paused",
                            "cancelled"
                        ]
                    },
                    "settings": {
                        "type": "object",
                        "description": "quantity, max_post_usd, max_posts_per_day, monthly_spend_usd, include_reels, timezone=UTC, new_posts_only=true"
                    },
                    "detection": {
                        "type": "object",
                        "description": "Provider-neutral watch state. Only public Instagram Business or Creator accounts can be watched; account_not_supported means personal, private or missing, is rechecked daily and is never charged.",
                        "properties": {
                            "state": {
                                "enum": [
                                    "watching",
                                    "account_not_supported",
                                    "delayed"
                                ]
                            },
                            "message": {
                                "anyOf": [
                                    {
                                        "type": "string"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ]
                            }
                        },
                        "required": [
                            "state",
                            "message"
                        ],
                        "additionalProperties": false
                    },
                    "currency": {
                        "const": "USD"
                    },
                    "created_at": {
                        "anyOf": [
                            {
                                "type": "string",
                                "format": "date-time"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    }
                },
                "required": [
                    "id",
                    "offer_id",
                    "username",
                    "label",
                    "status",
                    "settings",
                    "detection",
                    "currency",
                    "created_at"
                ],
                "additionalProperties": false
            },
            "SubscriptionInput": {
                "type": "object",
                "properties": {
                    "offer_id": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "username": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9._]{1,30}$"
                    },
                    "quantity": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 1000000000
                    },
                    "label": {
                        "type": "string",
                        "maxLength": 160
                    },
                    "agency_project_id": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "idempotency_key": {
                        "type": "string",
                        "maxLength": 191
                    },
                    "max_posts_per_day": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 100
                    },
                    "monthly_spend_usd": {
                        "type": "string",
                        "pattern": "^\\d{1,12}(\\.\\d{1,8})?$",
                        "description": "USD decimal string; never binary floating point."
                    },
                    "max_post_usd": {
                        "type": "string",
                        "pattern": "^\\d{1,12}(\\.\\d{1,8})?$",
                        "description": "USD decimal string; never binary floating point."
                    },
                    "include_reels": {
                        "type": "boolean",
                        "default": false
                    }
                },
                "required": [
                    "offer_id",
                    "username",
                    "quantity",
                    "idempotency_key",
                    "max_posts_per_day",
                    "monthly_spend_usd"
                ],
                "additionalProperties": false
            },
            "SubscriptionPost": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "status": {
                        "enum": [
                            "ordered",
                            "skipped"
                        ]
                    },
                    "reason": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "target": {
                        "type": "string"
                    },
                    "published_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "order": {
                        "anyOf": [
                            {
                                "type": "integer",
                                "minimum": 1
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "charge_usd": {
                        "type": "string",
                        "pattern": "^\\d{1,12}(\\.\\d{1,8})?$",
                        "description": "USD decimal string; never binary floating point."
                    }
                },
                "required": [
                    "id",
                    "status",
                    "reason",
                    "target",
                    "published_at",
                    "order",
                    "charge_usd"
                ],
                "additionalProperties": false
            },
            "WebhookEndpoint": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "url": {
                        "type": "string",
                        "format": "uri"
                    },
                    "events": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "enabled": {
                        "type": "boolean"
                    },
                    "secret_version": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "rotation_pending": {
                        "type": "boolean"
                    }
                },
                "required": [
                    "id",
                    "url",
                    "events",
                    "enabled",
                    "secret_version",
                    "rotation_pending"
                ],
                "additionalProperties": false
            },
            "WebhookEvent": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "version": {
                        "const": 1
                    },
                    "type": {
                        "enum": [
                            "order.status",
                            "order.settled",
                            "service.price_changed",
                            "subscription.changed",
                            "subscription.post",
                            "drip.changed"
                        ]
                    },
                    "occurred_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "data": {
                        "type": "object",
                        "description": "Owner-safe payload by event type; see contract event table."
                    }
                },
                "required": [
                    "id",
                    "version",
                    "type",
                    "occurred_at",
                    "data"
                ],
                "additionalProperties": false
            }
        }
    }
}