{
    "openapi": "3.1.0",
    "info": {
        "title": "MarketThisNow API",
        "version": "1.1.0",
        "description": "REST API for MarketThisNow. Authenticate with a team API key: `Authorization: Bearer mtn_\u2026`. Webhooks are signed \u2014 see https://marketthisnow.com/docs/api."
    },
    "servers": [
        {
            "url": "https://marketthisnow.com/api/v1"
        }
    ],
    "paths": {
        "/me": {
            "get": {
                "summary": "Current team, plan, token scopes and rate limit",
                "tags": [
                    "Account"
                ],
                "description": "Required scope: `read`",
                "security": [
                    {
                        "bearer": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "401": {
                        "description": "Missing/invalid/expired token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Scope, site or IP restriction"
                    },
                    "429": {
                        "description": "Rate limit (see X-RateLimit-* headers)"
                    }
                },
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "description": "Max rows (1\u2013100)",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "since_id",
                        "in": "query",
                        "required": false,
                        "description": "Only rows with id greater than this",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ]
            }
        },
        "/sites": {
            "get": {
                "summary": "List sites",
                "tags": [
                    "Sites"
                ],
                "description": "Required scope: `sites:read`",
                "security": [
                    {
                        "bearer": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "401": {
                        "description": "Missing/invalid/expired token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Scope, site or IP restriction"
                    },
                    "429": {
                        "description": "Rate limit (see X-RateLimit-* headers)"
                    }
                },
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "description": "Max rows (1\u2013100)",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "since_id",
                        "in": "query",
                        "required": false,
                        "description": "Only rows with id greater than this",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ]
            },
            "post": {
                "summary": "Add a site and start a scan",
                "tags": [
                    "Sites"
                ],
                "description": "Required scope: `sites:write`",
                "security": [
                    {
                        "bearer": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "401": {
                        "description": "Missing/invalid/expired token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Scope, site or IP restriction"
                    },
                    "429": {
                        "description": "Rate limit (see X-RateLimit-* headers)"
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/SiteIn"
                            }
                        }
                    }
                }
            }
        },
        "/sites/{id}": {
            "get": {
                "summary": "One site with its latest scan",
                "tags": [
                    "Sites"
                ],
                "description": "Required scope: `sites:read`",
                "security": [
                    {
                        "bearer": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "401": {
                        "description": "Missing/invalid/expired token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Scope, site or IP restriction"
                    },
                    "429": {
                        "description": "Rate limit (see X-RateLimit-* headers)"
                    }
                },
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ]
            }
        },
        "/sites/{id}/report": {
            "get": {
                "summary": "Latest research report",
                "tags": [
                    "Sites"
                ],
                "description": "Required scope: `sites:read`",
                "security": [
                    {
                        "bearer": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "401": {
                        "description": "Missing/invalid/expired token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Scope, site or IP restriction"
                    },
                    "429": {
                        "description": "Rate limit (see X-RateLimit-* headers)"
                    }
                },
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ]
            }
        },
        "/sites/{id}/plan": {
            "get": {
                "summary": "Latest marketing plan with items",
                "tags": [
                    "Sites"
                ],
                "description": "Required scope: `sites:read`",
                "security": [
                    {
                        "bearer": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "401": {
                        "description": "Missing/invalid/expired token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Scope, site or IP restriction"
                    },
                    "429": {
                        "description": "Rate limit (see X-RateLimit-* headers)"
                    }
                },
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ]
            }
        },
        "/sites/{id}/stats": {
            "get": {
                "summary": "Real tracked stats (?days=30)",
                "tags": [
                    "Sites"
                ],
                "description": "Required scope: `sites:read`",
                "security": [
                    {
                        "bearer": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "401": {
                        "description": "Missing/invalid/expired token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Scope, site or IP restriction"
                    },
                    "429": {
                        "description": "Rate limit (see X-RateLimit-* headers)"
                    }
                },
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ]
            }
        },
        "/sites/{id}/content": {
            "get": {
                "summary": "List content (?status=, ?since_id=, ?limit=)",
                "tags": [
                    "Content"
                ],
                "description": "Required scope: `content:read`",
                "security": [
                    {
                        "bearer": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "401": {
                        "description": "Missing/invalid/expired token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Scope, site or IP restriction"
                    },
                    "429": {
                        "description": "Rate limit (see X-RateLimit-* headers)"
                    }
                },
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "description": "Max rows (1\u2013100)",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "since_id",
                        "in": "query",
                        "required": false,
                        "description": "Only rows with id greater than this",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ]
            },
            "post": {
                "summary": "Create a draft (body) or generate one (brief); submit=true sends it for approval",
                "tags": [
                    "Content"
                ],
                "description": "Required scope: `content:write`",
                "security": [
                    {
                        "bearer": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "401": {
                        "description": "Missing/invalid/expired token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Scope, site or IP restriction"
                    },
                    "429": {
                        "description": "Rate limit (see X-RateLimit-* headers)"
                    }
                },
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/ContentIn"
                            }
                        }
                    }
                }
            }
        },
        "/content/{id}/approve": {
            "post": {
                "summary": "Approve a draft/pending post",
                "tags": [
                    "Content"
                ],
                "description": "Required scope: `content:write`",
                "security": [
                    {
                        "bearer": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "401": {
                        "description": "Missing/invalid/expired token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Scope, site or IP restriction"
                    },
                    "429": {
                        "description": "Rate limit (see X-RateLimit-* headers)"
                    }
                },
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ]
            }
        },
        "/sites/{id}/videos": {
            "get": {
                "summary": "List videos",
                "tags": [
                    "Content"
                ],
                "description": "Required scope: `content:read`",
                "security": [
                    {
                        "bearer": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "401": {
                        "description": "Missing/invalid/expired token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Scope, site or IP restriction"
                    },
                    "429": {
                        "description": "Rate limit (see X-RateLimit-* headers)"
                    }
                },
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ]
            }
        },
        "/sites/{id}/events": {
            "post": {
                "summary": "Record a lead/sale/custom event",
                "tags": [
                    "Tracking"
                ],
                "description": "Required scope: `events:write`",
                "security": [
                    {
                        "bearer": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "401": {
                        "description": "Missing/invalid/expired token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Scope, site or IP restriction"
                    },
                    "429": {
                        "description": "Rate limit (see X-RateLimit-* headers)"
                    }
                },
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/EventIn"
                            }
                        }
                    }
                }
            }
        },
        "/lists": {
            "get": {
                "summary": "Email lists with subscriber counts",
                "tags": [
                    "Leads"
                ],
                "description": "Required scope: `leads:read`",
                "security": [
                    {
                        "bearer": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "401": {
                        "description": "Missing/invalid/expired token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Scope, site or IP restriction"
                    },
                    "429": {
                        "description": "Rate limit (see X-RateLimit-* headers)"
                    }
                },
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "description": "Max rows (1\u2013100)",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "since_id",
                        "in": "query",
                        "required": false,
                        "description": "Only rows with id greater than this",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ]
            }
        },
        "/leads": {
            "get": {
                "summary": "Latest subscribers across lists",
                "tags": [
                    "Leads"
                ],
                "description": "Required scope: `leads:read`",
                "security": [
                    {
                        "bearer": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "401": {
                        "description": "Missing/invalid/expired token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Scope, site or IP restriction"
                    },
                    "429": {
                        "description": "Rate limit (see X-RateLimit-* headers)"
                    }
                },
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "description": "Max rows (1\u2013100)",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "since_id",
                        "in": "query",
                        "required": false,
                        "description": "Only rows with id greater than this",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ]
            }
        },
        "/lists/{id}/subscribers": {
            "post": {
                "summary": "Subscribe someone (double opt-in rules apply)",
                "tags": [
                    "Leads"
                ],
                "description": "Required scope: `leads:write`",
                "security": [
                    {
                        "bearer": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "401": {
                        "description": "Missing/invalid/expired token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Scope, site or IP restriction"
                    },
                    "429": {
                        "description": "Rate limit (see X-RateLimit-* headers)"
                    }
                },
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/SubscriberIn"
                            }
                        }
                    }
                }
            }
        },
        "/contacts": {
            "get": {
                "summary": "CRM contacts (?email= to find one)",
                "tags": [
                    "CRM"
                ],
                "description": "Required scope: `crm:read`",
                "security": [
                    {
                        "bearer": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "401": {
                        "description": "Missing/invalid/expired token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Scope, site or IP restriction"
                    },
                    "429": {
                        "description": "Rate limit (see X-RateLimit-* headers)"
                    }
                },
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "description": "Max rows (1\u2013100)",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "since_id",
                        "in": "query",
                        "required": false,
                        "description": "Only rows with id greater than this",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ]
            },
            "post": {
                "summary": "Create or update a contact (matched by email)",
                "tags": [
                    "CRM"
                ],
                "description": "Required scope: `crm:write`",
                "security": [
                    {
                        "bearer": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "401": {
                        "description": "Missing/invalid/expired token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Scope, site or IP restriction"
                    },
                    "429": {
                        "description": "Rate limit (see X-RateLimit-* headers)"
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/ContactIn"
                            }
                        }
                    }
                }
            }
        },
        "/contacts/{id}": {
            "get": {
                "summary": "One CRM contact",
                "tags": [
                    "CRM"
                ],
                "description": "Required scope: `crm:read`",
                "security": [
                    {
                        "bearer": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "401": {
                        "description": "Missing/invalid/expired token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Scope, site or IP restriction"
                    },
                    "429": {
                        "description": "Rate limit (see X-RateLimit-* headers)"
                    }
                },
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ]
            }
        },
        "/deals": {
            "get": {
                "summary": "CRM deals (?stage=)",
                "tags": [
                    "CRM"
                ],
                "description": "Required scope: `crm:read`",
                "security": [
                    {
                        "bearer": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "401": {
                        "description": "Missing/invalid/expired token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Scope, site or IP restriction"
                    },
                    "429": {
                        "description": "Rate limit (see X-RateLimit-* headers)"
                    }
                },
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "description": "Max rows (1\u2013100)",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "since_id",
                        "in": "query",
                        "required": false,
                        "description": "Only rows with id greater than this",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ]
            },
            "post": {
                "summary": "Create a deal",
                "tags": [
                    "CRM"
                ],
                "description": "Required scope: `crm:write`",
                "security": [
                    {
                        "bearer": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "401": {
                        "description": "Missing/invalid/expired token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Scope, site or IP restriction"
                    },
                    "429": {
                        "description": "Rate limit (see X-RateLimit-* headers)"
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/DealIn"
                            }
                        }
                    }
                }
            }
        },
        "/deals/{id}": {
            "patch": {
                "summary": "Update a deal (stage, value, title)",
                "tags": [
                    "CRM"
                ],
                "description": "Required scope: `crm:write`",
                "security": [
                    {
                        "bearer": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "401": {
                        "description": "Missing/invalid/expired token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Scope, site or IP restriction"
                    },
                    "429": {
                        "description": "Rate limit (see X-RateLimit-* headers)"
                    }
                },
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/DealPatch"
                            }
                        }
                    }
                }
            }
        },
        "/bookings": {
            "get": {
                "summary": "Calendar bookings",
                "tags": [
                    "CRM"
                ],
                "description": "Required scope: `crm:read`",
                "security": [
                    {
                        "bearer": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "401": {
                        "description": "Missing/invalid/expired token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Scope, site or IP restriction"
                    },
                    "429": {
                        "description": "Rate limit (see X-RateLimit-* headers)"
                    }
                },
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "description": "Max rows (1\u2013100)",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "since_id",
                        "in": "query",
                        "required": false,
                        "description": "Only rows with id greater than this",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ]
            }
        },
        "/affiliates/conversions": {
            "post": {
                "summary": "Record an affiliate conversion",
                "tags": [
                    "Affiliates"
                ],
                "description": "Required scope: `affiliates:write`",
                "security": [
                    {
                        "bearer": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "401": {
                        "description": "Missing/invalid/expired token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Scope, site or IP restriction"
                    },
                    "429": {
                        "description": "Rate limit (see X-RateLimit-* headers)"
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/ConversionIn"
                            }
                        }
                    }
                }
            }
        },
        "/events/types": {
            "get": {
                "summary": "Event types available for webhooks/triggers",
                "tags": [
                    "Webhooks"
                ],
                "description": "Required scope: `hooks:read`",
                "security": [
                    {
                        "bearer": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "401": {
                        "description": "Missing/invalid/expired token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Scope, site or IP restriction"
                    },
                    "429": {
                        "description": "Rate limit (see X-RateLimit-* headers)"
                    }
                },
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "description": "Max rows (1\u2013100)",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "since_id",
                        "in": "query",
                        "required": false,
                        "description": "Only rows with id greater than this",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ]
            }
        },
        "/triggers/{event}": {
            "get": {
                "summary": "Recent events of one type (polling / samples)",
                "tags": [
                    "Webhooks"
                ],
                "description": "Required scope: `hooks:read`",
                "security": [
                    {
                        "bearer": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "401": {
                        "description": "Missing/invalid/expired token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Scope, site or IP restriction"
                    },
                    "429": {
                        "description": "Rate limit (see X-RateLimit-* headers)"
                    }
                },
                "parameters": [
                    {
                        "name": "event",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "description": "Max rows (1\u2013100)",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "since_id",
                        "in": "query",
                        "required": false,
                        "description": "Only rows with id greater than this",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ]
            }
        },
        "/hooks": {
            "get": {
                "summary": "List webhook subscriptions",
                "tags": [
                    "Webhooks"
                ],
                "description": "Required scope: `hooks:read`",
                "security": [
                    {
                        "bearer": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "401": {
                        "description": "Missing/invalid/expired token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Scope, site or IP restriction"
                    },
                    "429": {
                        "description": "Rate limit (see X-RateLimit-* headers)"
                    }
                },
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "description": "Max rows (1\u2013100)",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "since_id",
                        "in": "query",
                        "required": false,
                        "description": "Only rows with id greater than this",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ]
            },
            "post": {
                "summary": "Subscribe a URL to an event (REST hook)",
                "tags": [
                    "Webhooks"
                ],
                "description": "Required scope: `hooks:write`",
                "security": [
                    {
                        "bearer": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "401": {
                        "description": "Missing/invalid/expired token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Scope, site or IP restriction"
                    },
                    "429": {
                        "description": "Rate limit (see X-RateLimit-* headers)"
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/HookIn"
                            }
                        }
                    }
                }
            }
        },
        "/hooks/{id}": {
            "delete": {
                "summary": "Unsubscribe",
                "tags": [
                    "Webhooks"
                ],
                "description": "Required scope: `hooks:write`",
                "security": [
                    {
                        "bearer": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "401": {
                        "description": "Missing/invalid/expired token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Scope, site or IP restriction"
                    },
                    "429": {
                        "description": "Rate limit (see X-RateLimit-* headers)"
                    }
                },
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ]
            }
        }
    },
    "components": {
        "securitySchemes": {
            "bearer": {
                "type": "http",
                "scheme": "bearer",
                "description": "Team API key (mtn_\u2026) from Growth \u2192 API & webhooks"
            }
        },
        "schemas": {
            "SiteIn": {
                "type": "object",
                "properties": {
                    "url": {
                        "type": "string"
                    },
                    "goal": {
                        "type": "string",
                        "enum": [
                            "leads",
                            "sales",
                            "signups",
                            "traffic",
                            "bookings"
                        ]
                    },
                    "monthly_budget": {
                        "type": "number"
                    },
                    "currency": {
                        "type": "string",
                        "enum": [
                            "GBP",
                            "USD",
                            "EUR"
                        ]
                    }
                },
                "required": [
                    "url"
                ]
            },
            "ContentIn": {
                "type": "object",
                "properties": {
                    "channel": {
                        "type": "string"
                    },
                    "kind": {
                        "type": "string"
                    },
                    "title": {
                        "type": "string"
                    },
                    "body": {
                        "type": "string"
                    },
                    "brief": {
                        "type": "string"
                    },
                    "link": {
                        "type": "string"
                    },
                    "submit": {
                        "type": "boolean"
                    }
                }
            },
            "EventIn": {
                "type": "object",
                "properties": {
                    "type": {
                        "type": "string",
                        "enum": [
                            "lead",
                            "sale",
                            "custom"
                        ]
                    },
                    "name": {
                        "type": "string"
                    },
                    "value": {
                        "type": "number"
                    },
                    "channel": {
                        "type": "string"
                    },
                    "utm_source": {
                        "type": "string"
                    },
                    "utm_campaign": {
                        "type": "string"
                    }
                },
                "required": [
                    "type"
                ]
            },
            "SubscriberIn": {
                "type": "object",
                "properties": {
                    "email": {
                        "type": "string"
                    },
                    "name": {
                        "type": "string"
                    }
                },
                "required": [
                    "email"
                ]
            },
            "ContactIn": {
                "type": "object",
                "properties": {
                    "site_id": {
                        "type": "integer"
                    },
                    "email": {
                        "type": "string"
                    },
                    "name": {
                        "type": "string"
                    },
                    "phone": {
                        "type": "string"
                    },
                    "company": {
                        "type": "string"
                    },
                    "tags": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "note": {
                        "type": "string"
                    }
                }
            },
            "DealIn": {
                "type": "object",
                "properties": {
                    "site_id": {
                        "type": "integer"
                    },
                    "title": {
                        "type": "string"
                    },
                    "value": {
                        "type": "number"
                    },
                    "stage": {
                        "type": "string",
                        "enum": [
                            "lead",
                            "qualified",
                            "proposal",
                            "negotiation",
                            "won",
                            "lost"
                        ]
                    },
                    "contact_id": {
                        "type": "integer"
                    },
                    "close_date": {
                        "type": "string",
                        "format": "date"
                    }
                },
                "required": [
                    "title"
                ]
            },
            "DealPatch": {
                "type": "object",
                "properties": {
                    "title": {
                        "type": "string"
                    },
                    "value": {
                        "type": "number"
                    },
                    "stage": {
                        "type": "string",
                        "enum": [
                            "lead",
                            "qualified",
                            "proposal",
                            "negotiation",
                            "won",
                            "lost"
                        ]
                    }
                }
            },
            "ConversionIn": {
                "type": "object",
                "properties": {
                    "program_id": {
                        "type": "integer"
                    },
                    "partner_code": {
                        "type": "string"
                    },
                    "order_ref": {
                        "type": "string"
                    },
                    "amount": {
                        "type": "number"
                    },
                    "customer_ref": {
                        "type": "string"
                    }
                },
                "required": [
                    "program_id",
                    "partner_code",
                    "amount"
                ]
            },
            "HookIn": {
                "type": "object",
                "properties": {
                    "target_url": {
                        "type": "string",
                        "format": "uri"
                    },
                    "event": {
                        "type": "string",
                        "enum": [
                            "*",
                            "lead.tracked",
                            "sale.tracked",
                            "booking.created",
                            "ugc.submitted",
                            "uptime.down",
                            "uptime.up",
                            "dsar.request",
                            "lead.created",
                            "content.published",
                            "content.pending_approval",
                            "scan.completed",
                            "video.ready",
                            "review.new",
                            "mention.new",
                            "competitor.change",
                            "social.message",
                            "affiliate.conversion",
                            "order.paid",
                            "order.created",
                            "webinar.registered",
                            "crm.contact.created",
                            "crm.deal.stage_changed",
                            "support.handoff",
                            "translation.ready"
                        ]
                    },
                    "site_id": {
                        "type": "integer"
                    },
                    "source": {
                        "type": "string"
                    }
                },
                "required": [
                    "target_url",
                    "event"
                ]
            },
            "Error": {
                "type": "object",
                "properties": {
                    "error": {
                        "type": "string"
                    }
                }
            }
        }
    },
    "x-webhooks": {
        "signature": "X-MTN-Signature-256: t=<unix>,v2=hex(HMAC_SHA256(secret, \"<t>.<raw body>\")) \u2014 also legacy X-MTN-Signature: sha256=hex(HMAC_SHA256(secret, raw body))",
        "events": {
            "lead.tracked": "A lead is tracked by the snippet",
            "sale.tracked": "A sale is tracked by the snippet",
            "booking.created": "A meeting is booked",
            "ugc.submitted": "A customer photo/video review arrives",
            "uptime.down": "A monitored site goes down",
            "uptime.up": "A monitored site recovers",
            "dsar.request": "A verified privacy (DSAR) request arrives",
            "lead.created": "A lead signs up (list form, landing page or chatbot)",
            "content.published": "Content is published to a channel",
            "content.pending_approval": "Content is waiting for approval",
            "scan.completed": "A website scan finished",
            "video.ready": "A video finished rendering",
            "review.new": "A new review was found",
            "mention.new": "A new brand mention was found",
            "competitor.change": "A competitor watch detected a change",
            "social.message": "A new comment/mention/DM arrived",
            "affiliate.conversion": "An affiliate conversion was recorded",
            "order.paid": "A services order was paid",
            "order.created": "A services order was created",
            "webinar.registered": "Someone registered for a webinar",
            "crm.contact.created": "A CRM contact was created",
            "crm.deal.stage_changed": "A CRM deal moved stage",
            "support.handoff": "A support chat visitor asked for a human",
            "translation.ready": "A translation is ready for review"
        }
    }
}