{
  "openapi": "3.1.0",
  "info": {
    "title": "Upnatus API",
    "version": "v1"
  },
  "paths": {
    "/v1/clients/{client_id}/key-pages": {
      "post": {
        "operationId": "add_key_page",
        "summary": "Adds a page of the business's own website to the key pages (at most 20). The address is tidied: no query, no fragment, no closing slash. Role: home, money (the page that sells), supporting or other.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 300
                  },
                  "role": {
                    "default": "other",
                    "type": "string",
                    "enum": [
                      "home",
                      "money",
                      "supporting",
                      "other"
                    ]
                  }
                },
                "required": [
                  "url"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "key_pages": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "url": {
                            "type": "string"
                          },
                          "role": {
                            "type": "string",
                            "enum": [
                              "home",
                              "money",
                              "supporting",
                              "other"
                            ]
                          }
                        },
                        "required": [
                          "url",
                          "role"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "key_pages"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "set_key_page_role",
        "summary": "Changes the role of a key page: home, money, supporting or other.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 300
                  },
                  "role": {
                    "type": "string",
                    "enum": [
                      "home",
                      "money",
                      "supporting",
                      "other"
                    ]
                  }
                },
                "required": [
                  "url",
                  "role"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "key_pages": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "url": {
                            "type": "string"
                          },
                          "role": {
                            "type": "string",
                            "enum": [
                              "home",
                              "money",
                              "supporting",
                              "other"
                            ]
                          }
                        },
                        "required": [
                          "url",
                          "role"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "key_pages"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/tracking/questions/add": {
      "post": {
        "operationId": "add_tracked_questions",
        "summary": "Adds up to 5 questions the AI assistants are asked about this business on every round of the plan (every 3 days on current plans; `limits.prompt_every_days` of list_tracking says), each with an optional topic (the shared name of a few questions). A new question is asked on the assistants the other questions are asked on (every assistant of the plan while the list is empty). Each assistant of each question is one of the checks of a round (list_tracking says how many are used); a list that needs more is refused and nothing is added. A question that is on the list already is skipped. The change counts from the next round.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "questions": {
                    "minItems": 1,
                    "maxItems": 5,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "text": {
                          "type": "string"
                        },
                        "topic": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "text"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "questions"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "keywords": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "text": {
                            "type": "string"
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "scan",
                              "customer"
                            ]
                          },
                          "added_at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "engines": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "location_code": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "device": {
                            "type": "string",
                            "enum": [
                              "desktop",
                              "mobile",
                              "both"
                            ]
                          },
                          "first_read": {
                            "type": "string",
                            "enum": [
                              "done",
                              "soon",
                              "monday"
                            ]
                          }
                        },
                        "required": [
                          "text",
                          "source",
                          "added_at",
                          "engines",
                          "location_code",
                          "device",
                          "first_read"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "prompts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "text": {
                            "type": "string"
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "scan",
                              "customer"
                            ]
                          },
                          "added_at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "engines": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "topic": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "paused": {
                            "type": "boolean"
                          },
                          "branded": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "text",
                          "source",
                          "added_at",
                          "engines",
                          "topic",
                          "paused",
                          "branded"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "limits": {
                      "type": "object",
                      "properties": {
                        "keywords": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "prompts": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "engines": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "competitors": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "keyword_every_days": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        "prompt_every_days": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        "keyword_checks": {
                          "type": "object",
                          "properties": {
                            "used": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "max": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "used",
                            "max"
                          ],
                          "additionalProperties": false
                        },
                        "prompt_checks": {
                          "type": "object",
                          "properties": {
                            "used": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "max": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "used",
                            "max"
                          ],
                          "additionalProperties": false
                        },
                        "keyword_engines": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "prompt_engines": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "addons": {
                          "type": "object",
                          "properties": {
                            "active": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "keyword_checks",
                                      "grid_checks"
                                    ]
                                  },
                                  "checks": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "expires_at": {
                                    "type": "string",
                                    "format": "date-time"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "checks",
                                  "expires_at"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "offers": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "keyword_checks",
                                      "grid_checks"
                                    ]
                                  },
                                  "checks": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "credits": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "days": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "kind",
                                  "checks",
                                  "credits",
                                  "days"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "active",
                            "offers"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "keywords",
                        "prompts",
                        "engines",
                        "competitors",
                        "keyword_every_days",
                        "prompt_every_days",
                        "keyword_checks",
                        "prompt_checks",
                        "keyword_engines",
                        "prompt_engines",
                        "addons"
                      ],
                      "additionalProperties": false
                    },
                    "competitors": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "domain": {
                                "type": "string"
                              },
                              "name": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "source": {
                                "type": "string",
                                "enum": [
                                  "scan",
                                  "customer"
                                ]
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "suggested",
                                  "tracked"
                                ]
                              }
                            },
                            "required": [
                              "domain",
                              "name",
                              "source",
                              "status"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "limit": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "edited": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "items",
                        "limit",
                        "edited"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "keywords",
                    "prompts",
                    "limits",
                    "competitors"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/analysis": {
      "get": {
        "operationId": "analyze_account",
        "summary": "Returns the findings of the latest analysis of a business. Empty until the first analysis has run.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": [
                        "not_ready",
                        "ready"
                      ]
                    },
                    "findings": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "finding_ref": {
                            "type": "string"
                          },
                          "client_id": {
                            "type": "string"
                          },
                          "channel": {
                            "type": "string",
                            "enum": [
                              "google_ads",
                              "meta_ads",
                              "openai_ads",
                              "linkedin_ads",
                              "seo",
                              "geo",
                              "site",
                              "tracking",
                              "cross"
                            ]
                          },
                          "area": {
                            "type": "string",
                            "enum": [
                              "preflight",
                              "tracking",
                              "waste",
                              "search_terms",
                              "bidding",
                              "budget",
                              "placement",
                              "targeting",
                              "lead_quality",
                              "landing_page",
                              "structure",
                              "creative",
                              "platform_change",
                              "seo",
                              "geo",
                              "competitor"
                            ]
                          },
                          "severity": {
                            "type": "number"
                          },
                          "safety": {
                            "type": "boolean"
                          },
                          "priority": {
                            "type": "number"
                          },
                          "entity": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "level": {
                                    "type": "string"
                                  },
                                  "id": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "level",
                                  "id",
                                  "label"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "lifecycle": {
                            "type": "string"
                          },
                          "certainty": {
                            "type": "string",
                            "enum": [
                              "established",
                              "likely",
                              "hypothesis",
                              "unknown"
                            ]
                          },
                          "window": {
                            "type": "object",
                            "properties": {
                              "start": {
                                "type": "string"
                              },
                              "end": {
                                "type": "string"
                              },
                              "timezone": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "start",
                              "end",
                              "timezone"
                            ],
                            "additionalProperties": false
                          },
                          "lang": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "summary": {
                            "type": "string"
                          },
                          "claims": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "claim_id": {
                                  "type": "string"
                                },
                                "kind": {
                                  "type": "string"
                                },
                                "text": {
                                  "type": "string"
                                },
                                "certainty": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "claim_id",
                                "kind",
                                "text",
                                "certainty"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "facts": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "fact_id": {
                                  "type": "string"
                                },
                                "label": {
                                  "type": "string"
                                },
                                "value": {
                                  "type": [
                                    "number",
                                    "string",
                                    "null"
                                  ]
                                },
                                "unit": {
                                  "type": "string"
                                },
                                "window": {
                                  "type": "object",
                                  "properties": {
                                    "from": {
                                      "type": "string"
                                    },
                                    "to": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "from",
                                    "to"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "required": [
                                "fact_id",
                                "label",
                                "value",
                                "unit"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "counter_facts": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "fact_id": {
                                  "type": "string"
                                },
                                "label": {
                                  "type": "string"
                                },
                                "value": {
                                  "type": [
                                    "number",
                                    "string",
                                    "null"
                                  ]
                                },
                                "unit": {
                                  "type": "string"
                                },
                                "window": {
                                  "type": "object",
                                  "properties": {
                                    "from": {
                                      "type": "string"
                                    },
                                    "to": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "from",
                                    "to"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "required": [
                                "fact_id",
                                "label",
                                "value",
                                "unit"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "limits": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "money": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string"
                                  },
                                  "fact_id": {
                                    "type": "string"
                                  },
                                  "currency": {
                                    "type": "string"
                                  },
                                  "basis": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "fact_id",
                                  "currency",
                                  "basis"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "alternatives": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "text": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "text"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "questions": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "question_key": {
                                  "type": "string"
                                },
                                "text": {
                                  "type": "string"
                                },
                                "why": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "question_key",
                                "text",
                                "why"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "do_not": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "key": {
                                  "type": "string"
                                },
                                "text": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "key",
                                "text"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "suggested": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "type"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "data_as_of": {
                            "type": "string"
                          },
                          "stale_after": {
                            "type": "string"
                          },
                          "first_seen_at": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "finding_ref",
                          "client_id",
                          "channel",
                          "area",
                          "severity",
                          "safety",
                          "priority",
                          "entity",
                          "lifecycle",
                          "certainty",
                          "window",
                          "lang",
                          "title",
                          "summary",
                          "claims",
                          "facts",
                          "counter_facts",
                          "limits",
                          "money",
                          "alternatives",
                          "questions",
                          "do_not",
                          "suggested",
                          "data_as_of",
                          "stale_after",
                          "first_seen_at"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "status",
                    "findings"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/actions/{action_id}/approve": {
      "post": {
        "operationId": "approve_action",
        "summary": "A person approves one change, on the card they were shown.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "action_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "card_sha256": {
                    "type": "string"
                  },
                  "lang": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 35
                  },
                  "acks": {
                    "maxItems": 8,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 40
                    }
                  },
                  "typed_amount_minor": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "action_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "client_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "asset_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "platform": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "ADD_NEGATIVE",
                        "PAUSE_KEYWORD",
                        "PAUSE_AD",
                        "PAUSE_ADSET",
                        "PAUSE_CAMPAIGN",
                        "SET_BUDGET",
                        "SET_MAX_CPC",
                        "ENABLE_ENTITY",
                        "SET_NETWORKS",
                        "SET_GEO_PRESENCE",
                        "ADD_KEYWORD",
                        "SET_BID_STRATEGY",
                        "SET_PLACEMENTS",
                        "SET_AUDIENCE_OPTION",
                        "SET_CREATIVE_FEATURES",
                        "CREATE_CAMPAIGN_DRAFT",
                        "CREATE_AD_DRAFT",
                        "LAUNCH_CAMPAIGN"
                      ]
                    },
                    "direction": {
                      "type": "string",
                      "enum": [
                        "increase",
                        "decrease",
                        "neutral"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "blocked",
                        "pending",
                        "approved",
                        "auto_queued",
                        "executing",
                        "done",
                        "failed",
                        "unknown",
                        "rejected",
                        "expired",
                        "withdrawn",
                        "superseded"
                      ]
                    },
                    "reason_codes": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "not_enough_data",
                          "too_soon_after_last_change",
                          "over_limit",
                          "cap_required",
                          "cap_would_be_exceeded",
                          "account_paused",
                          "tracking_unhealthy",
                          "stale_data",
                          "conflicts_open_change",
                          "unit_or_scale_suspect",
                          "shared_budget",
                          "drift",
                          "platform_refused",
                          "account_not_enabled",
                          "object_missing",
                          "already_undone",
                          "write_gate_closed",
                          "asset_not_linked",
                          "one_click_required",
                          "autopilot_stopped",
                          "hands_off",
                          "shift_waiting",
                          "area_not_approved"
                        ]
                      }
                    },
                    "approval_level": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "operator",
                            "owner_admin"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "before": {
                      "anyOf": [
                        {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "after": {
                      "anyOf": [
                        {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "params": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "card_body": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "card_sha256": {
                      "type": "string"
                    },
                    "undo_of": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "undone_by": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "retry_of": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "supersedes": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "is_noop": {
                      "type": "boolean"
                    },
                    "emergency": {
                      "type": "boolean"
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "applied_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "expected_current": {
                      "anyOf": [
                        {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "before_after": {
                      "type": "object",
                      "properties": {
                        "before": {
                          "type": "string",
                          "minLength": 1
                        },
                        "after": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "required": [
                        "before",
                        "after"
                      ],
                      "additionalProperties": false
                    },
                    "undo": {
                      "type": "object",
                      "properties": {
                        "possible": {
                          "type": "boolean"
                        },
                        "until": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "note": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "required": [
                        "possible",
                        "until",
                        "note"
                      ],
                      "additionalProperties": false
                    },
                    "note": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "approved_by": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "approved_via": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "panel",
                            "email_link"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "approved_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "currency": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "action_id",
                    "client_id",
                    "asset_id",
                    "platform",
                    "type",
                    "direction",
                    "status",
                    "reason_codes",
                    "approval_level",
                    "before",
                    "after",
                    "params",
                    "card_body",
                    "card_sha256",
                    "undo_of",
                    "undone_by",
                    "retry_of",
                    "supersedes",
                    "is_noop",
                    "emergency",
                    "created_at",
                    "applied_at",
                    "expected_current",
                    "before_after",
                    "undo",
                    "note",
                    "approved_by",
                    "approved_via",
                    "approved_at",
                    "currency"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/approve/{token}": {
      "post": {
        "operationId": "approve_action_link",
        "summary": "A one-time link approves the one change it was made for.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "card_sha256": {
                    "type": "string"
                  },
                  "lang": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 35
                  },
                  "acks": {
                    "maxItems": 8,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 40
                    }
                  },
                  "typed_amount_minor": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "action_id"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "action_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "client_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "asset_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "platform": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "ADD_NEGATIVE",
                        "PAUSE_KEYWORD",
                        "PAUSE_AD",
                        "PAUSE_ADSET",
                        "PAUSE_CAMPAIGN",
                        "SET_BUDGET",
                        "SET_MAX_CPC",
                        "ENABLE_ENTITY",
                        "SET_NETWORKS",
                        "SET_GEO_PRESENCE",
                        "ADD_KEYWORD",
                        "SET_BID_STRATEGY",
                        "SET_PLACEMENTS",
                        "SET_AUDIENCE_OPTION",
                        "SET_CREATIVE_FEATURES",
                        "CREATE_CAMPAIGN_DRAFT",
                        "CREATE_AD_DRAFT",
                        "LAUNCH_CAMPAIGN"
                      ]
                    },
                    "direction": {
                      "type": "string",
                      "enum": [
                        "increase",
                        "decrease",
                        "neutral"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "blocked",
                        "pending",
                        "approved",
                        "auto_queued",
                        "executing",
                        "done",
                        "failed",
                        "unknown",
                        "rejected",
                        "expired",
                        "withdrawn",
                        "superseded"
                      ]
                    },
                    "reason_codes": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "not_enough_data",
                          "too_soon_after_last_change",
                          "over_limit",
                          "cap_required",
                          "cap_would_be_exceeded",
                          "account_paused",
                          "tracking_unhealthy",
                          "stale_data",
                          "conflicts_open_change",
                          "unit_or_scale_suspect",
                          "shared_budget",
                          "drift",
                          "platform_refused",
                          "account_not_enabled",
                          "object_missing",
                          "already_undone",
                          "write_gate_closed",
                          "asset_not_linked",
                          "one_click_required",
                          "autopilot_stopped",
                          "hands_off",
                          "shift_waiting",
                          "area_not_approved"
                        ]
                      }
                    },
                    "approval_level": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "operator",
                            "owner_admin"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "before": {
                      "anyOf": [
                        {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "after": {
                      "anyOf": [
                        {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "params": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "card_body": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "card_sha256": {
                      "type": "string"
                    },
                    "undo_of": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "undone_by": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "retry_of": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "supersedes": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "is_noop": {
                      "type": "boolean"
                    },
                    "emergency": {
                      "type": "boolean"
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "applied_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "expected_current": {
                      "anyOf": [
                        {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "before_after": {
                      "type": "object",
                      "properties": {
                        "before": {
                          "type": "string",
                          "minLength": 1
                        },
                        "after": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "required": [
                        "before",
                        "after"
                      ],
                      "additionalProperties": false
                    },
                    "undo": {
                      "type": "object",
                      "properties": {
                        "possible": {
                          "type": "boolean"
                        },
                        "until": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "note": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "required": [
                        "possible",
                        "until",
                        "note"
                      ],
                      "additionalProperties": false
                    },
                    "note": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "approved_by": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "approved_via": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "panel",
                            "email_link"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "approved_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "currency": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "action_id",
                    "client_id",
                    "asset_id",
                    "platform",
                    "type",
                    "direction",
                    "status",
                    "reason_codes",
                    "approval_level",
                    "before",
                    "after",
                    "params",
                    "card_body",
                    "card_sha256",
                    "undo_of",
                    "undone_by",
                    "retry_of",
                    "supersedes",
                    "is_noop",
                    "emergency",
                    "created_at",
                    "applied_at",
                    "expected_current",
                    "before_after",
                    "undo",
                    "note",
                    "approved_by",
                    "approved_via",
                    "approved_at",
                    "currency"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/campaign-creatives/{creative_id}/approve": {
      "post": {
        "operationId": "approve_creative",
        "summary": "A person approves one ad text for a planned campaign. An agent cannot do this: the page of approvals is where a person decides.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "creative_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "draft_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "client_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "asset_id": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "platform": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "plan": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "creatives": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "creative_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "status": {
                            "type": "string"
                          },
                          "angle": {
                            "type": "string"
                          },
                          "headlines": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "descriptions": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "brief": {}
                        },
                        "required": [
                          "creative_id",
                          "status",
                          "angle",
                          "headlines",
                          "descriptions",
                          "brief"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "preflight": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "ok": {
                              "type": "boolean"
                            },
                            "checked_at": {
                              "type": "string"
                            },
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "n": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "group": {
                                    "type": "string"
                                  },
                                  "ok": {
                                    "type": "boolean"
                                  },
                                  "why": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "fix": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "n",
                                  "group",
                                  "ok",
                                  "why",
                                  "fix"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "ok",
                            "checked_at",
                            "items"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "delivery": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "looks": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "hours": {
                                    "type": "number"
                                  },
                                  "at": {
                                    "type": "string"
                                  },
                                  "status": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "issues": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  },
                                  "impressions": {
                                    "type": [
                                      "number",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "hours",
                                  "at",
                                  "status",
                                  "issues",
                                  "impressions"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "warnings": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "code": {
                                    "type": "string"
                                  },
                                  "at": {
                                    "type": "string"
                                  },
                                  "message": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "code",
                                  "at",
                                  "message"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "looks",
                            "warnings"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "create_action_id": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "launch_action_id": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "next_step": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "draft_id",
                    "client_id",
                    "asset_id",
                    "platform",
                    "status",
                    "plan",
                    "creatives",
                    "preflight",
                    "delivery",
                    "create_action_id",
                    "launch_action_id",
                    "next_step"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/tracking/questions/archive": {
      "post": {
        "operationId": "archive_tracked_question",
        "summary": "Archives one tracked question: it leaves the list and stops being asked, its answer history is kept, and it is never suggested again. Adding the same question by hand brings it back.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 400
                  }
                },
                "required": [
                  "text"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "keywords": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "text": {
                            "type": "string"
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "scan",
                              "customer"
                            ]
                          },
                          "added_at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "engines": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "location_code": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "device": {
                            "type": "string",
                            "enum": [
                              "desktop",
                              "mobile",
                              "both"
                            ]
                          },
                          "first_read": {
                            "type": "string",
                            "enum": [
                              "done",
                              "soon",
                              "monday"
                            ]
                          }
                        },
                        "required": [
                          "text",
                          "source",
                          "added_at",
                          "engines",
                          "location_code",
                          "device",
                          "first_read"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "prompts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "text": {
                            "type": "string"
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "scan",
                              "customer"
                            ]
                          },
                          "added_at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "engines": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "topic": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "paused": {
                            "type": "boolean"
                          },
                          "branded": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "text",
                          "source",
                          "added_at",
                          "engines",
                          "topic",
                          "paused",
                          "branded"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "limits": {
                      "type": "object",
                      "properties": {
                        "keywords": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "prompts": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "engines": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "competitors": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "keyword_every_days": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        "prompt_every_days": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        "keyword_checks": {
                          "type": "object",
                          "properties": {
                            "used": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "max": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "used",
                            "max"
                          ],
                          "additionalProperties": false
                        },
                        "prompt_checks": {
                          "type": "object",
                          "properties": {
                            "used": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "max": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "used",
                            "max"
                          ],
                          "additionalProperties": false
                        },
                        "keyword_engines": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "prompt_engines": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "addons": {
                          "type": "object",
                          "properties": {
                            "active": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "keyword_checks",
                                      "grid_checks"
                                    ]
                                  },
                                  "checks": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "expires_at": {
                                    "type": "string",
                                    "format": "date-time"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "checks",
                                  "expires_at"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "offers": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "keyword_checks",
                                      "grid_checks"
                                    ]
                                  },
                                  "checks": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "credits": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "days": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "kind",
                                  "checks",
                                  "credits",
                                  "days"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "active",
                            "offers"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "keywords",
                        "prompts",
                        "engines",
                        "competitors",
                        "keyword_every_days",
                        "prompt_every_days",
                        "keyword_checks",
                        "prompt_checks",
                        "keyword_engines",
                        "prompt_engines",
                        "addons"
                      ],
                      "additionalProperties": false
                    },
                    "competitors": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "domain": {
                                "type": "string"
                              },
                              "name": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "source": {
                                "type": "string",
                                "enum": [
                                  "scan",
                                  "customer"
                                ]
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "suggested",
                                  "tracked"
                                ]
                              }
                            },
                            "required": [
                              "domain",
                              "name",
                              "source",
                              "status"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "limit": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "edited": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "items",
                        "limit",
                        "edited"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "keywords",
                    "prompts",
                    "limits",
                    "competitors"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/keyword-top10": {
      "post": {
        "operationId": "ask_keyword_top10",
        "summary": "Asks who stands on Google's first page for one phrase: the ten organic results (place, site, title, address) in a market, the business's own country and language or the `country`, `language` and `location_code` (a Google city from the locations search) you send. Costs 1 credit: an agent or key sends max_credits (estimate_spend gives the price), or nothing is sent. The results arrive in a few seconds; read them with get_keyword_top10. Nothing is charged when no results come back, or when the country or city is not one Google lists. The same phrase in the same market asked in the last 30 days is not paid again; send ask_again: true for a fresh read.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "keyword": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 200,
                    "pattern": "^[^\\p{Cc}]*$"
                  },
                  "country": {
                    "type": "string",
                    "pattern": "^[A-Za-z]{2}$"
                  },
                  "language": {
                    "type": "string",
                    "pattern": "^[a-z]{2,3}(-[A-Za-z]{2,4})?$"
                  },
                  "location_code": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "max_credits": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000,
                    "description": "The most credits this call may spend. A call that costs more is refused and nothing is spent. estimate_spend gives the price."
                  },
                  "ask_again": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "keyword"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "run_id": {
                      "description": "The run behind this call. GET /v1/runs/{run_id}/events streams its progress (server-sent events: run.progress, run.partial, run.deferred, run.done, run.failed). null when no run started.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "credits": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "market": {
                      "type": "object",
                      "properties": {
                        "country": {
                          "type": "string"
                        },
                        "location_code": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "language": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "country",
                        "location_code",
                        "language"
                      ],
                      "additionalProperties": false
                    },
                    "reused": {
                      "type": "object",
                      "properties": {
                        "asked_on": {
                          "type": "string"
                        },
                        "note": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "asked_on",
                        "note"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "run_id",
                    "credits",
                    "market"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "The credit cap or balance is short (G-COST), or the organization has no paid plan (G-ENTITLEMENT). missing and next_action say what to do.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "get_keyword_top10",
        "summary": "The stored top 10 of one phrase in a market (asked with ask_keyword_top10 in the last 30 days): the ten organic results with place, site, title and address, which row is the business and its place. Free. `state` is `found`, `failed` (the read gave nothing, `reason` says why; nothing was charged) or `not_found` (not asked in that market yet, or still running); poll this after ask_keyword_top10 until `state` is not `not_found`.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "keyword",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 2,
              "maxLength": 200,
              "pattern": "^[^\\p{Cc}]*$"
            }
          },
          {
            "name": "country",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z]{2}$"
            }
          },
          {
            "name": "language",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-z]{2,3}(-[A-Za-z]{2,4})?$"
            }
          },
          {
            "name": "location_code",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "keyword": {
                      "type": "string"
                    },
                    "country": {
                      "type": "string"
                    },
                    "location_code": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "city_name": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "language": {
                      "type": "string"
                    },
                    "asked_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "found": {
                      "type": "boolean"
                    },
                    "state": {
                      "type": "string",
                      "enum": [
                        "found",
                        "not_found",
                        "failed"
                      ]
                    },
                    "reason": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "you_position": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "rows": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "position": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "domain": {
                            "type": "string"
                          },
                          "title": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "url": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "is_you": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "position",
                          "domain",
                          "title",
                          "url",
                          "is_you"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "keyword",
                    "country",
                    "location_code",
                    "city_name",
                    "language",
                    "asked_at",
                    "found",
                    "state",
                    "reason",
                    "you_position",
                    "rows"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/connections/consent": {
      "get": {
        "operationId": "begin_connection",
        "summary": "Get the address where the person agrees to connect an ad platform or a data platform.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "platform",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "google_ads",
                "meta_ads",
                "gsc",
                "ga4",
                "merchant",
                "linkedin_ads",
                "shopify",
                "hubspot",
                "pipedrive"
              ]
            }
          },
          {
            "name": "shop",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    },
                    "expires_in_s": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "url",
                    "expires_in_s"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/billing/items/{id}/business": {
      "post": {
        "operationId": "bind_plan_item",
        "summary": "An owner or admin chooses the business for an unused plan item. The same choice is safe to repeat; an assigned item cannot move.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "format": "uuid"
                  }
                },
                "required": [
                  "client_id"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "item_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "client_id": {
                      "type": "string",
                      "format": "uuid"
                    }
                  },
                  "required": [
                    "item_id",
                    "client_id"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/check": {
      "post": {
        "operationId": "check_change",
        "summary": "Asks whether a change would go ahead, without writing anything or reading the account. Returns the decision and reason codes for this situation.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "ADD_NEGATIVE",
                      "PAUSE_KEYWORD",
                      "PAUSE_AD",
                      "PAUSE_ADSET",
                      "PAUSE_CAMPAIGN",
                      "SET_BUDGET",
                      "SET_MAX_CPC",
                      "ENABLE_ENTITY",
                      "SET_NETWORKS",
                      "SET_GEO_PRESENCE",
                      "ADD_KEYWORD",
                      "SET_BID_STRATEGY",
                      "SET_PLACEMENTS",
                      "SET_AUDIENCE_OPTION",
                      "SET_CREATIVE_FEATURES",
                      "CREATE_CAMPAIGN_DRAFT",
                      "CREATE_AD_DRAFT",
                      "LAUNCH_CAMPAIGN"
                    ]
                  },
                  "params": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "current_amount_minor": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "monthly_cap_minor": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "type",
                  "params"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "decision": {
                      "type": "string",
                      "enum": [
                        "go",
                        "needs_approval",
                        "blocked",
                        "needs_data"
                      ]
                    },
                    "reason_codes": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "not_enough_data",
                          "too_soon_after_last_change",
                          "over_limit",
                          "cap_required",
                          "cap_would_be_exceeded",
                          "account_paused",
                          "tracking_unhealthy",
                          "stale_data",
                          "conflicts_open_change",
                          "unit_or_scale_suspect",
                          "shared_budget",
                          "drift",
                          "platform_refused",
                          "account_not_enabled",
                          "object_missing",
                          "already_undone",
                          "write_gate_closed",
                          "asset_not_linked",
                          "one_click_required",
                          "autopilot_stopped",
                          "hands_off",
                          "shift_waiting",
                          "area_not_approved"
                        ]
                      }
                    }
                  },
                  "required": [
                    "decision",
                    "reason_codes"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/research/page-check": {
      "post": {
        "operationId": "check_page",
        "summary": "Reads one page now, as a search engine sees it without running scripts: its status code, title, description, first heading, canonical address, words, links, images, load time, an on-page score (0 to 100, the source's) and the problems the source found on it, by name (for example no_description, title_too_long, no_image_alt). Send `url` (a page address; the business's home page when left out). Costs 1 credit: an agent or key sends max_credits. Nothing is charged when the page could not be read.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Optional. Send the same value to repeat this paid call without paying twice; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused). The CLI sends one made from the request.",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 300
                  },
                  "max_credits": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000,
                    "description": "The most credits this call may spend. A call that costs more is refused and nothing is spent. estimate_spend gives the price."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    },
                    "status_code": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "title": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "h1": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "canonical": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "words": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "internal_links": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "external_links": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "images": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "load_ms": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "score": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "problems": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "credits": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "balance": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "url",
                    "status_code",
                    "title",
                    "description",
                    "h1",
                    "canonical",
                    "words",
                    "internal_links",
                    "external_links",
                    "images",
                    "load_ms",
                    "score",
                    "problems",
                    "credits",
                    "balance"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "The credit cap or balance is short (G-COST), or the organization has no paid plan (G-ENTITLEMENT). missing and next_action say what to do.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/campaign-drafts/{draft_id}/create": {
      "post": {
        "operationId": "create_campaign_draft",
        "summary": "Proposes to make the campaign in the ad account, with every object paused. It runs the checks again and goes ahead only if all are green; a person then approves the change.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "draft_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "draft_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "client_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "asset_id": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "platform": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "plan": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "creatives": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "creative_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "status": {
                            "type": "string"
                          },
                          "angle": {
                            "type": "string"
                          },
                          "headlines": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "descriptions": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "brief": {}
                        },
                        "required": [
                          "creative_id",
                          "status",
                          "angle",
                          "headlines",
                          "descriptions",
                          "brief"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "preflight": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "ok": {
                              "type": "boolean"
                            },
                            "checked_at": {
                              "type": "string"
                            },
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "n": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "group": {
                                    "type": "string"
                                  },
                                  "ok": {
                                    "type": "boolean"
                                  },
                                  "why": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "fix": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "n",
                                  "group",
                                  "ok",
                                  "why",
                                  "fix"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "ok",
                            "checked_at",
                            "items"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "delivery": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "looks": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "hours": {
                                    "type": "number"
                                  },
                                  "at": {
                                    "type": "string"
                                  },
                                  "status": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "issues": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  },
                                  "impressions": {
                                    "type": [
                                      "number",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "hours",
                                  "at",
                                  "status",
                                  "issues",
                                  "impressions"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "warnings": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "code": {
                                    "type": "string"
                                  },
                                  "at": {
                                    "type": "string"
                                  },
                                  "message": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "code",
                                  "at",
                                  "message"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "looks",
                            "warnings"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "create_action_id": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "launch_action_id": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "next_step": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "draft_id",
                    "client_id",
                    "asset_id",
                    "platform",
                    "status",
                    "plan",
                    "creatives",
                    "preflight",
                    "delivery",
                    "create_action_id",
                    "launch_action_id",
                    "next_step"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/scans": {
      "post": {
        "operationId": "create_scan",
        "summary": "Starts a free scan of a website. Returns the scan id and the token that opens this scan and no other.",
        "x-stability": "stable",
        "security": [
          {},
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "domain": {
                    "type": "string",
                    "maxLength": 253
                  }
                },
                "required": [
                  "domain"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "scan_id": {
                      "type": "string"
                    },
                    "token": {
                      "type": "string"
                    },
                    "ready": {
                      "type": "boolean"
                    },
                    "business": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "domain": {
                              "type": "string"
                            },
                            "name": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "summary": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "country": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "language": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "services": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "city": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "domain",
                            "name",
                            "summary",
                            "country",
                            "language",
                            "services",
                            "city"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "scan_id",
                    "token",
                    "ready",
                    "business"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "list_scans",
        "summary": "Lists the websites of this organization with the newest scan of each: its id, state, score and finish time.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "description": "The most rows to return."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "scans": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "scan_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "client_id": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "uuid"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "domain": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string"
                          },
                          "score": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "finished_at": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "scan_id",
                          "client_id",
                          "domain",
                          "status",
                          "score",
                          "finished_at"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "scans"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/campaign-drafts/{draft_id}/discard": {
      "post": {
        "operationId": "discard_campaign_draft",
        "summary": "Closes a planned campaign. A campaign already made from it stays paused in the ad account: Upnatus never removes one, so remove it there if you do not want it.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "draft_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "draft_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "client_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "asset_id": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "platform": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "plan": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "creatives": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "creative_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "status": {
                            "type": "string"
                          },
                          "angle": {
                            "type": "string"
                          },
                          "headlines": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "descriptions": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "brief": {}
                        },
                        "required": [
                          "creative_id",
                          "status",
                          "angle",
                          "headlines",
                          "descriptions",
                          "brief"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "preflight": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "ok": {
                              "type": "boolean"
                            },
                            "checked_at": {
                              "type": "string"
                            },
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "n": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "group": {
                                    "type": "string"
                                  },
                                  "ok": {
                                    "type": "boolean"
                                  },
                                  "why": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "fix": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "n",
                                  "group",
                                  "ok",
                                  "why",
                                  "fix"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "ok",
                            "checked_at",
                            "items"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "delivery": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "looks": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "hours": {
                                    "type": "number"
                                  },
                                  "at": {
                                    "type": "string"
                                  },
                                  "status": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "issues": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  },
                                  "impressions": {
                                    "type": [
                                      "number",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "hours",
                                  "at",
                                  "status",
                                  "issues",
                                  "impressions"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "warnings": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "code": {
                                    "type": "string"
                                  },
                                  "at": {
                                    "type": "string"
                                  },
                                  "message": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "code",
                                  "at",
                                  "message"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "looks",
                            "warnings"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "create_action_id": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "launch_action_id": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "next_step": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "draft_id",
                    "client_id",
                    "asset_id",
                    "platform",
                    "status",
                    "plan",
                    "creatives",
                    "preflight",
                    "delivery",
                    "create_action_id",
                    "launch_action_id",
                    "next_step"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/findings/{finding_ref}/dismiss": {
      "post": {
        "operationId": "dismiss_finding",
        "summary": "Marks a finding as not relevant, with a reason. It changes the list in Upnatus only, never an ad account, and the finding does not come back on the next run.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "finding_ref",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 3,
              "maxLength": 120
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "enum": [
                      "not_relevant",
                      "already_done",
                      "wrong_data",
                      "too_risky",
                      "too_soon",
                      "no_budget",
                      "client_preference",
                      "action_rejected",
                      "action_withdrawn",
                      "other"
                    ]
                  }
                },
                "required": [
                  "code"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "finding_ref": {
                      "type": "string"
                    },
                    "lifecycle": {
                      "type": "string",
                      "const": "dismissed"
                    }
                  },
                  "required": [
                    "finding_ref",
                    "lifecycle"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/campaign-drafts": {
      "post": {
        "operationId": "draft_campaign",
        "summary": "Builds the settings of a new campaign from the business profile and keeps them for review. Nothing is made in the ad account.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "asset_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "service": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 60
                  },
                  "final_url": {
                    "type": "string",
                    "maxLength": 500,
                    "pattern": "^https:\\/\\/[^\\s]+$"
                  },
                  "keywords": {
                    "minItems": 1,
                    "maxItems": 25,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80
                    }
                  },
                  "cpc_minor": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "language": {
                    "type": "string",
                    "enum": [
                      "en",
                      "fr",
                      "de",
                      "tr"
                    ]
                  },
                  "meta": {
                    "type": "object",
                    "properties": {
                      "adset_placement_choice": {
                        "default": false,
                        "type": "boolean"
                      },
                      "special_ad_categories": {
                        "default": [],
                        "maxItems": 5,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "maxLength": 40
                        }
                      },
                      "min_age": {
                        "default": null,
                        "anyOf": [
                          {
                            "type": "integer",
                            "minimum": 13,
                            "maximum": 65
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "dsa": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "beneficiary": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100
                              },
                              "payor": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100
                              }
                            },
                            "required": [
                              "beneficiary",
                              "payor"
                            ]
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    }
                  }
                },
                "required": [
                  "client_id",
                  "asset_id",
                  "service",
                  "final_url",
                  "keywords",
                  "cpc_minor"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "draft_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "client_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "asset_id": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "platform": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "plan": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "creatives": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "creative_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "status": {
                            "type": "string"
                          },
                          "angle": {
                            "type": "string"
                          },
                          "headlines": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "descriptions": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "brief": {}
                        },
                        "required": [
                          "creative_id",
                          "status",
                          "angle",
                          "headlines",
                          "descriptions",
                          "brief"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "preflight": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "ok": {
                              "type": "boolean"
                            },
                            "checked_at": {
                              "type": "string"
                            },
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "n": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "group": {
                                    "type": "string"
                                  },
                                  "ok": {
                                    "type": "boolean"
                                  },
                                  "why": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "fix": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "n",
                                  "group",
                                  "ok",
                                  "why",
                                  "fix"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "ok",
                            "checked_at",
                            "items"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "delivery": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "looks": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "hours": {
                                    "type": "number"
                                  },
                                  "at": {
                                    "type": "string"
                                  },
                                  "status": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "issues": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  },
                                  "impressions": {
                                    "type": [
                                      "number",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "hours",
                                  "at",
                                  "status",
                                  "issues",
                                  "impressions"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "warnings": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "code": {
                                    "type": "string"
                                  },
                                  "at": {
                                    "type": "string"
                                  },
                                  "message": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "code",
                                  "at",
                                  "message"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "looks",
                            "warnings"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "create_action_id": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "launch_action_id": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "next_step": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "draft_id",
                    "client_id",
                    "asset_id",
                    "platform",
                    "status",
                    "plan",
                    "creatives",
                    "preflight",
                    "delivery",
                    "create_action_id",
                    "launch_action_id",
                    "next_step"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/key-pages/remove": {
      "post": {
        "operationId": "drop_key_page",
        "summary": "Removes a page from the key pages. The page itself stays on the website.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 300
                  }
                },
                "required": [
                  "url"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "key_pages": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "url": {
                            "type": "string"
                          },
                          "role": {
                            "type": "string",
                            "enum": [
                              "home",
                              "money",
                              "supporting",
                              "other"
                            ]
                          }
                        },
                        "required": [
                          "url",
                          "role"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "key_pages"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/saved-keyword-tags/remove": {
      "post": {
        "operationId": "drop_saved_tag",
        "summary": "Deletes a tag (a list) of the saved keywords. The keywords stay saved, without that tag.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40,
                    "pattern": "^[^\\p{Cc}]*$"
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "untagged": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "untagged"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/tracking/questions/edit": {
      "post": {
        "operationId": "edit_tracked_question",
        "summary": "Changes the words of one tracked question. The change starts a NEW question: the old one is archived with its answers, and the new one keeps its assistants, topic, pause and place in the list. `topic` may be sent with it (null clears it); left out keeps the topic. The new text must differ from the old one and must not be on the list already. The change counts from the next round.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 400
                  },
                  "new_text": {
                    "type": "string"
                  },
                  "topic": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "text",
                  "new_text"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "keywords": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "text": {
                            "type": "string"
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "scan",
                              "customer"
                            ]
                          },
                          "added_at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "engines": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "location_code": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "device": {
                            "type": "string",
                            "enum": [
                              "desktop",
                              "mobile",
                              "both"
                            ]
                          },
                          "first_read": {
                            "type": "string",
                            "enum": [
                              "done",
                              "soon",
                              "monday"
                            ]
                          }
                        },
                        "required": [
                          "text",
                          "source",
                          "added_at",
                          "engines",
                          "location_code",
                          "device",
                          "first_read"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "prompts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "text": {
                            "type": "string"
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "scan",
                              "customer"
                            ]
                          },
                          "added_at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "engines": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "topic": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "paused": {
                            "type": "boolean"
                          },
                          "branded": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "text",
                          "source",
                          "added_at",
                          "engines",
                          "topic",
                          "paused",
                          "branded"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "limits": {
                      "type": "object",
                      "properties": {
                        "keywords": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "prompts": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "engines": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "competitors": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "keyword_every_days": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        "prompt_every_days": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        "keyword_checks": {
                          "type": "object",
                          "properties": {
                            "used": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "max": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "used",
                            "max"
                          ],
                          "additionalProperties": false
                        },
                        "prompt_checks": {
                          "type": "object",
                          "properties": {
                            "used": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "max": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "used",
                            "max"
                          ],
                          "additionalProperties": false
                        },
                        "keyword_engines": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "prompt_engines": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "addons": {
                          "type": "object",
                          "properties": {
                            "active": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "keyword_checks",
                                      "grid_checks"
                                    ]
                                  },
                                  "checks": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "expires_at": {
                                    "type": "string",
                                    "format": "date-time"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "checks",
                                  "expires_at"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "offers": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "keyword_checks",
                                      "grid_checks"
                                    ]
                                  },
                                  "checks": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "credits": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "days": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "kind",
                                  "checks",
                                  "credits",
                                  "days"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "active",
                            "offers"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "keywords",
                        "prompts",
                        "engines",
                        "competitors",
                        "keyword_every_days",
                        "prompt_every_days",
                        "keyword_checks",
                        "prompt_checks",
                        "keyword_engines",
                        "prompt_engines",
                        "addons"
                      ],
                      "additionalProperties": false
                    },
                    "competitors": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "domain": {
                                "type": "string"
                              },
                              "name": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "source": {
                                "type": "string",
                                "enum": [
                                  "scan",
                                  "customer"
                                ]
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "suggested",
                                  "tracked"
                                ]
                              }
                            },
                            "required": [
                              "domain",
                              "name",
                              "source",
                              "status"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "limit": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "edited": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "items",
                        "limit",
                        "edited"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "keywords",
                    "prompts",
                    "limits",
                    "competitors"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/spend-estimate": {
      "get": {
        "operationId": "estimate_spend",
        "summary": "What a tool that spends would cost, before you call it: credits now, and whether it adds work that repeats on every tracking round (every 3 days on current plans). Show the person the number, then send max_credits with the call. It never spends.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "tool",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "send_chat_message",
                "seed_keyword_ideas",
                "ask_keyword_top10",
                "fetch_saved_keyword_numbers",
                "recheck_keywords",
                "get_domain_overview",
                "find_business",
                "list_branch_candidates",
                "get_backlink_overview",
                "list_backlinks",
                "get_backlink_gap",
                "get_related_keywords",
                "get_domain_rank_history",
                "get_backlink_anchors",
                "get_backlink_history",
                "check_page",
                "get_search_suggestions",
                "get_llm_mentions",
                "get_brand_mentions",
                "set_tracked_keywords",
                "set_tracked_prompts",
                "set_tracked_competitors"
              ]
            }
          },
          {
            "name": "with_city",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "seed_count",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 5
            }
          },
          {
            "name": "keyword_count",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "tool": {
                      "type": "string",
                      "enum": [
                        "send_chat_message",
                        "seed_keyword_ideas",
                        "ask_keyword_top10",
                        "fetch_saved_keyword_numbers",
                        "recheck_keywords",
                        "get_domain_overview",
                        "find_business",
                        "list_branch_candidates",
                        "get_backlink_overview",
                        "list_backlinks",
                        "get_backlink_gap",
                        "get_related_keywords",
                        "get_domain_rank_history",
                        "get_backlink_anchors",
                        "get_backlink_history",
                        "check_page",
                        "get_search_suggestions",
                        "get_llm_mentions",
                        "get_brand_mentions",
                        "set_tracked_keywords",
                        "set_tracked_prompts",
                        "set_tracked_competitors"
                      ]
                    },
                    "credits": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "recurring": {
                      "type": "boolean"
                    },
                    "balance": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "note": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "tool",
                    "credits",
                    "recurring",
                    "balance",
                    "note"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/findings/{finding_ref}/explain": {
      "get": {
        "operationId": "explain_rule",
        "summary": "Explains why one finding applies to this account now: the reason in this situation, the numbers it stands on and what could still change the reading.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "finding_ref",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 3,
              "maxLength": 120
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "finding_ref": {
                      "type": "string"
                    },
                    "rule_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "reason": {
                      "type": "string"
                    },
                    "evidence": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "fact_id": {
                            "type": "string"
                          },
                          "label": {
                            "type": "string"
                          },
                          "value": {
                            "type": [
                              "number",
                              "string",
                              "null"
                            ]
                          },
                          "unit": {
                            "type": "string"
                          },
                          "window": {
                            "type": "object",
                            "properties": {
                              "from": {
                                "type": "string"
                              },
                              "to": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "from",
                              "to"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "fact_id",
                          "label",
                          "value",
                          "unit"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "alternatives": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "text": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "text"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "limits": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "finding_ref",
                    "rule_id",
                    "reason",
                    "evidence",
                    "alternatives",
                    "limits"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/locations/fetch": {
      "post": {
        "operationId": "fetch_locations",
        "summary": "Asks for the Google location list of a country to be fetched (free, a few seconds), so list_locations can search it. Asking twice is harmless.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "country": {
                    "type": "string",
                    "maxLength": 8
                  }
                },
                "required": [
                  "country"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ready": {
                      "type": "boolean"
                    },
                    "country": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ready",
                    "country"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/saved-keywords/numbers": {
      "post": {
        "operationId": "fetch_saved_keyword_numbers",
        "summary": "Fetches searches a month, cost per click and difficulty for the saved keywords that have no numbers yet (up to 500). Costs 3 credits for one keyword up to 15 for 500: an agent or key sends max_credits (estimate_spend gives the price). Nothing is charged when no number comes back. Read them with list_saved_keywords.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "max_credits": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000,
                    "description": "The most credits this call may spend. A call that costs more is refused and nothing is spent. estimate_spend gives the price."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "credits": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "run_id": {
                      "description": "The run behind this call. GET /v1/runs/{run_id}/events streams its progress (server-sent events: run.progress, run.partial, run.deferred, run.done, run.failed). null when no run started.",
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "credits",
                    "run_id"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "The credit cap or balance is short (G-COST), or the organization has no paid plan (G-ENTITLEMENT). missing and next_action say what to do.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/research/business-search": {
      "post": {
        "operationId": "find_business",
        "summary": "Finds a business on Google Maps by its name in a city: up to 20 listings with name, address, rating, number of ratings, category and point on the map (latitude, longitude). Phone numbers, owners and review texts are not returned or kept. Send `name` (2 to 200 characters), `city` and, for another country than the business's, `country`. A city Google does not list is refused before anything is spent. Costs 1 credit: an agent or key sends max_credits. Nothing is charged when nothing is found.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Optional. Send the same value to repeat this paid call without paying twice; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused). The CLI sends one made from the request.",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 200,
                    "pattern": "^[^\\p{Cc}]*$"
                  },
                  "city": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 80,
                    "pattern": "^[^\\p{Cc}]*$"
                  },
                  "country": {
                    "type": "string",
                    "pattern": "^[A-Za-z]{2}$"
                  },
                  "max_credits": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000,
                    "description": "The most credits this call may spend. A call that costs more is refused and nothing is spent. estimate_spend gives the price."
                  }
                },
                "required": [
                  "name",
                  "city"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "city": {
                      "type": "string"
                    },
                    "matches": {
                      "maxItems": 20,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "address": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "rating": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "votes": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "category": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "lat": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "lng": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "cid": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "place_id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "name",
                          "address",
                          "rating",
                          "votes",
                          "category",
                          "lat",
                          "lng",
                          "cid",
                          "place_id"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "credits": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "balance": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "city",
                    "matches",
                    "credits",
                    "balance"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "The credit cap or balance is short (G-COST), or the organization has no paid plan (G-ENTITLEMENT). missing and next_action say what to do.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/branches/{branch_id}": {
      "delete": {
        "operationId": "forget_branch",
        "summary": "Stops tracking one branch: it is removed from the list, its spots are taken out of the local grid setup and its past readings are no longer shown. The business itself and its other branches are not touched. If they are the only spots of the grid it is refused (409 last_branch_spots) until the spots are chosen anew. Saving the same listing again later does not bring the past readings back. Free.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "branch_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "branches": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "name": {
                            "type": "string"
                          },
                          "address": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "lat": {
                            "type": "number"
                          },
                          "lng": {
                            "type": "number"
                          },
                          "cid": {
                            "type": "string"
                          },
                          "place_id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "rating": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "votes": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "category": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "address",
                          "lat",
                          "lng",
                          "cid",
                          "place_id",
                          "rating",
                          "votes",
                          "category"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "max": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "branches",
                    "max"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/keyword-research/{search_id}": {
      "delete": {
        "operationId": "forget_keyword_search",
        "summary": "Takes one keyword search off the list of get_keyword_research. Free. Only the list changes: what was bought stays for 90 days, and asking the same phrases in the same market again within 30 days shows the search again and charges nothing.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "search_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "search_id": {
                      "type": "string"
                    },
                    "forgotten": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": [
                    "search_id",
                    "forgotten"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/campaign-drafts/{draft_id}/creatives": {
      "post": {
        "operationId": "generate_campaign_creatives",
        "summary": "Writes three ad text angles for a planned campaign. A line stays only if it fits the length and says nothing the site and the profile do not say. Upnatus makes no images: each angle has a brief for the photo.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "draft_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "draft_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "client_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "asset_id": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "platform": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "plan": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "creatives": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "creative_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "status": {
                            "type": "string"
                          },
                          "angle": {
                            "type": "string"
                          },
                          "headlines": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "descriptions": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "brief": {}
                        },
                        "required": [
                          "creative_id",
                          "status",
                          "angle",
                          "headlines",
                          "descriptions",
                          "brief"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "preflight": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "ok": {
                              "type": "boolean"
                            },
                            "checked_at": {
                              "type": "string"
                            },
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "n": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "group": {
                                    "type": "string"
                                  },
                                  "ok": {
                                    "type": "boolean"
                                  },
                                  "why": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "fix": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "n",
                                  "group",
                                  "ok",
                                  "why",
                                  "fix"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "ok",
                            "checked_at",
                            "items"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "delivery": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "looks": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "hours": {
                                    "type": "number"
                                  },
                                  "at": {
                                    "type": "string"
                                  },
                                  "status": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "issues": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  },
                                  "impressions": {
                                    "type": [
                                      "number",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "hours",
                                  "at",
                                  "status",
                                  "issues",
                                  "impressions"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "warnings": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "code": {
                                    "type": "string"
                                  },
                                  "at": {
                                    "type": "string"
                                  },
                                  "message": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "code",
                                  "at",
                                  "message"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "looks",
                            "warnings"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "create_action_id": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "launch_action_id": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "next_step": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "draft_id",
                    "client_id",
                    "asset_id",
                    "platform",
                    "status",
                    "plan",
                    "creatives",
                    "preflight",
                    "delivery",
                    "create_action_id",
                    "launch_action_id",
                    "next_step"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/actions/{action_id}": {
      "get": {
        "operationId": "get_action",
        "summary": "Returns one action: its status, what was read before and after the write, and why it stopped.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "action_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "action_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "client_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "asset_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "platform": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "ADD_NEGATIVE",
                        "PAUSE_KEYWORD",
                        "PAUSE_AD",
                        "PAUSE_ADSET",
                        "PAUSE_CAMPAIGN",
                        "SET_BUDGET",
                        "SET_MAX_CPC",
                        "ENABLE_ENTITY",
                        "SET_NETWORKS",
                        "SET_GEO_PRESENCE",
                        "ADD_KEYWORD",
                        "SET_BID_STRATEGY",
                        "SET_PLACEMENTS",
                        "SET_AUDIENCE_OPTION",
                        "SET_CREATIVE_FEATURES",
                        "CREATE_CAMPAIGN_DRAFT",
                        "CREATE_AD_DRAFT",
                        "LAUNCH_CAMPAIGN"
                      ]
                    },
                    "direction": {
                      "type": "string",
                      "enum": [
                        "increase",
                        "decrease",
                        "neutral"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "blocked",
                        "pending",
                        "approved",
                        "auto_queued",
                        "executing",
                        "done",
                        "failed",
                        "unknown",
                        "rejected",
                        "expired",
                        "withdrawn",
                        "superseded"
                      ]
                    },
                    "reason_codes": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "not_enough_data",
                          "too_soon_after_last_change",
                          "over_limit",
                          "cap_required",
                          "cap_would_be_exceeded",
                          "account_paused",
                          "tracking_unhealthy",
                          "stale_data",
                          "conflicts_open_change",
                          "unit_or_scale_suspect",
                          "shared_budget",
                          "drift",
                          "platform_refused",
                          "account_not_enabled",
                          "object_missing",
                          "already_undone",
                          "write_gate_closed",
                          "asset_not_linked",
                          "one_click_required",
                          "autopilot_stopped",
                          "hands_off",
                          "shift_waiting",
                          "area_not_approved"
                        ]
                      }
                    },
                    "approval_level": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "operator",
                            "owner_admin"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "before": {
                      "anyOf": [
                        {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "after": {
                      "anyOf": [
                        {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "params": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "card_body": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "card_sha256": {
                      "type": "string"
                    },
                    "undo_of": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "undone_by": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "retry_of": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "supersedes": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "is_noop": {
                      "type": "boolean"
                    },
                    "emergency": {
                      "type": "boolean"
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "applied_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "expected_current": {
                      "anyOf": [
                        {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "before_after": {
                      "type": "object",
                      "properties": {
                        "before": {
                          "type": "string",
                          "minLength": 1
                        },
                        "after": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "required": [
                        "before",
                        "after"
                      ],
                      "additionalProperties": false
                    },
                    "undo": {
                      "type": "object",
                      "properties": {
                        "possible": {
                          "type": "boolean"
                        },
                        "until": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "note": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "required": [
                        "possible",
                        "until",
                        "note"
                      ],
                      "additionalProperties": false
                    },
                    "note": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "approved_by": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "approved_via": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "panel",
                            "email_link"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "approved_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "currency": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "action_id",
                    "client_id",
                    "asset_id",
                    "platform",
                    "type",
                    "direction",
                    "status",
                    "reason_codes",
                    "approval_level",
                    "before",
                    "after",
                    "params",
                    "card_body",
                    "card_sha256",
                    "undo_of",
                    "undone_by",
                    "retry_of",
                    "supersedes",
                    "is_noop",
                    "emergency",
                    "created_at",
                    "applied_at",
                    "expected_current",
                    "before_after",
                    "undo",
                    "note",
                    "approved_by",
                    "approved_via",
                    "approved_at",
                    "currency"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/ad-performance": {
      "get": {
        "operationId": "get_ad_performance",
        "summary": "Reads the connected Google Ads and Meta Ads accounts of the business: spend, clicks, impressions, conversions, click rate and cost per conversion over the last 7, 30 or 90 days against the days before (not for 90 days: the stored copy holds 90 days, so `previous` and the changes are null there), the spend of the month against the monthly cap, and the biggest campaigns. Money is an integer in the minor unit of the currency of the account (cost_minor: 219000 is 2,190.00 CHF). Meta conversions count lead actions only. The window ends on the newest day the account was read, so an account that stopped spending reads zero for the days since. It reads stored data only; an account with no data yet says so and gives no number.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "days",
            "in": "query",
            "required": false,
            "schema": {
              "default": 30,
              "anyOf": [
                {
                  "type": "number",
                  "const": 7
                },
                {
                  "type": "number",
                  "const": 30
                },
                {
                  "type": "number",
                  "const": 90
                }
              ]
            }
          },
          {
            "name": "platform",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "google_ads",
                "meta_ads"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "days": {
                      "anyOf": [
                        {
                          "type": "number",
                          "const": 7
                        },
                        {
                          "type": "number",
                          "const": 30
                        },
                        {
                          "type": "number",
                          "const": 90
                        }
                      ]
                    },
                    "accounts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "asset_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "platform": {
                            "type": "string",
                            "enum": [
                              "google_ads",
                              "meta_ads"
                            ]
                          },
                          "account_id": {
                            "type": "string"
                          },
                          "currency": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "as_of": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "from": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "to": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "totals": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "cost_minor": {
                                    "type": "object",
                                    "properties": {
                                      "value": {
                                        "type": [
                                          "number",
                                          "null"
                                        ]
                                      },
                                      "previous": {
                                        "type": [
                                          "number",
                                          "null"
                                        ]
                                      },
                                      "change": {
                                        "type": [
                                          "number",
                                          "null"
                                        ]
                                      },
                                      "change_pct": {
                                        "type": [
                                          "number",
                                          "null"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "value",
                                      "previous",
                                      "change",
                                      "change_pct"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "clicks": {
                                    "type": "object",
                                    "properties": {
                                      "value": {
                                        "type": [
                                          "number",
                                          "null"
                                        ]
                                      },
                                      "previous": {
                                        "type": [
                                          "number",
                                          "null"
                                        ]
                                      },
                                      "change": {
                                        "type": [
                                          "number",
                                          "null"
                                        ]
                                      },
                                      "change_pct": {
                                        "type": [
                                          "number",
                                          "null"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "value",
                                      "previous",
                                      "change",
                                      "change_pct"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "impressions": {
                                    "type": "object",
                                    "properties": {
                                      "value": {
                                        "type": [
                                          "number",
                                          "null"
                                        ]
                                      },
                                      "previous": {
                                        "type": [
                                          "number",
                                          "null"
                                        ]
                                      },
                                      "change": {
                                        "type": [
                                          "number",
                                          "null"
                                        ]
                                      },
                                      "change_pct": {
                                        "type": [
                                          "number",
                                          "null"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "value",
                                      "previous",
                                      "change",
                                      "change_pct"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "conversions": {
                                    "type": "object",
                                    "properties": {
                                      "value": {
                                        "type": [
                                          "number",
                                          "null"
                                        ]
                                      },
                                      "previous": {
                                        "type": [
                                          "number",
                                          "null"
                                        ]
                                      },
                                      "change": {
                                        "type": [
                                          "number",
                                          "null"
                                        ]
                                      },
                                      "change_pct": {
                                        "type": [
                                          "number",
                                          "null"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "value",
                                      "previous",
                                      "change",
                                      "change_pct"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "ctr": {
                                    "type": "object",
                                    "properties": {
                                      "value": {
                                        "type": [
                                          "number",
                                          "null"
                                        ]
                                      },
                                      "previous": {
                                        "type": [
                                          "number",
                                          "null"
                                        ]
                                      },
                                      "change": {
                                        "type": [
                                          "number",
                                          "null"
                                        ]
                                      },
                                      "change_pct": {
                                        "type": [
                                          "number",
                                          "null"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "value",
                                      "previous",
                                      "change",
                                      "change_pct"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "cost_per_conversion_minor": {
                                    "type": "object",
                                    "properties": {
                                      "value": {
                                        "type": [
                                          "number",
                                          "null"
                                        ]
                                      },
                                      "previous": {
                                        "type": [
                                          "number",
                                          "null"
                                        ]
                                      },
                                      "change": {
                                        "type": [
                                          "number",
                                          "null"
                                        ]
                                      },
                                      "change_pct": {
                                        "type": [
                                          "number",
                                          "null"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "value",
                                      "previous",
                                      "change",
                                      "change_pct"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "required": [
                                  "cost_minor",
                                  "clicks",
                                  "impressions",
                                  "conversions",
                                  "ctr",
                                  "cost_per_conversion_minor"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "month": {
                            "type": "object",
                            "properties": {
                              "spend_minor": {
                                "anyOf": [
                                  {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "cap_minor": {
                                "anyOf": [
                                  {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "cap_currency": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "cap_used": {
                                "type": [
                                  "number",
                                  "null"
                                ]
                              }
                            },
                            "required": [
                              "spend_minor",
                              "cap_minor",
                              "cap_currency",
                              "cap_used"
                            ],
                            "additionalProperties": false
                          },
                          "campaigns": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "campaign_id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "cost_minor": {
                                  "type": "object",
                                  "properties": {
                                    "value": {
                                      "type": [
                                        "number",
                                        "null"
                                      ]
                                    },
                                    "previous": {
                                      "type": [
                                        "number",
                                        "null"
                                      ]
                                    },
                                    "change": {
                                      "type": [
                                        "number",
                                        "null"
                                      ]
                                    },
                                    "change_pct": {
                                      "type": [
                                        "number",
                                        "null"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "value",
                                    "previous",
                                    "change",
                                    "change_pct"
                                  ],
                                  "additionalProperties": false
                                },
                                "clicks": {
                                  "type": "object",
                                  "properties": {
                                    "value": {
                                      "type": [
                                        "number",
                                        "null"
                                      ]
                                    },
                                    "previous": {
                                      "type": [
                                        "number",
                                        "null"
                                      ]
                                    },
                                    "change": {
                                      "type": [
                                        "number",
                                        "null"
                                      ]
                                    },
                                    "change_pct": {
                                      "type": [
                                        "number",
                                        "null"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "value",
                                    "previous",
                                    "change",
                                    "change_pct"
                                  ],
                                  "additionalProperties": false
                                },
                                "impressions": {
                                  "type": "object",
                                  "properties": {
                                    "value": {
                                      "type": [
                                        "number",
                                        "null"
                                      ]
                                    },
                                    "previous": {
                                      "type": [
                                        "number",
                                        "null"
                                      ]
                                    },
                                    "change": {
                                      "type": [
                                        "number",
                                        "null"
                                      ]
                                    },
                                    "change_pct": {
                                      "type": [
                                        "number",
                                        "null"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "value",
                                    "previous",
                                    "change",
                                    "change_pct"
                                  ],
                                  "additionalProperties": false
                                },
                                "conversions": {
                                  "type": "object",
                                  "properties": {
                                    "value": {
                                      "type": [
                                        "number",
                                        "null"
                                      ]
                                    },
                                    "previous": {
                                      "type": [
                                        "number",
                                        "null"
                                      ]
                                    },
                                    "change": {
                                      "type": [
                                        "number",
                                        "null"
                                      ]
                                    },
                                    "change_pct": {
                                      "type": [
                                        "number",
                                        "null"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "value",
                                    "previous",
                                    "change",
                                    "change_pct"
                                  ],
                                  "additionalProperties": false
                                },
                                "ctr": {
                                  "type": "object",
                                  "properties": {
                                    "value": {
                                      "type": [
                                        "number",
                                        "null"
                                      ]
                                    },
                                    "previous": {
                                      "type": [
                                        "number",
                                        "null"
                                      ]
                                    },
                                    "change": {
                                      "type": [
                                        "number",
                                        "null"
                                      ]
                                    },
                                    "change_pct": {
                                      "type": [
                                        "number",
                                        "null"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "value",
                                    "previous",
                                    "change",
                                    "change_pct"
                                  ],
                                  "additionalProperties": false
                                },
                                "cost_per_conversion_minor": {
                                  "type": "object",
                                  "properties": {
                                    "value": {
                                      "type": [
                                        "number",
                                        "null"
                                      ]
                                    },
                                    "previous": {
                                      "type": [
                                        "number",
                                        "null"
                                      ]
                                    },
                                    "change": {
                                      "type": [
                                        "number",
                                        "null"
                                      ]
                                    },
                                    "change_pct": {
                                      "type": [
                                        "number",
                                        "null"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "value",
                                    "previous",
                                    "change",
                                    "change_pct"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "required": [
                                "campaign_id",
                                "name",
                                "cost_minor",
                                "clicks",
                                "impressions",
                                "conversions",
                                "ctr",
                                "cost_per_conversion_minor"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "campaigns_total": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "asset_id",
                          "platform",
                          "account_id",
                          "currency",
                          "as_of",
                          "from",
                          "to",
                          "totals",
                          "month",
                          "campaigns",
                          "campaigns_total"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "days",
                    "accounts"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agency": {
      "get": {
        "operationId": "get_agency",
        "summary": "Every business of the organization you may see, which ones need a person now, and the changes waiting. `q` narrows the rows by name or group on the server; the summary stays the whole organization. A viewer gets the list and no changes to act on. Reading only.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "org": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "role": {
                          "type": "string",
                          "enum": [
                            "owner",
                            "admin",
                            "operator",
                            "viewer"
                          ]
                        },
                        "kind": {
                          "type": "string",
                          "enum": [
                            "agency",
                            "business"
                          ]
                        }
                      },
                      "required": [
                        "name",
                        "role",
                        "kind"
                      ],
                      "additionalProperties": false
                    },
                    "can_act": {
                      "type": "boolean"
                    },
                    "summary": {
                      "type": "object",
                      "properties": {
                        "businesses": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "blocked": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "need_you": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "waiting": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "waiting_over_limit": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "connection_lost": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "paused": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "reading": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "businesses",
                        "blocked",
                        "need_you",
                        "waiting",
                        "waiting_over_limit",
                        "connection_lost",
                        "paused",
                        "reading"
                      ],
                      "additionalProperties": false
                    },
                    "rows": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "business_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "name": {
                            "type": "string"
                          },
                          "group_label": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "mode": {
                            "type": "string"
                          },
                          "paused": {
                            "type": "boolean"
                          },
                          "health": {
                            "type": "string",
                            "enum": [
                              "needs_you",
                              "watch",
                              "reading",
                              "ok"
                            ]
                          },
                          "waiting": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "waiting_over_limit": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "connection_lost": {
                            "type": "boolean"
                          },
                          "spend": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "amount_minor": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "currency": {
                                    "type": "string",
                                    "minLength": 3,
                                    "maxLength": 3
                                  }
                                },
                                "required": [
                                  "amount_minor",
                                  "currency"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "cap": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "amount_minor": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "currency": {
                                    "type": "string",
                                    "minLength": 3,
                                    "maxLength": 3
                                  }
                                },
                                "required": [
                                  "amount_minor",
                                  "currency"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "last_change_at": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "next_report_at": {
                            "type": "string"
                          },
                          "data_as_of": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "blocked": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "blocked_reason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "verdict": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "good",
                                  "watch",
                                  "problem",
                                  "calm",
                                  "data_gap"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "oldest_waiting_at": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "business_id",
                          "name",
                          "group_label",
                          "mode",
                          "paused",
                          "health",
                          "waiting",
                          "waiting_over_limit",
                          "connection_lost",
                          "spend",
                          "cap",
                          "last_change_at",
                          "next_report_at",
                          "data_as_of",
                          "blocked",
                          "blocked_reason",
                          "verdict",
                          "oldest_waiting_at"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "matched": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "more": {
                      "type": "boolean"
                    },
                    "waiting": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "business_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "business_name": {
                            "type": "string"
                          },
                          "currency": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "within_limit": {
                            "type": "boolean"
                          },
                          "campaign": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "reason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "action": {
                            "type": "object",
                            "properties": {
                              "action_id": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "client_id": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "asset_id": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "platform": {
                                "type": "string"
                              },
                              "type": {
                                "type": "string",
                                "enum": [
                                  "ADD_NEGATIVE",
                                  "PAUSE_KEYWORD",
                                  "PAUSE_AD",
                                  "PAUSE_ADSET",
                                  "PAUSE_CAMPAIGN",
                                  "SET_BUDGET",
                                  "SET_MAX_CPC",
                                  "ENABLE_ENTITY",
                                  "SET_NETWORKS",
                                  "SET_GEO_PRESENCE",
                                  "ADD_KEYWORD",
                                  "SET_BID_STRATEGY",
                                  "SET_PLACEMENTS",
                                  "SET_AUDIENCE_OPTION",
                                  "SET_CREATIVE_FEATURES",
                                  "CREATE_CAMPAIGN_DRAFT",
                                  "CREATE_AD_DRAFT",
                                  "LAUNCH_CAMPAIGN"
                                ]
                              },
                              "direction": {
                                "type": "string",
                                "enum": [
                                  "increase",
                                  "decrease",
                                  "neutral"
                                ]
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "blocked",
                                  "pending",
                                  "approved",
                                  "auto_queued",
                                  "executing",
                                  "done",
                                  "failed",
                                  "unknown",
                                  "rejected",
                                  "expired",
                                  "withdrawn",
                                  "superseded"
                                ]
                              },
                              "reason_codes": {
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "enum": [
                                    "not_enough_data",
                                    "too_soon_after_last_change",
                                    "over_limit",
                                    "cap_required",
                                    "cap_would_be_exceeded",
                                    "account_paused",
                                    "tracking_unhealthy",
                                    "stale_data",
                                    "conflicts_open_change",
                                    "unit_or_scale_suspect",
                                    "shared_budget",
                                    "drift",
                                    "platform_refused",
                                    "account_not_enabled",
                                    "object_missing",
                                    "already_undone",
                                    "write_gate_closed",
                                    "asset_not_linked",
                                    "one_click_required",
                                    "autopilot_stopped",
                                    "hands_off",
                                    "shift_waiting",
                                    "area_not_approved"
                                  ]
                                }
                              },
                              "approval_level": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "enum": [
                                      "operator",
                                      "owner_admin"
                                    ]
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "before": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "propertyNames": {
                                      "type": "string"
                                    },
                                    "additionalProperties": {}
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "after": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "propertyNames": {
                                      "type": "string"
                                    },
                                    "additionalProperties": {}
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "params": {
                                "type": "object",
                                "propertyNames": {
                                  "type": "string"
                                },
                                "additionalProperties": {}
                              },
                              "card_body": {
                                "type": "object",
                                "propertyNames": {
                                  "type": "string"
                                },
                                "additionalProperties": {}
                              },
                              "card_sha256": {
                                "type": "string"
                              },
                              "undo_of": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "format": "uuid"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "undone_by": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "format": "uuid"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "retry_of": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "format": "uuid"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "supersedes": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "format": "uuid"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "is_noop": {
                                "type": "boolean"
                              },
                              "emergency": {
                                "type": "boolean"
                              },
                              "created_at": {
                                "type": "string"
                              },
                              "applied_at": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "expected_current": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "propertyNames": {
                                      "type": "string"
                                    },
                                    "additionalProperties": {}
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "before_after": {
                                "type": "object",
                                "properties": {
                                  "before": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "after": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                },
                                "required": [
                                  "before",
                                  "after"
                                ],
                                "additionalProperties": false
                              },
                              "undo": {
                                "type": "object",
                                "properties": {
                                  "possible": {
                                    "type": "boolean"
                                  },
                                  "until": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "note": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                },
                                "required": [
                                  "possible",
                                  "until",
                                  "note"
                                ],
                                "additionalProperties": false
                              },
                              "note": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "approved_by": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "format": "uuid"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "approved_via": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "enum": [
                                      "panel",
                                      "email_link"
                                    ]
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "approved_at": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "currency": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "pattern": "^[A-Z]{3}$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "action_id",
                              "client_id",
                              "asset_id",
                              "platform",
                              "type",
                              "direction",
                              "status",
                              "reason_codes",
                              "approval_level",
                              "before",
                              "after",
                              "params",
                              "card_body",
                              "card_sha256",
                              "undo_of",
                              "undone_by",
                              "retry_of",
                              "supersedes",
                              "is_noop",
                              "emergency",
                              "created_at",
                              "applied_at",
                              "expected_current",
                              "before_after",
                              "undo",
                              "note",
                              "approved_by",
                              "approved_via",
                              "approved_at",
                              "currency"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "business_id",
                          "business_name",
                          "currency",
                          "within_limit",
                          "campaign",
                          "reason",
                          "action"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "waiting_more": {
                      "type": "boolean"
                    },
                    "max_bulk_approve": {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "org",
                    "can_act",
                    "summary",
                    "rows",
                    "matched",
                    "more",
                    "waiting",
                    "waiting_more",
                    "max_bulk_approve"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/ai-answers": {
      "get": {
        "operationId": "get_ai_answers",
        "summary": "Reads what each AI assistant answered to one question of the business, week by week, newest week first: the answer text, whether it named the business, its place among the names, the other names and the sites cited. Stored answers only.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "prompt",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 400
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "prompt": {
                      "type": "string"
                    },
                    "weeks": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "week": {
                            "type": "string",
                            "format": "date"
                          },
                          "answers": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "engine": {
                                  "type": "string",
                                  "enum": [
                                    "ChatGPT",
                                    "Claude",
                                    "Gemini",
                                    "Perplexity"
                                  ]
                                },
                                "answer": {
                                  "type": "string"
                                },
                                "named": {
                                  "type": "boolean"
                                },
                                "rank": {
                                  "anyOf": [
                                    {
                                      "type": "integer",
                                      "minimum": -9007199254740991,
                                      "maximum": 9007199254740991
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "cited_you": {
                                  "type": [
                                    "boolean",
                                    "null"
                                  ]
                                },
                                "named_competitors": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                "sources": {
                                  "anyOf": [
                                    {
                                      "type": "array",
                                      "items": {
                                        "type": "object",
                                        "properties": {
                                          "domain": {
                                            "type": "string"
                                          },
                                          "url": {
                                            "type": "string"
                                          },
                                          "title": {
                                            "type": [
                                              "string",
                                              "null"
                                            ]
                                          }
                                        },
                                        "required": [
                                          "domain",
                                          "url",
                                          "title"
                                        ],
                                        "additionalProperties": false
                                      }
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "engine",
                                "answer",
                                "named",
                                "rank",
                                "cited_you",
                                "named_competitors",
                                "sources"
                              ],
                              "additionalProperties": false
                            }
                          }
                        },
                        "required": [
                          "week",
                          "answers"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "prompt",
                    "weeks"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/ai-referrals": {
      "get": {
        "operationId": "get_ai_referrals",
        "summary": "Reads how many visits to the business site came from AI assistants (ChatGPT, Perplexity, Gemini, Claude and others) over the last 28 final days in Google Analytics, against the 28 days before, with the visits per assistant. Stored data only; with no GA4 property linked it says so and gives no number.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "connected": {
                      "type": "boolean"
                    },
                    "as_of": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "days": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "covered_days": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "sessions": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "key_events": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "previous_sessions": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "by_engine": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "engine": {
                            "type": "string"
                          },
                          "sessions": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "key_events": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "engine",
                          "sessions",
                          "key_events"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "connected",
                    "as_of",
                    "days",
                    "covered_days",
                    "sessions",
                    "key_events",
                    "previous_sessions",
                    "by_engine"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/ai-visibility": {
      "get": {
        "operationId": "get_ai_visibility",
        "summary": "Reads, week by week, in how many answers each AI assistant named the business, for the questions it follows. Also the weekly numbers per assistant (named, cited, average place, who else was named, sites cited). Weeks measured with other questions are counted, not drawn. Paused questions and questions that name the business are not counted. `weekly[].comparable` says whether a week may be compared with the week before it: say a number went up or down only when it is true.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "questions": {
                      "anyOf": [
                        {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "weeks": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "format": "date"
                      }
                    },
                    "engines": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "engine": {
                            "type": "string",
                            "enum": [
                              "ChatGPT",
                              "Claude",
                              "Gemini",
                              "Perplexity"
                            ]
                          },
                          "points": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "week": {
                                  "type": "string",
                                  "format": "date"
                                },
                                "asked": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                "named": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                "cited": {
                                  "anyOf": [
                                    {
                                      "type": "integer",
                                      "minimum": -9007199254740991,
                                      "maximum": 9007199254740991
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "week",
                                "asked",
                                "named"
                              ],
                              "additionalProperties": false
                            }
                          }
                        },
                        "required": [
                          "engine",
                          "points"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "other_weeks": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "citations": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "week": {
                              "type": "string",
                              "format": "date"
                            },
                            "answers": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "with_sources": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "domains": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "domain": {
                                    "type": "string"
                                  },
                                  "you": {
                                    "type": "boolean"
                                  },
                                  "answers": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "engines": {
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "enum": [
                                        "ChatGPT",
                                        "Claude",
                                        "Gemini",
                                        "Perplexity"
                                      ]
                                    }
                                  },
                                  "questions": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  }
                                },
                                "required": [
                                  "domain",
                                  "you",
                                  "answers",
                                  "engines",
                                  "questions"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "week",
                            "answers",
                            "with_sources",
                            "domains"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "answers": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "engine": {
                            "type": "string",
                            "enum": [
                              "ChatGPT",
                              "Claude",
                              "Gemini",
                              "Perplexity"
                            ]
                          },
                          "prompt": {
                            "type": "string"
                          },
                          "named": {
                            "type": "boolean"
                          },
                          "rank": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "cited_you": {
                            "type": [
                              "boolean",
                              "null"
                            ]
                          },
                          "sources": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "named_competitors": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "engine",
                          "prompt",
                          "named",
                          "rank",
                          "cited_you",
                          "sources",
                          "named_competitors"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "weekly": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "week": {
                            "type": "string",
                            "format": "date"
                          },
                          "comparable": {
                            "type": "boolean"
                          },
                          "all": {
                            "type": "object",
                            "properties": {
                              "asked": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "named": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "sourced": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "cited": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "rank_avg": {
                                "type": [
                                  "number",
                                  "null"
                                ]
                              },
                              "ranked": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "brands": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "name": {
                                      "type": "string"
                                    },
                                    "answers": {
                                      "type": "integer",
                                      "minimum": -9007199254740991,
                                      "maximum": 9007199254740991
                                    }
                                  },
                                  "required": [
                                    "name",
                                    "answers"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "domains": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "domain": {
                                      "type": "string"
                                    },
                                    "you": {
                                      "type": "boolean"
                                    },
                                    "answers": {
                                      "type": "integer",
                                      "minimum": -9007199254740991,
                                      "maximum": 9007199254740991
                                    },
                                    "rival": {
                                      "type": "integer",
                                      "minimum": -9007199254740991,
                                      "maximum": 9007199254740991
                                    }
                                  },
                                  "required": [
                                    "domain",
                                    "you",
                                    "answers",
                                    "rival"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "tracked": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "domain": {
                                      "type": "string"
                                    },
                                    "answers": {
                                      "type": "integer",
                                      "minimum": -9007199254740991,
                                      "maximum": 9007199254740991
                                    }
                                  },
                                  "required": [
                                    "domain",
                                    "answers"
                                  ],
                                  "additionalProperties": false
                                }
                              }
                            },
                            "required": [
                              "asked",
                              "named",
                              "sourced",
                              "cited",
                              "rank_avg",
                              "ranked",
                              "brands",
                              "domains",
                              "tracked"
                            ],
                            "additionalProperties": false
                          },
                          "engines": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "asked": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                "named": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                "sourced": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                "cited": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                "rank_avg": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                },
                                "ranked": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                "brands": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "name": {
                                        "type": "string"
                                      },
                                      "answers": {
                                        "type": "integer",
                                        "minimum": -9007199254740991,
                                        "maximum": 9007199254740991
                                      }
                                    },
                                    "required": [
                                      "name",
                                      "answers"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "domains": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "domain": {
                                        "type": "string"
                                      },
                                      "you": {
                                        "type": "boolean"
                                      },
                                      "answers": {
                                        "type": "integer",
                                        "minimum": -9007199254740991,
                                        "maximum": 9007199254740991
                                      },
                                      "rival": {
                                        "type": "integer",
                                        "minimum": -9007199254740991,
                                        "maximum": 9007199254740991
                                      }
                                    },
                                    "required": [
                                      "domain",
                                      "you",
                                      "answers",
                                      "rival"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "tracked": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "domain": {
                                        "type": "string"
                                      },
                                      "answers": {
                                        "type": "integer",
                                        "minimum": -9007199254740991,
                                        "maximum": 9007199254740991
                                      }
                                    },
                                    "required": [
                                      "domain",
                                      "answers"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "engine": {
                                  "type": "string",
                                  "enum": [
                                    "ChatGPT",
                                    "Claude",
                                    "Gemini",
                                    "Perplexity"
                                  ]
                                }
                              },
                              "required": [
                                "asked",
                                "named",
                                "sourced",
                                "cited",
                                "rank_avg",
                                "ranked",
                                "brands",
                                "domains",
                                "tracked",
                                "engine"
                              ],
                              "additionalProperties": false
                            }
                          }
                        },
                        "required": [
                          "week",
                          "all",
                          "engines"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "measure": {
                      "type": "object",
                      "properties": {
                        "outcome": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "ok",
                                "partial",
                                "no_credit",
                                "cap_reached",
                                "plan_required",
                                "connection_lost",
                                "provider_error",
                                "paused",
                                "stuck"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "skip_reason": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "ok",
                                "partial",
                                "no_credit",
                                "cap_reached",
                                "plan_required",
                                "connection_lost",
                                "provider_error",
                                "paused",
                                "stuck"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "skip_at": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "collected": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "planned": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "complete": {
                          "type": [
                            "boolean",
                            "null"
                          ]
                        },
                        "at": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "outcome",
                        "skip_reason",
                        "skip_at",
                        "collected",
                        "planned",
                        "complete",
                        "at"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "questions",
                    "weeks",
                    "engines",
                    "other_weeks"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/alert-policies": {
      "get": {
        "operationId": "get_alert_policies",
        "summary": "Reads which alerts are on for one business: each scenario with its switch, whether it can be switched off (`required`), the accounts it watches and the dates it is quiet. The alert lines themselves are not shown. Reading only; a person changes the policy in the panel.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "client_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "policies": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "scenario": {
                            "type": "string"
                          },
                          "enabled": {
                            "type": "boolean"
                          },
                          "required": {
                            "type": "boolean"
                          },
                          "action_template": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "asset_ids": {
                            "anyOf": [
                              {
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "format": "uuid"
                                }
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "quiet_dates": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "scenario",
                          "enabled",
                          "required",
                          "action_template",
                          "asset_ids",
                          "quiet_dates"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "client_id",
                    "policies"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/autopilot": {
      "get": {
        "operationId": "get_autopilot_status",
        "summary": "What Autopilot may do on this business now, what stopped it, what it wants to tell the customer, and which offers wait.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "client_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "mode": {
                      "type": "string",
                      "enum": [
                        "guide",
                        "autopilot"
                      ]
                    },
                    "paused": {
                      "type": "boolean"
                    },
                    "suspended": {
                      "type": "boolean"
                    },
                    "assets": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "asset_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "platform": {
                            "type": "string"
                          },
                          "currency": {
                            "type": "string"
                          },
                          "cap": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "amount_minor": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "currency": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "amount_minor",
                                  "currency"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "auto_apply": {
                            "type": "boolean"
                          },
                          "type_auto": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {
                              "type": "string",
                              "enum": [
                                "auto",
                                "ask"
                              ]
                            }
                          },
                          "hands_off": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "limits": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {
                              "type": [
                                "number",
                                "null"
                              ]
                            }
                          },
                          "one_click": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "notes": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "at": {
                                  "type": "string"
                                },
                                "code": {
                                  "type": "string"
                                },
                                "text": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "at",
                                "code",
                                "text"
                              ],
                              "additionalProperties": false
                            }
                          }
                        },
                        "required": [
                          "asset_id",
                          "platform",
                          "currency",
                          "cap",
                          "auto_apply",
                          "type_auto",
                          "hands_off",
                          "limits",
                          "one_click",
                          "notes"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "auto_allowed": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "offers": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "offer_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "asset_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "change_type": {
                            "type": "string"
                          },
                          "sentence": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "offer_id",
                          "asset_id",
                          "change_type",
                          "sentence"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "client_id",
                    "mode",
                    "paused",
                    "suspended",
                    "assets",
                    "auto_allowed",
                    "offers"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/research/backlinks/anchors": {
      "post": {
        "operationId": "get_backlink_anchors",
        "summary": "The words other sites use when they link to a site or page (anchors), the most used first: for each, the links and referring domains, their authority and spam score (0 to 100, the source's), and when it was first seen; and the spam score of the target itself. `scope`: page, domain (this host only) or subdomains. Up to 100 rows. Costs 11 credits: an agent or key sends max_credits. Nothing is charged when the target has no links.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Optional. Send the same value to repeat this paid call without paying twice; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused). The CLI sends one made from the request.",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "target": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 300
                  },
                  "scope": {
                    "default": "domain",
                    "type": "string",
                    "enum": [
                      "page",
                      "domain",
                      "subdomains"
                    ]
                  },
                  "limit": {
                    "default": 25,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "description": "The most rows to return."
                  },
                  "max_credits": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000,
                    "description": "The most credits this call may spend. A call that costs more is refused and nothing is spent. estimate_spend gives the price."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "target": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string",
                      "enum": [
                        "page",
                        "domain",
                        "subdomains"
                      ]
                    },
                    "spam_score": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "rows": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "anchor": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "backlinks": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "referring_domains": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "authority": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "spam_score": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "first_seen": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "anchor",
                          "backlinks",
                          "referring_domains",
                          "authority",
                          "spam_score",
                          "first_seen"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "credits": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "balance": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "target",
                    "scope",
                    "spam_score",
                    "total",
                    "rows",
                    "credits",
                    "balance"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "The credit cap or balance is short (G-COST), or the organization has no paid plan (G-ENTITLEMENT). missing and next_action say what to do.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/research/backlinks/gap": {
      "post": {
        "operationId": "get_backlink_gap",
        "summary": "Sites that link to your rivals (1 to 3) and not to the business: the places to ask for a link. Each row has the domain, its authority (0 to 100) and which of the rivals it links to. Send `rivals` as site addresses. Costs 6 credits: an agent or key sends max_credits. Nothing is charged when there are no such sites.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Optional. Send the same value to repeat this paid call without paying twice; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused). The CLI sends one made from the request.",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "rivals": {
                    "minItems": 1,
                    "maxItems": 3,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 3,
                      "maxLength": 300
                    }
                  },
                  "limit": {
                    "default": 25,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "description": "The most rows to return."
                  },
                  "max_credits": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000,
                    "description": "The most credits this call may spend. A call that costs more is refused and nothing is spent. estimate_spend gives the price."
                  }
                },
                "required": [
                  "rivals"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "target": {
                      "type": "string"
                    },
                    "rivals": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "rows": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "domain": {
                            "type": "string"
                          },
                          "authority": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "links_to": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "domain",
                          "authority",
                          "links_to"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "credits": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "balance": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "target",
                    "rivals",
                    "total",
                    "rows",
                    "credits",
                    "balance"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "The credit cap or balance is short (G-COST), or the organization has no paid plan (G-ENTITLEMENT). missing and next_action say what to do.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/research/backlinks/history": {
      "post": {
        "operationId": "get_backlink_history",
        "summary": "How a site's links moved over the last 24 months, month by month (counted on the first day of each month): authority (0 to 100), backlinks, referring domains, and the links and domains gained and lost against the month before. Send `target` (a site; the business's own when left out). Costs 5 credits: an agent or key sends max_credits. Nothing is charged when the source has no links for the site.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Optional. Send the same value to repeat this paid call without paying twice; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused). The CLI sends one made from the request.",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "target": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 300
                  },
                  "max_credits": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000,
                    "description": "The most credits this call may spend. A call that costs more is refused and nothing is spent. estimate_spend gives the price."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "target": {
                      "type": "string"
                    },
                    "months": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "month": {
                            "type": "string"
                          },
                          "authority": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "backlinks": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "referring_domains": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "new_backlinks": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "lost_backlinks": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "new_referring_domains": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "lost_referring_domains": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "month",
                          "authority",
                          "backlinks",
                          "referring_domains",
                          "new_backlinks",
                          "lost_backlinks",
                          "new_referring_domains",
                          "lost_referring_domains"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "credits": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "balance": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "target",
                    "months",
                    "credits",
                    "balance"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "The credit cap or balance is short (G-COST), or the organization has no paid plan (G-ENTITLEMENT). missing and next_action say what to do.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/research/backlinks/overview": {
      "post": {
        "operationId": "get_backlink_overview",
        "summary": "The links to a site, page or folder: how many backlinks and referring domains, the authority (0 to 100), the share of links that pass authority (follow), and the links gained and lost in the last 30 days. `scope`: page, folder, domain (this host only) or subdomains (with its subdomains); the links gained and lost always count the host with its subdomains. Costs 10 credits: an agent or key sends max_credits. Nothing is charged when the source has no data for the target.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Optional. Send the same value to repeat this paid call without paying twice; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused). The CLI sends one made from the request.",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "target": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 300
                  },
                  "scope": {
                    "default": "domain",
                    "type": "string",
                    "enum": [
                      "page",
                      "folder",
                      "domain",
                      "subdomains"
                    ]
                  },
                  "max_credits": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000,
                    "description": "The most credits this call may spend. A call that costs more is refused and nothing is spent. estimate_spend gives the price."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "target": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string",
                      "enum": [
                        "page",
                        "folder",
                        "domain",
                        "subdomains"
                      ]
                    },
                    "authority": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "backlinks": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "referring_domains": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "follow_share": {
                      "anyOf": [
                        {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "new_30d": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "lost_30d": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "credits": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "balance": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "target",
                    "scope",
                    "authority",
                    "backlinks",
                    "referring_domains",
                    "follow_share",
                    "new_30d",
                    "lost_30d",
                    "credits",
                    "balance"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "The credit cap or balance is short (G-COST), or the organization has no paid plan (G-ENTITLEMENT). missing and next_action say what to do.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/backlinks": {
      "get": {
        "operationId": "get_backlinks",
        "summary": "The links that point to the business and to its rivals: how many, from how many sites, the rank, broken links and spam score, and the best linking sites of each. It reads stored data only, read once a month.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "as_of": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "sites": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "domain": {
                            "type": "string"
                          },
                          "is_you": {
                            "type": "boolean"
                          },
                          "rank": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "backlinks": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "referring_domains": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "broken_backlinks": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "broken_pages": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "spam_score": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "top_referring": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "domain": {
                                  "type": "string"
                                },
                                "rank": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                },
                                "backlinks": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                },
                                "first_seen": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "spam_score": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                }
                              },
                              "required": [
                                "domain",
                                "rank",
                                "backlinks",
                                "first_seen",
                                "spam_score"
                              ],
                              "additionalProperties": false
                            }
                          }
                        },
                        "required": [
                          "domain",
                          "is_you",
                          "rank",
                          "backlinks",
                          "referring_domains",
                          "broken_backlinks",
                          "broken_pages",
                          "spam_score",
                          "top_referring"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "gap": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "not_collected_yet",
                            "region_not_supported",
                            "budget_cap",
                            "task_pending",
                            "source_failed",
                            "no_page_id",
                            "not_shown_yet",
                            "nothing_found",
                            "none_tracked"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "top_referring_gap": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "not_collected_yet",
                            "region_not_supported",
                            "budget_cap",
                            "task_pending",
                            "source_failed",
                            "no_page_id",
                            "not_shown_yet",
                            "nothing_found",
                            "none_tracked"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "as_of",
                    "sites",
                    "gap",
                    "top_referring_gap"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/billing": {
      "get": {
        "operationId": "get_billing",
        "summary": "The plan of the organization: its status, items, trial and renewal dates, and whether a payment needs attention.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string",
                      "const": "USD"
                    },
                    "payment_health": {
                      "type": "string",
                      "enum": [
                        "ok",
                        "past_due",
                        "restricted"
                      ]
                    },
                    "interval": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "month",
                            "year"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "trial_ends_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "trial_ask": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "questions": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "remaining": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "until": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "questions",
                            "remaining",
                            "until"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "period_end": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "cancel_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "price_key": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string"
                          },
                          "usd_cents": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "credits": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "price_key",
                          "kind",
                          "usd_cents",
                          "credits"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "plan_items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "kind": {
                            "type": "string"
                          },
                          "price_key": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "client_id": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "uuid"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "kind",
                          "price_key",
                          "client_id"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "plan_cents": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "status",
                    "currency",
                    "payment_health",
                    "interval",
                    "trial_ends_at",
                    "trial_ask",
                    "period_end",
                    "cancel_at",
                    "items",
                    "plan_items",
                    "plan_cents"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/bootstrap": {
      "get": {
        "operationId": "get_bootstrap",
        "summary": "The account in one call: the person, the organization and role, the businesses with their newest scan (id, status, score), the plan as `entitlements`, the credits and the unread notification count. An agent gets no e-mail address.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "person": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "email": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "language": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "email",
                        "language"
                      ],
                      "additionalProperties": false
                    },
                    "org": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "name": {
                          "type": "string"
                        },
                        "role": {
                          "type": "string",
                          "enum": [
                            "owner",
                            "admin",
                            "operator",
                            "viewer"
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "role"
                      ],
                      "additionalProperties": false
                    },
                    "clients": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "name": {
                            "type": "string"
                          },
                          "mode": {
                            "type": "string"
                          },
                          "paused": {
                            "type": "boolean"
                          },
                          "scan": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "format": "uuid"
                                  },
                                  "domain": {
                                    "type": "string"
                                  },
                                  "status": {
                                    "type": "string"
                                  },
                                  "score": {
                                    "type": [
                                      "number",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "id",
                                  "domain",
                                  "status",
                                  "score"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "mode",
                          "paused",
                          "scan"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "entitlements": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "credits": {
                      "type": "object",
                      "properties": {
                        "monthly": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "topup": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "total": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "held": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "monthly",
                        "topup",
                        "total",
                        "held"
                      ],
                      "additionalProperties": false
                    },
                    "unread": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "person",
                    "org",
                    "clients",
                    "entitlements",
                    "credits",
                    "unread"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/branches": {
      "get": {
        "operationId": "get_branches",
        "summary": "The branches of a business that it tracks on the local grid: name, address, point on the map, Google listing id, and the rating, review count and category of the listing (null when unknown). Stored data only, free.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "branches": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "name": {
                            "type": "string"
                          },
                          "address": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "lat": {
                            "type": "number"
                          },
                          "lng": {
                            "type": "number"
                          },
                          "cid": {
                            "type": "string"
                          },
                          "place_id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "rating": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "votes": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "category": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "address",
                          "lat",
                          "lng",
                          "cid",
                          "place_id",
                          "rating",
                          "votes",
                          "category"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "max": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "branches",
                    "max"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "save_branch",
        "summary": "Adds a place of the business on Google Maps as a branch to track on the local grid, from a candidate of list_branch_candidates (or find_business): its name, Google listing id (`cid`, digits), point on the map and, if known, place id, address, rating, review count (`votes`) and category. Saving the same `cid` again updates it. At most 20 branches. Free. A person chooses which spots of the grid are read for a branch, in the panel (the local grid setup is not an agent tool).",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200,
                    "pattern": "^[^\\p{Cc}]*$"
                  },
                  "cid": {
                    "type": "string",
                    "pattern": "^[0-9]{1,24}$"
                  },
                  "place_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120,
                    "pattern": "^[^\\p{Cc}]*$"
                  },
                  "address": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 300,
                    "pattern": "^[^\\p{Cc}]*$"
                  },
                  "rating": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 5
                  },
                  "votes": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100000000
                  },
                  "category": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "pattern": "^[^\\p{Cc}]*$"
                  },
                  "lat": {
                    "type": "number",
                    "minimum": -90,
                    "maximum": 90
                  },
                  "lng": {
                    "type": "number",
                    "minimum": -180,
                    "maximum": 180
                  }
                },
                "required": [
                  "name",
                  "cid",
                  "lat",
                  "lng"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "branches": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "name": {
                            "type": "string"
                          },
                          "address": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "lat": {
                            "type": "number"
                          },
                          "lng": {
                            "type": "number"
                          },
                          "cid": {
                            "type": "string"
                          },
                          "place_id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "rating": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "votes": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "category": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "address",
                          "lat",
                          "lng",
                          "cid",
                          "place_id",
                          "rating",
                          "votes",
                          "category"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "max": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "branches",
                    "max"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/research/brand-mentions": {
      "post": {
        "operationId": "get_brand_mentions",
        "summary": "How the web talks about the business: how many pages cite its name, how many read positive, negative or neutral, the feelings they carry, the sites that cite it most and the kinds of page (news, blogs, forums, shops, organizations), and the newest citations, one a site (address, site, title, snippet, date and tone). Send `name` to read another spelling; the business's own name when left out. No author names, e-mail addresses or personal profile pages are returned. Costs 10 credits: an agent or key sends max_credits (estimate_spend gives the price). Nothing is charged when no page cites the name.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Optional. Send the same value to repeat this paid call without paying twice; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused). The CLI sends one made from the request.",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 100,
                    "pattern": "^[^\\p{Cc}\"]*$"
                  },
                  "max_credits": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000,
                    "description": "The most credits this call may spend. A call that costs more is refused and nothing is spent. estimate_spend gives the price."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "sentiment": {
                      "type": "object",
                      "properties": {
                        "positive": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "negative": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "neutral": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "positive",
                        "negative",
                        "neutral"
                      ],
                      "additionalProperties": false
                    },
                    "emotions": {
                      "type": "object",
                      "properties": {
                        "anger": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "happiness": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "love": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "sadness": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "share": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "fun": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "anger",
                        "happiness",
                        "love",
                        "sadness",
                        "share",
                        "fun"
                      ],
                      "additionalProperties": false
                    },
                    "top_domains": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "domain": {
                            "type": "string"
                          },
                          "count": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "domain",
                          "count"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "page_types": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "mentions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "url": {
                            "type": "string"
                          },
                          "domain": {
                            "type": "string"
                          },
                          "title": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "snippet": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "published": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "sentiment": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "positive",
                                  "negative",
                                  "neutral"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "page_types": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "url",
                          "domain",
                          "title",
                          "snippet",
                          "published",
                          "sentiment",
                          "page_types"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "credits": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "balance": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "name",
                    "total",
                    "sentiment",
                    "emotions",
                    "top_domains",
                    "page_types",
                    "mentions",
                    "credits",
                    "balance"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "The credit cap or balance is short (G-COST), or the organization has no paid plan (G-ENTITLEMENT). missing and next_action say what to do.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/business-info": {
      "get": {
        "operationId": "get_business_info",
        "summary": "What the business card shows: the website, the name, a summary, the services, the market (country with where it came from, city, language) and the key pages (at most 20, each with a role). The rivals are listed by list_tracking and changed by set_tracked_competitors.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "domain": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "name": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "summary": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "services": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "market": {
                      "type": "object",
                      "properties": {
                        "country": {
                          "type": "string"
                        },
                        "country_name": {
                          "type": "string"
                        },
                        "country_by": {
                          "type": "string",
                          "enum": [
                            "you",
                            "search_console",
                            "site",
                            "default"
                          ]
                        },
                        "caption": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "city": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "language": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "scope": {
                          "type": "string",
                          "enum": [
                            "country",
                            "worldwide"
                          ]
                        },
                        "stamp": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "by": {
                                  "type": "string",
                                  "enum": [
                                    "owner",
                                    "upnatus",
                                    "agent"
                                  ]
                                },
                                "at": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "by",
                                "at"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "country",
                        "country_name",
                        "country_by",
                        "caption",
                        "city",
                        "language",
                        "scope",
                        "stamp"
                      ],
                      "additionalProperties": false
                    },
                    "key_pages": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "url": {
                            "type": "string"
                          },
                          "role": {
                            "type": "string",
                            "enum": [
                              "home",
                              "money",
                              "supporting",
                              "other"
                            ]
                          }
                        },
                        "required": [
                          "url",
                          "role"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "key_pages_limit": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "facts": {
                      "type": "object",
                      "properties": {
                        "summary": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "value": {
                                  "type": "string"
                                },
                                "by": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "enum": [
                                        "owner",
                                        "upnatus",
                                        "agent"
                                      ]
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "at": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                }
                              },
                              "required": [
                                "id",
                                "value",
                                "by",
                                "at"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "target_customers": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "value": {
                                  "type": "string"
                                },
                                "by": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "enum": [
                                        "owner",
                                        "upnatus",
                                        "agent"
                                      ]
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "at": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                }
                              },
                              "required": [
                                "id",
                                "value",
                                "by",
                                "at"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "brand_voice": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "value": {
                                  "type": "string"
                                },
                                "by": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "enum": [
                                        "owner",
                                        "upnatus",
                                        "agent"
                                      ]
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "at": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                }
                              },
                              "required": [
                                "id",
                                "value",
                                "by",
                                "at"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "service_area": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "value": {
                                  "type": "string"
                                },
                                "by": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "enum": [
                                        "owner",
                                        "upnatus",
                                        "agent"
                                      ]
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "at": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                }
                              },
                              "required": [
                                "id",
                                "value",
                                "by",
                                "at"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "business_model": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "value": {
                                  "type": "string"
                                },
                                "by": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "enum": [
                                        "owner",
                                        "upnatus",
                                        "agent"
                                      ]
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "at": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                }
                              },
                              "required": [
                                "id",
                                "value",
                                "by",
                                "at"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "monthly_budget": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "value": {
                                  "type": "string"
                                },
                                "by": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "enum": [
                                        "owner",
                                        "upnatus",
                                        "agent"
                                      ]
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "at": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                }
                              },
                              "required": [
                                "id",
                                "value",
                                "by",
                                "at"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "lead_response_channel": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "value": {
                                  "type": "string"
                                },
                                "by": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "enum": [
                                        "owner",
                                        "upnatus",
                                        "agent"
                                      ]
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "at": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                }
                              },
                              "required": [
                                "id",
                                "value",
                                "by",
                                "at"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "services": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "value": {
                                "type": "string"
                              },
                              "by": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "enum": [
                                      "owner",
                                      "upnatus",
                                      "agent"
                                    ]
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "at": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "required": [
                              "id",
                              "value",
                              "by",
                              "at"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "words_to_avoid": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "value": {
                                "type": "string"
                              },
                              "by": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "enum": [
                                      "owner",
                                      "upnatus",
                                      "agent"
                                    ]
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "at": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "required": [
                              "id",
                              "value",
                              "by",
                              "at"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "key_pages": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "role": {
                                "type": "string",
                                "enum": [
                                  "home",
                                  "money",
                                  "supporting",
                                  "other"
                                ]
                              },
                              "by": {
                                "type": "string",
                                "enum": [
                                  "owner",
                                  "upnatus",
                                  "agent"
                                ]
                              },
                              "at": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "url",
                              "role",
                              "by",
                              "at"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "summary",
                        "target_customers",
                        "brand_voice",
                        "service_area",
                        "business_model",
                        "monthly_budget",
                        "lead_response_channel",
                        "services",
                        "words_to_avoid",
                        "key_pages"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "domain",
                    "name",
                    "summary",
                    "services",
                    "market",
                    "key_pages",
                    "key_pages_limit",
                    "facts"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/campaign-drafts/{draft_id}": {
      "get": {
        "operationId": "get_campaign_draft",
        "summary": "Returns one planned campaign: its settings in plain words, the ad texts, the last checks, the delivery looks and the next step.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "draft_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "draft_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "client_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "asset_id": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "platform": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "plan": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "creatives": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "creative_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "status": {
                            "type": "string"
                          },
                          "angle": {
                            "type": "string"
                          },
                          "headlines": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "descriptions": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "brief": {}
                        },
                        "required": [
                          "creative_id",
                          "status",
                          "angle",
                          "headlines",
                          "descriptions",
                          "brief"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "preflight": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "ok": {
                              "type": "boolean"
                            },
                            "checked_at": {
                              "type": "string"
                            },
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "n": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "group": {
                                    "type": "string"
                                  },
                                  "ok": {
                                    "type": "boolean"
                                  },
                                  "why": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "fix": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "n",
                                  "group",
                                  "ok",
                                  "why",
                                  "fix"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "ok",
                            "checked_at",
                            "items"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "delivery": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "looks": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "hours": {
                                    "type": "number"
                                  },
                                  "at": {
                                    "type": "string"
                                  },
                                  "status": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "issues": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  },
                                  "impressions": {
                                    "type": [
                                      "number",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "hours",
                                  "at",
                                  "status",
                                  "issues",
                                  "impressions"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "warnings": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "code": {
                                    "type": "string"
                                  },
                                  "at": {
                                    "type": "string"
                                  },
                                  "message": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "code",
                                  "at",
                                  "message"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "looks",
                            "warnings"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "create_action_id": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "launch_action_id": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "next_step": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "draft_id",
                    "client_id",
                    "asset_id",
                    "platform",
                    "status",
                    "plan",
                    "creatives",
                    "preflight",
                    "delivery",
                    "create_action_id",
                    "launch_action_id",
                    "next_step"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/chats/{id}": {
      "get": {
        "operationId": "get_chat",
        "summary": "Reads your chat and its advisor messages. After send_chat_message, read again while busy is true.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "client_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "title": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "busy": {
                      "type": "boolean"
                    },
                    "messages": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "role": {
                            "type": "string",
                            "enum": [
                              "user",
                              "assistant"
                            ]
                          },
                          "text": {
                            "type": "string"
                          },
                          "at": {
                            "type": "string"
                          },
                          "parts": {
                            "anyOf": [
                              {},
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "role",
                          "text",
                          "at",
                          "parts"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "id",
                    "title",
                    "busy",
                    "messages"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/chat-memory": {
      "get": {
        "operationId": "get_chat_memory",
        "summary": "Reads what the advisor remembers about this business: the profile facts, the notes and the never-say lines (each with who wrote it: owner, panel assistant or outside agent, and when), and what paid research was asked for it lately. Change the notes with update_chat_memory.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "facts": {
                      "type": "object",
                      "properties": {
                        "country": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "business_model": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "lead_response_channel": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "monthly_budget": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "currency": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "has_service_area": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "country",
                        "business_model",
                        "lead_response_channel",
                        "monthly_budget",
                        "currency",
                        "has_service_area"
                      ],
                      "additionalProperties": false
                    },
                    "missing": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "never_say": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "notes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "entries": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "note",
                              "never_say"
                            ]
                          },
                          "text": {
                            "type": "string"
                          },
                          "updated_by": {
                            "type": "string",
                            "enum": [
                              "owner",
                              "panel_assistant",
                              "outside_agent"
                            ]
                          },
                          "at": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "kind",
                          "text",
                          "updated_by",
                          "at"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "research": {
                      "type": "object",
                      "properties": {
                        "repeat_days": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "items": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string"
                              },
                              "what": {
                                "type": "string"
                              },
                              "asked_at": {
                                "type": "string"
                              },
                              "asked_by": {
                                "type": "string",
                                "enum": [
                                  "owner",
                                  "panel_assistant",
                                  "outside_agent"
                                ]
                              },
                              "credits": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              }
                            },
                            "required": [
                              "kind",
                              "what",
                              "asked_at",
                              "asked_by",
                              "credits"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "repeat_days",
                        "items"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "facts",
                    "missing",
                    "never_say",
                    "notes",
                    "entries",
                    "research"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "update_chat_memory",
        "summary": "Changes what the advisor remembers about this business: short notes to keep, and things it must never say. Send only the change: add lines, remove lines by id (from get_chat_memory). Every line keeps who wrote it, and the owner sees it. Answers with the whole memory.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "add": {
                    "maxItems": 5,
                    "type": "array",
                    "items": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "note"
                            },
                            "text": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 240,
                              "pattern": "^[^\\p{Cc}]*$"
                            }
                          },
                          "required": [
                            "kind",
                            "text"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "never_say"
                            },
                            "text": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120,
                              "pattern": "^[^\\p{Cc}]*$"
                            }
                          },
                          "required": [
                            "kind",
                            "text"
                          ]
                        }
                      ]
                    }
                  },
                  "remove": {
                    "maxItems": 10,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 40
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "entries": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "note",
                              "never_say"
                            ]
                          },
                          "text": {
                            "type": "string"
                          },
                          "updated_by": {
                            "type": "string",
                            "enum": [
                              "owner",
                              "panel_assistant",
                              "outside_agent"
                            ]
                          },
                          "at": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "kind",
                          "text",
                          "updated_by",
                          "at"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "entries"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/credits": {
      "get": {
        "operationId": "get_credits",
        "summary": "The credits the organization can spend now, from the monthly allowance and from top-ups. Called with an API key, `key` also says what this key may spend a month and what it spent so far.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "monthly": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "topup": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "total": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "held": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "next_expiry": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "key": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "monthly_credit_cap": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "credits_this_month": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "monthly_credit_cap",
                            "credits_this_month"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "monthly",
                    "topup",
                    "total",
                    "held",
                    "next_expiry",
                    "key"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/research/domain-overview": {
      "post": {
        "operationId": "get_domain_overview",
        "summary": "What a site or page gets from Google search: the estimated visits a month, how many searches it ranks for, its biggest searches (with place, searches a month, visits and page) and its biggest pages. Send `target` (a site or page address; the business's own site when left out), `scope` (page, folder, domain or subdomains; the source reads a site with its subdomains in both of the last two, so they give the same answer) and `country` (the business's own when left out). Costs 7 credits: an agent or key sends max_credits (estimate_spend gives the price). Nothing is charged when the source has no data for the target.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Optional. Send the same value to repeat this paid call without paying twice; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused). The CLI sends one made from the request.",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "target": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 300
                  },
                  "scope": {
                    "default": "domain",
                    "type": "string",
                    "enum": [
                      "page",
                      "folder",
                      "domain",
                      "subdomains"
                    ]
                  },
                  "country": {
                    "type": "string",
                    "pattern": "^[A-Za-z]{2}$"
                  },
                  "max_credits": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000,
                    "description": "The most credits this call may spend. A call that costs more is refused and nothing is spent. estimate_spend gives the price."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "target": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string",
                      "enum": [
                        "page",
                        "folder",
                        "domain",
                        "subdomains"
                      ]
                    },
                    "country": {
                      "type": "string"
                    },
                    "keywords": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "visits": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "top_keywords": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "keyword": {
                            "type": "string"
                          },
                          "position": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "monthly_searches": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "visits": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "path": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "keyword",
                          "position",
                          "monthly_searches",
                          "visits",
                          "path"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "top_pages": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "page": {
                            "type": "string"
                          },
                          "top_keyword": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "position": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "keywords": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "visits": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "page",
                          "top_keyword",
                          "position",
                          "keywords",
                          "visits"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "credits": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "balance": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "target",
                    "scope",
                    "country",
                    "keywords",
                    "visits",
                    "top_keywords",
                    "top_pages",
                    "credits",
                    "balance"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "The credit cap or balance is short (G-COST), or the organization has no paid plan (G-ENTITLEMENT). missing and next_action say what to do.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/research/rank-history": {
      "post": {
        "operationId": "get_domain_rank_history",
        "summary": "How a site's Google ranks moved over the last 12 months, month by month: the searches it ranks for, how many in the top 3 and top 10, the visits a month they are worth (an estimate), and the searches it gained and lost. Send `target` (a site; the business's own when left out) and `country`. Costs 28 credits: an agent or key sends max_credits. Nothing is charged when the source has no data for the site.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Optional. Send the same value to repeat this paid call without paying twice; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused). The CLI sends one made from the request.",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "target": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 300
                  },
                  "country": {
                    "type": "string",
                    "pattern": "^[A-Za-z]{2}$"
                  },
                  "max_credits": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000,
                    "description": "The most credits this call may spend. A call that costs more is refused and nothing is spent. estimate_spend gives the price."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "target": {
                      "type": "string"
                    },
                    "country": {
                      "type": "string"
                    },
                    "months": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "month": {
                            "type": "string"
                          },
                          "keywords": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "top3": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "top10": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "visits": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "new": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "lost": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "month",
                          "keywords",
                          "top3",
                          "top10",
                          "visits",
                          "new",
                          "lost"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "credits": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "balance": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "target",
                    "country",
                    "months",
                    "credits",
                    "balance"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "The credit cap or balance is short (G-COST), or the organization has no paid plan (G-ENTITLEMENT). missing and next_action say what to do.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/facts/{fact_id}": {
      "get": {
        "operationId": "get_fact_rows",
        "summary": "Shows the number behind a finding: its value, its days, how much of the data it covers and a sample of the rows.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "fact_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "fact_id": {
                      "type": "string"
                    },
                    "value": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "unit": {
                      "type": "string"
                    },
                    "currency": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "window": {
                      "type": "object",
                      "properties": {
                        "start": {
                          "type": "string"
                        },
                        "end": {
                          "type": "string"
                        },
                        "timezone": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "start",
                        "end",
                        "timezone"
                      ],
                      "additionalProperties": false
                    },
                    "is_estimate": {
                      "type": "boolean"
                    },
                    "undefined_reason": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "n": {},
                    "coverage": {},
                    "row_count": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "rows": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      }
                    }
                  },
                  "required": [
                    "fact_id",
                    "value",
                    "unit",
                    "currency",
                    "window",
                    "is_estimate",
                    "undefined_reason",
                    "n",
                    "coverage",
                    "row_count",
                    "rows"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/findings/{finding_ref}": {
      "get": {
        "operationId": "get_finding",
        "summary": "Reads one finding by its reference.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "finding_ref",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 3,
              "maxLength": 120
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "finding_ref": {
                      "type": "string"
                    },
                    "client_id": {
                      "type": "string"
                    },
                    "channel": {
                      "type": "string",
                      "enum": [
                        "google_ads",
                        "meta_ads",
                        "openai_ads",
                        "linkedin_ads",
                        "seo",
                        "geo",
                        "site",
                        "tracking",
                        "cross"
                      ]
                    },
                    "area": {
                      "type": "string",
                      "enum": [
                        "preflight",
                        "tracking",
                        "waste",
                        "search_terms",
                        "bidding",
                        "budget",
                        "placement",
                        "targeting",
                        "lead_quality",
                        "landing_page",
                        "structure",
                        "creative",
                        "platform_change",
                        "seo",
                        "geo",
                        "competitor"
                      ]
                    },
                    "severity": {
                      "type": "number"
                    },
                    "safety": {
                      "type": "boolean"
                    },
                    "priority": {
                      "type": "number"
                    },
                    "entity": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "level": {
                              "type": "string"
                            },
                            "id": {
                              "type": "string"
                            },
                            "label": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "level",
                            "id",
                            "label"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "lifecycle": {
                      "type": "string"
                    },
                    "certainty": {
                      "type": "string",
                      "enum": [
                        "established",
                        "likely",
                        "hypothesis",
                        "unknown"
                      ]
                    },
                    "window": {
                      "type": "object",
                      "properties": {
                        "start": {
                          "type": "string"
                        },
                        "end": {
                          "type": "string"
                        },
                        "timezone": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "start",
                        "end",
                        "timezone"
                      ],
                      "additionalProperties": false
                    },
                    "lang": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "summary": {
                      "type": "string"
                    },
                    "claims": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "claim_id": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string"
                          },
                          "text": {
                            "type": "string"
                          },
                          "certainty": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "claim_id",
                          "kind",
                          "text",
                          "certainty"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "facts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "fact_id": {
                            "type": "string"
                          },
                          "label": {
                            "type": "string"
                          },
                          "value": {
                            "type": [
                              "number",
                              "string",
                              "null"
                            ]
                          },
                          "unit": {
                            "type": "string"
                          },
                          "window": {
                            "type": "object",
                            "properties": {
                              "from": {
                                "type": "string"
                              },
                              "to": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "from",
                              "to"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "fact_id",
                          "label",
                          "value",
                          "unit"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "counter_facts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "fact_id": {
                            "type": "string"
                          },
                          "label": {
                            "type": "string"
                          },
                          "value": {
                            "type": [
                              "number",
                              "string",
                              "null"
                            ]
                          },
                          "unit": {
                            "type": "string"
                          },
                          "window": {
                            "type": "object",
                            "properties": {
                              "from": {
                                "type": "string"
                              },
                              "to": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "from",
                              "to"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "fact_id",
                          "label",
                          "value",
                          "unit"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "limits": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "money": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string"
                            },
                            "fact_id": {
                              "type": "string"
                            },
                            "currency": {
                              "type": "string"
                            },
                            "basis": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "kind",
                            "fact_id",
                            "currency",
                            "basis"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "alternatives": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "text": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "text"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "questions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "question_key": {
                            "type": "string"
                          },
                          "text": {
                            "type": "string"
                          },
                          "why": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "question_key",
                          "text",
                          "why"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "do_not": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "key": {
                            "type": "string"
                          },
                          "text": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "key",
                          "text"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "suggested": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "type"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "data_as_of": {
                      "type": "string"
                    },
                    "stale_after": {
                      "type": "string"
                    },
                    "first_seen_at": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "finding_ref",
                    "client_id",
                    "channel",
                    "area",
                    "severity",
                    "safety",
                    "priority",
                    "entity",
                    "lifecycle",
                    "certainty",
                    "window",
                    "lang",
                    "title",
                    "summary",
                    "claims",
                    "facts",
                    "counter_facts",
                    "limits",
                    "money",
                    "alternatives",
                    "questions",
                    "do_not",
                    "suggested",
                    "data_as_of",
                    "stale_after",
                    "first_seen_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/first-read": {
      "get": {
        "operationId": "get_first_read",
        "summary": "The first read of a business: what its ad account spent, how much of it went to clicks that never had a chance, what to leave alone and what is not visible yet. It reads the stored analysis only, so it can be asked often. While the analysis runs, it says so and names the step to follow.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "const": "ready"
                        },
                        "lever": {
                          "type": "string",
                          "enum": [
                            "waste",
                            "after_click",
                            "tracking",
                            "too_little_data"
                          ]
                        },
                        "window": {
                          "type": "object",
                          "properties": {
                            "start": {
                              "type": "string",
                              "format": "date"
                            },
                            "end": {
                              "type": "string",
                              "format": "date"
                            },
                            "timezone": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "start",
                            "end",
                            "timezone"
                          ],
                          "additionalProperties": false
                        },
                        "currency": {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        "coverage": {
                          "type": "object",
                          "properties": {
                            "assets": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "campaigns": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "keywords": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "search_terms": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "spend_minor": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "coverage_share": {
                              "anyOf": [
                                {
                                  "type": "number",
                                  "minimum": 0,
                                  "maximum": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "minimum": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "assets",
                            "campaigns",
                            "keywords",
                            "search_terms",
                            "spend_minor",
                            "coverage_share",
                            "minimum"
                          ],
                          "additionalProperties": false
                        },
                        "confirmed_waste": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "text": {
                                  "type": "string"
                                },
                                "amount_minor": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "is_estimate": {
                                  "type": "boolean"
                                },
                                "fact_id": {
                                  "type": "string",
                                  "pattern": "^[0-9a-f]{16}$"
                                }
                              },
                              "required": [
                                "text",
                                "amount_minor",
                                "is_estimate",
                                "fact_id"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "exposure": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "text": {
                                  "type": "string"
                                },
                                "amount_minor": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "is_estimate": {
                                  "type": "boolean"
                                },
                                "fact_id": {
                                  "type": "string",
                                  "pattern": "^[0-9a-f]{16}$"
                                }
                              },
                              "required": [
                                "text",
                                "amount_minor",
                                "is_estimate",
                                "fact_id"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "headlines": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "text": {
                                "type": "string"
                              },
                              "amount_minor": {
                                "anyOf": [
                                  {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "bucket": {
                                "type": "string",
                                "enum": [
                                  "confirmed_waste",
                                  "exposure",
                                  "after_click"
                                ]
                              },
                              "example": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "fact_id": {
                                "type": "string",
                                "pattern": "^[0-9a-f]{16}$"
                              }
                            },
                            "required": [
                              "text",
                              "amount_minor",
                              "bucket",
                              "example",
                              "fact_id"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "leave_alone": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "text": {
                                "type": "string"
                              },
                              "fact_id": {
                                "type": "string",
                                "pattern": "^[0-9a-f]{16}$"
                              }
                            },
                            "required": [
                              "text",
                              "fact_id"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "cant_see": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "text": {
                                "type": "string"
                              },
                              "asks": {
                                "type": "string",
                                "enum": [
                                  "crm",
                                  "meta_ads",
                                  "search_console",
                                  "ga4",
                                  "site",
                                  "profile",
                                  "search_terms"
                                ]
                              }
                            },
                            "required": [
                              "text",
                              "asks"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "rows": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "field": {
                                "type": "string"
                              },
                              "value": {
                                "type": "string"
                              },
                              "source": {
                                "type": "string"
                              },
                              "confirmed": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "field",
                              "value",
                              "source",
                              "confirmed"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "run_id": {
                          "type": "string"
                        },
                        "steps": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "state": {
                                "type": "string",
                                "enum": [
                                  "queued",
                                  "running",
                                  "done",
                                  "failed",
                                  "skipped"
                                ]
                              },
                              "note": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "required": [
                              "id",
                              "state",
                              "note"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "fact_version": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "status",
                        "lever",
                        "window",
                        "currency",
                        "coverage",
                        "confirmed_waste",
                        "exposure",
                        "headlines",
                        "leave_alone",
                        "cant_see",
                        "rows",
                        "run_id",
                        "steps",
                        "fact_version"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "enum": [
                            "running",
                            "no_data",
                            "no_permission",
                            "quota",
                            "error"
                          ]
                        },
                        "run_id": {
                          "type": "string"
                        },
                        "steps": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "state": {
                                "type": "string",
                                "enum": [
                                  "queued",
                                  "running",
                                  "done",
                                  "failed",
                                  "skipped"
                                ]
                              },
                              "note": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "required": [
                              "id",
                              "state",
                              "note"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "fact_version": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "status",
                        "run_id",
                        "steps",
                        "fact_version"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/followups": {
      "get": {
        "operationId": "get_followups",
        "summary": "Lists applied decisions whose 7, 14 or 30 day window is due and has no outcome yet.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "due": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "decision_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "window_days": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "from": {
                            "type": "string"
                          },
                          "to": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "decision_id",
                          "window_days",
                          "from",
                          "to"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "due"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/local-grid/setup": {
      "get": {
        "operationId": "get_grid_setup",
        "summary": "The local grid a business reads each week: the spots (latitude and longitude of its own places, each for the business or for one of its branches), the tracked searches read from them, which searches it can choose from, and the weekly grid budget (checks = searches x spots) with the add-ons it can buy.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "mode": {
                      "type": "string",
                      "enum": [
                        "preset",
                        "custom"
                      ]
                    },
                    "centre": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "lat": {
                              "type": "number"
                            },
                            "lng": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "lat",
                            "lng"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "points": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "lat": {
                            "type": "number"
                          },
                          "lng": {
                            "type": "number"
                          },
                          "branch_id": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "uuid"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "lat",
                          "lng",
                          "branch_id"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "keywords": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "tracked": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "branches": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "name": {
                            "type": "string"
                          },
                          "rating": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "votes": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "category": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "rating",
                          "votes",
                          "category"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "max_spots": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "budget": {
                      "type": "object",
                      "properties": {
                        "limit": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "base": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "bonus": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "max": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "used": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "limit",
                        "base",
                        "bonus",
                        "max",
                        "used"
                      ],
                      "additionalProperties": false
                    },
                    "addons": {
                      "type": "object",
                      "properties": {
                        "active": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "keyword_checks",
                                  "grid_checks"
                                ]
                              },
                              "checks": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "expires_at": {
                                "type": "string",
                                "format": "date-time"
                              }
                            },
                            "required": [
                              "kind",
                              "checks",
                              "expires_at"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "offers": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "keyword_checks",
                                  "grid_checks"
                                ]
                              },
                              "checks": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "credits": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "days": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              }
                            },
                            "required": [
                              "kind",
                              "checks",
                              "credits",
                              "days"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "active",
                        "offers"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "mode",
                    "centre",
                    "points",
                    "keywords",
                    "tracked",
                    "branches",
                    "max_spots",
                    "budget",
                    "addons"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "set_grid_setup",
        "summary": "Chooses the local grid a business reads each week. `points` are the spots (latitude and longitude of its own places, at most 150; empty means the 3 x 3 preset around the business; a spot may carry the `branch_id` of one of its branches, so it is read for that branch), `keywords` the tracked searches read from them (empty means the first tracked searches that fit). Searches x spots must not go over the weekly grid budget (450 checks, add-ons included); a grid over it is refused and nothing changes. Both empty returns to the preset. The change counts from the next weekly run.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "keywords": {
                    "maxItems": 900,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    }
                  },
                  "points": {
                    "maxItems": 150,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "lat": {
                          "type": "number",
                          "minimum": -90,
                          "maximum": 90
                        },
                        "lng": {
                          "type": "number",
                          "minimum": -180,
                          "maximum": 180
                        },
                        "branch_id": {
                          "type": "string",
                          "format": "uuid"
                        }
                      },
                      "required": [
                        "lat",
                        "lng"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "keywords",
                  "points"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "mode": {
                      "type": "string",
                      "enum": [
                        "preset",
                        "custom"
                      ]
                    },
                    "centre": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "lat": {
                              "type": "number"
                            },
                            "lng": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "lat",
                            "lng"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "points": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "lat": {
                            "type": "number"
                          },
                          "lng": {
                            "type": "number"
                          },
                          "branch_id": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "uuid"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "lat",
                          "lng",
                          "branch_id"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "keywords": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "tracked": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "branches": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "name": {
                            "type": "string"
                          },
                          "rating": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "votes": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "category": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "rating",
                          "votes",
                          "category"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "max_spots": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "budget": {
                      "type": "object",
                      "properties": {
                        "limit": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "base": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "bonus": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "max": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "used": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "limit",
                        "base",
                        "bonus",
                        "max",
                        "used"
                      ],
                      "additionalProperties": false
                    },
                    "addons": {
                      "type": "object",
                      "properties": {
                        "active": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "keyword_checks",
                                  "grid_checks"
                                ]
                              },
                              "checks": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "expires_at": {
                                "type": "string",
                                "format": "date-time"
                              }
                            },
                            "required": [
                              "kind",
                              "checks",
                              "expires_at"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "offers": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "keyword_checks",
                                  "grid_checks"
                                ]
                              },
                              "checks": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "credits": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "days": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              }
                            },
                            "required": [
                              "kind",
                              "checks",
                              "credits",
                              "days"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "active",
                        "offers"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "mode",
                    "centre",
                    "points",
                    "keywords",
                    "tracked",
                    "branches",
                    "max_spots",
                    "budget",
                    "addons"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/keyword-clusters": {
      "get": {
        "operationId": "get_keyword_clusters",
        "summary": "The keywords a business follows and saved, in topic groups, with the page of its site that fits each keyword best and a second one, and the cannibalization flag: Search Console shows two or more pages of the site for that search. Built once a week and when the keywords change; built_at is null before the first build. A null best_page means no page of the site covers that keyword.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "built_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "clusters": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "keywords": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "name",
                          "keywords"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "keywords": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "keyword": {
                            "type": "string"
                          },
                          "cluster": {
                            "type": "string"
                          },
                          "best_page": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "second_page": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "search_console_pages": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "cannibalization": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "keyword",
                          "cluster",
                          "best_page",
                          "second_page",
                          "search_console_pages",
                          "cannibalization"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "built_at",
                    "clusters",
                    "keywords"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/keyword-ideas": {
      "get": {
        "operationId": "get_keyword_ideas",
        "summary": "Search phrases close to the keywords the business tracks, with volume, cost per click, competition, difficulty, intent, the 12-month trend and how close each is to what the business sells. The closest come first, then buying intent before reading, then the most searched. It reads stored data only, read once a week.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "as_of": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "source_keywords": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "asked": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "rows": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "keyword": {
                            "type": "string"
                          },
                          "volume": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "cpc_usd": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "competition": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "difficulty": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "intent": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "trend": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "month": {
                                  "type": "string"
                                },
                                "volume": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                }
                              },
                              "required": [
                                "month",
                                "volume"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "relevance": {
                            "type": "string",
                            "enum": [
                              "high",
                              "medium",
                              "low"
                            ]
                          },
                          "origin": {
                            "type": "string",
                            "enum": [
                              "tracked",
                              "asked"
                            ]
                          }
                        },
                        "required": [
                          "keyword",
                          "volume",
                          "cpc_usd",
                          "competition",
                          "difficulty",
                          "intent",
                          "trend",
                          "relevance",
                          "origin"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "gap": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "not_collected_yet",
                            "region_not_supported",
                            "budget_cap",
                            "task_pending",
                            "source_failed",
                            "no_page_id",
                            "not_shown_yet",
                            "nothing_found",
                            "none_tracked"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "as_of",
                    "source_keywords",
                    "asked",
                    "rows",
                    "gap"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/keyword-research": {
      "get": {
        "operationId": "get_keyword_research",
        "summary": "The keyword searches the owner asked for this business (up to 20, newest first: the phrases, the market, the day, the credits and how many ideas) and, for one of them, its lists: one tab per phrase with each idea's volume, cost per click, competition, difficulty, intent, the 12-month trend and how close it is to what the business sells, and whether the phrase itself is among its ideas. The search shown is `search_id`, else the one asked with `seeds` (the list you sent to seed_keyword_ideas, or the same phrases as one comma text) in the market of `country`, `location_code` and `language`, else the newest. Free: nothing is asked of the provider. `selected` is null until that search exists (poll it after seed_keyword_ideas); `failed` is set instead when that search ran and gave nothing. `price` is what the next search costs.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "search_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "seeds",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 405
                },
                {
                  "minItems": 1,
                  "maxItems": 5,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 81
                  }
                }
              ]
            }
          },
          {
            "name": "country",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z]{2}$"
            }
          },
          {
            "name": "location_code",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            }
          },
          {
            "name": "language",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-z]{2,3}(-[A-Za-z]{2,4})?$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "searches": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "seeds": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "country": {
                            "type": "string"
                          },
                          "location_code": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "city_name": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "language": {
                            "type": "string"
                          },
                          "asked_at": {
                            "type": "string"
                          },
                          "credits": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "rows": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "id",
                          "seeds",
                          "country",
                          "location_code",
                          "city_name",
                          "language",
                          "asked_at",
                          "credits",
                          "rows"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "selected": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "seeds": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "country": {
                              "type": "string"
                            },
                            "location_code": {
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "city_name": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "language": {
                              "type": "string"
                            },
                            "asked_at": {
                              "type": "string"
                            },
                            "currency": {
                              "type": "string"
                            },
                            "tabs": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "seed": {
                                    "type": "string"
                                  },
                                  "count": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "exact_match": {
                                    "type": "boolean"
                                  },
                                  "rows": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "keyword": {
                                          "type": "string"
                                        },
                                        "volume": {
                                          "anyOf": [
                                            {
                                              "type": "integer",
                                              "minimum": -9007199254740991,
                                              "maximum": 9007199254740991
                                            },
                                            {
                                              "type": "null"
                                            }
                                          ]
                                        },
                                        "cpc": {
                                          "type": [
                                            "number",
                                            "null"
                                          ]
                                        },
                                        "competition": {
                                          "type": [
                                            "number",
                                            "null"
                                          ]
                                        },
                                        "difficulty": {
                                          "anyOf": [
                                            {
                                              "type": "integer",
                                              "minimum": -9007199254740991,
                                              "maximum": 9007199254740991
                                            },
                                            {
                                              "type": "null"
                                            }
                                          ]
                                        },
                                        "intent": {
                                          "type": [
                                            "string",
                                            "null"
                                          ]
                                        },
                                        "trend": {
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "month": {
                                                "type": "string"
                                              },
                                              "volume": {
                                                "anyOf": [
                                                  {
                                                    "type": "integer",
                                                    "minimum": -9007199254740991,
                                                    "maximum": 9007199254740991
                                                  },
                                                  {
                                                    "type": "null"
                                                  }
                                                ]
                                              }
                                            },
                                            "required": [
                                              "month",
                                              "volume"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "relevance": {
                                          "type": "string",
                                          "enum": [
                                            "high",
                                            "medium",
                                            "low"
                                          ]
                                        },
                                        "local": {
                                          "type": "boolean"
                                        }
                                      },
                                      "required": [
                                        "keyword",
                                        "volume",
                                        "cpc",
                                        "competition",
                                        "difficulty",
                                        "intent",
                                        "trend",
                                        "relevance",
                                        "local"
                                      ],
                                      "additionalProperties": false
                                    }
                                  }
                                },
                                "required": [
                                  "seed",
                                  "count",
                                  "exact_match",
                                  "rows"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "id",
                            "seeds",
                            "country",
                            "location_code",
                            "city_name",
                            "language",
                            "asked_at",
                            "currency",
                            "tabs"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "failed": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "reason": {
                              "type": "string"
                            },
                            "asked_at": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "reason",
                            "asked_at"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "price": {
                      "type": "object",
                      "properties": {
                        "country": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "city": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "country",
                        "city"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "searches",
                    "selected",
                    "failed",
                    "price"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/ledger": {
      "get": {
        "operationId": "get_ledger",
        "summary": "Reads the value ledger of one business: every change that reached the account or the to-do list, with its result so far, and two totals, measured and estimated, that are never added.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "description": "The most rows to return."
            }
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "change": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string"
                              },
                              "text": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "type",
                              "text"
                            ],
                            "additionalProperties": false
                          },
                          "actor": {
                            "type": "string",
                            "enum": [
                              "autopilot",
                              "customer",
                              "agency"
                            ]
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "agency",
                              "auto",
                              "guide",
                              "task"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "measuring",
                              "insufficient_data",
                              "no_clear_change",
                              "likely_improved",
                              "likely_worse",
                              "mixed",
                              "not_counted"
                            ]
                          },
                          "not_counted_reason": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "reverted",
                                  "object_changed",
                                  "tracking_broken",
                                  "no_search_console"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "windows": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "days": {
                                  "type": "number"
                                },
                                "status": {
                                  "type": "string"
                                },
                                "early": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "days",
                                "status",
                                "early"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "undo": {
                            "type": "object",
                            "properties": {
                              "available": {
                                "type": "boolean"
                              },
                              "undone": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "available",
                              "undone"
                            ],
                            "additionalProperties": false
                          },
                          "proof_url": {
                            "type": "string"
                          },
                          "fact_ids": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "counted": {
                            "type": "string",
                            "enum": [
                              "measured",
                              "estimated",
                              "none"
                            ]
                          },
                          "value": {
                            "anyOf": [
                              {
                                "oneOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "measured"
                                      },
                                      "rung": {
                                        "type": "string"
                                      },
                                      "delta": {
                                        "type": "number"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "rung",
                                      "delta"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "estimated"
                                      },
                                      "target": {
                                        "type": "string"
                                      },
                                      "unit": {
                                        "type": "string"
                                      },
                                      "low": {
                                        "type": "number"
                                      },
                                      "high": {
                                        "type": "number"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "target",
                                      "unit",
                                      "low",
                                      "high"
                                    ],
                                    "additionalProperties": false
                                  }
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "look_on": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "at",
                          "change",
                          "actor",
                          "source",
                          "status",
                          "not_counted_reason",
                          "windows",
                          "undo",
                          "proof_url",
                          "fact_ids",
                          "counted",
                          "value",
                          "look_on"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "totals": {
                      "type": "object",
                      "properties": {
                        "measured": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "rung": {
                                "type": "string"
                              },
                              "delta": {
                                "type": "number"
                              },
                              "rows": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              }
                            },
                            "required": [
                              "rung",
                              "delta",
                              "rows"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "estimated": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "target": {
                                "type": "string"
                              },
                              "unit": {
                                "type": "string"
                              },
                              "low": {
                                "type": "number"
                              },
                              "high": {
                                "type": "number"
                              },
                              "rows": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              }
                            },
                            "required": [
                              "target",
                              "unit",
                              "low",
                              "high",
                              "rows"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "mixed": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "not_counted": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "measured",
                        "estimated",
                        "mixed",
                        "not_counted"
                      ],
                      "additionalProperties": false
                    },
                    "next_before": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "totals",
                    "next_before"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/link-strength": {
      "get": {
        "operationId": "get_link_strength",
        "summary": "How strong the links of the business are next to its rivals (a 0 to 100 strength, read once a month, with its place), and the sites that began and stopped linking to it in the last weekly read. It reads stored data only.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "as_of": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "sites": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "domain": {
                            "type": "string"
                          },
                          "is_you": {
                            "type": "boolean"
                          },
                          "strength": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "place": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "domain",
                          "is_you",
                          "strength",
                          "place"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "your_place": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "behind_leader": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "gap": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "not_collected_yet",
                            "region_not_supported",
                            "budget_cap",
                            "task_pending",
                            "source_failed",
                            "no_page_id",
                            "not_shown_yet",
                            "nothing_found",
                            "none_tracked"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "links_week": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "since": {
                              "type": "string"
                            },
                            "read": {
                              "type": "string"
                            },
                            "gained": {
                              "type": [
                                "number",
                                "null"
                              ]
                            },
                            "lost": {
                              "type": [
                                "number",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "since",
                            "read",
                            "gained",
                            "lost"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "links_week_gap": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "not_collected_yet",
                            "region_not_supported",
                            "budget_cap",
                            "task_pending",
                            "source_failed",
                            "no_page_id",
                            "not_shown_yet",
                            "nothing_found",
                            "none_tracked"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "as_of",
                    "sites",
                    "your_place",
                    "behind_leader",
                    "gap",
                    "links_week",
                    "links_week_gap"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/research/llm-mentions": {
      "post": {
        "operationId": "get_llm_mentions",
        "summary": "How often the AI answers mention the business's site, and its share next to its rivals: mentions and the AI search volume of those answers, by assistant, the share of each site among the business and up to 9 rivals (the followed rivals when `rivals` is left out), and the sites the answers cite. ChatGPT data exists for the United States in English only; anywhere else the read covers Google's AI Overview alone, and `coverage` says so. Send `country` for another market. Costs 43 credits: an agent or key sends max_credits (estimate_spend gives the price). Nothing is charged when no answer mentions any of the sites.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Optional. Send the same value to repeat this paid call without paying twice; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused). The CLI sends one made from the request.",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "country": {
                    "type": "string",
                    "pattern": "^[A-Za-z]{2}$"
                  },
                  "rivals": {
                    "maxItems": 9,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 3,
                      "maxLength": 253
                    }
                  },
                  "max_credits": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000,
                    "description": "The most credits this call may spend. A call that costs more is refused and nothing is spent. estimate_spend gives the price."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "domain": {
                      "type": "string"
                    },
                    "country": {
                      "type": "string"
                    },
                    "language": {
                      "type": "string"
                    },
                    "coverage": {
                      "type": "string",
                      "enum": [
                        "chatgpt_and_ai_overview",
                        "ai_overview_only"
                      ]
                    },
                    "engines": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "google_ai_overview",
                          "chatgpt"
                        ]
                      }
                    },
                    "mentions": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "ai_search_volume": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "by_engine": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "engine": {
                            "type": "string",
                            "enum": [
                              "google_ai_overview",
                              "chatgpt"
                            ]
                          },
                          "mentions": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "ai_search_volume": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "engine",
                          "mentions",
                          "ai_search_volume"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "share": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "domain": {
                            "type": "string"
                          },
                          "you": {
                            "type": "boolean"
                          },
                          "mentions": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "share": {
                            "type": "number",
                            "minimum": 0,
                            "maximum": 100
                          }
                        },
                        "required": [
                          "domain",
                          "you",
                          "mentions",
                          "share"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "cited_sources": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "domain": {
                            "type": "string"
                          },
                          "mentions": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "domain",
                          "mentions"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "credits": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "balance": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "domain",
                    "country",
                    "language",
                    "coverage",
                    "engines",
                    "mentions",
                    "ai_search_volume",
                    "by_engine",
                    "share",
                    "cited_sources",
                    "credits",
                    "balance"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "The credit cap or balance is short (G-COST), or the organization has no paid plan (G-ENTITLEMENT). missing and next_action say what to do.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/local-grid": {
      "get": {
        "operationId": "get_local_grid",
        "summary": "Where the business shows in Google Maps from the points of its local grid (nine around it, or the spots it chose, each for the business or for one of its branches), week by week, for the searches it reads on the grid: its place at each point, the first three listings there and the change since the week before. A branch is found by its Google listing, so another branch of the same business is not counted as it. It reads stored data only, read once a week on a paid plan.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "weeks",
            "in": "query",
            "required": false,
            "schema": {
              "default": 8,
              "type": "integer",
              "minimum": 1,
              "maximum": 104
            }
          },
          {
            "name": "keyword",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "state": {
                      "type": "string",
                      "enum": [
                        "free_plan",
                        "no_centre",
                        "no_keywords",
                        "waiting_first",
                        "ready"
                      ]
                    },
                    "as_of": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "preset": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "neighbourhood",
                            "town",
                            "city"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "spacing_km": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "limit": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "mode": {
                      "type": "string",
                      "enum": [
                        "preset",
                        "custom"
                      ]
                    },
                    "centre": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "lat": {
                              "type": "number"
                            },
                            "lng": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "lat",
                            "lng"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "points": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "lat": {
                            "type": "number"
                          },
                          "lng": {
                            "type": "number"
                          },
                          "branch_id": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "uuid"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "lat",
                          "lng",
                          "branch_id"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "branches": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "name": {
                            "type": "string"
                          },
                          "rating": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "votes": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "category": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "rating",
                          "votes",
                          "category"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "keywords": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "keyword": {
                            "type": "string"
                          },
                          "weeks": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "week": {
                                  "type": "string",
                                  "format": "date"
                                },
                                "day": {
                                  "type": "string",
                                  "format": "date"
                                },
                                "read": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                "top3": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                "cells": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "at": {
                                        "type": "string"
                                      },
                                      "lat": {
                                        "type": [
                                          "number",
                                          "null"
                                        ]
                                      },
                                      "lng": {
                                        "type": [
                                          "number",
                                          "null"
                                        ]
                                      },
                                      "branch_id": {
                                        "anyOf": [
                                          {
                                            "type": "string",
                                            "format": "uuid"
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "rank": {
                                        "anyOf": [
                                          {
                                            "anyOf": [
                                              {
                                                "type": "integer",
                                                "minimum": -9007199254740991,
                                                "maximum": 9007199254740991
                                              },
                                              {
                                                "type": "string",
                                                "const": "not_found"
                                              }
                                            ]
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "top3": {
                                        "maxItems": 3,
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "properties": {
                                            "name": {
                                              "type": "string"
                                            },
                                            "is_you": {
                                              "type": "boolean"
                                            }
                                          },
                                          "required": [
                                            "name",
                                            "is_you"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "change": {
                                        "anyOf": [
                                          {
                                            "type": "integer",
                                            "minimum": -9007199254740991,
                                            "maximum": 9007199254740991
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      }
                                    },
                                    "required": [
                                      "at",
                                      "lat",
                                      "lng",
                                      "branch_id",
                                      "rank",
                                      "top3",
                                      "change"
                                    ],
                                    "additionalProperties": false
                                  }
                                }
                              },
                              "required": [
                                "week",
                                "day",
                                "read",
                                "top3",
                                "cells"
                              ],
                              "additionalProperties": false
                            }
                          }
                        },
                        "required": [
                          "keyword",
                          "weeks"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "gap": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "not_collected_yet",
                            "region_not_supported",
                            "budget_cap",
                            "task_pending",
                            "source_failed",
                            "no_page_id",
                            "not_shown_yet",
                            "nothing_found",
                            "none_tracked"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "state",
                    "as_of",
                    "preset",
                    "spacing_km",
                    "limit",
                    "mode",
                    "centre",
                    "points",
                    "branches",
                    "keywords",
                    "gap"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/local-market": {
      "get": {
        "operationId": "get_local_market",
        "summary": "The businesses around this business on Google: every business of its category within its service radius, and its nearest Maps rivals, one row each. A row gives the category, whether the owner claimed the listing, opening hours, rating, review count and stars; the business and its nearest rivals also get review totals (count, average and the share of the newest reviews the owner answered). It reads stored data only, read once a month on a paid plan.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "state": {
                      "type": "string",
                      "enum": [
                        "ok",
                        "free_plan",
                        "not_collected_yet"
                      ]
                    },
                    "as_of": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "rows": {
                      "maxItems": 150,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "domain": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "place_id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "cid": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "is_you": {
                            "type": "boolean"
                          },
                          "category": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "category_ids": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "is_claimed": {
                            "type": [
                              "boolean",
                              "null"
                            ]
                          },
                          "hours": {
                            "anyOf": [
                              {
                                "type": "object",
                                "propertyNames": {
                                  "type": "string"
                                },
                                "additionalProperties": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                }
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "rating": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "votes": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "stars": {
                            "anyOf": [
                              {
                                "type": "object",
                                "propertyNames": {
                                  "type": "string"
                                },
                                "additionalProperties": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                }
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "reviews": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "count": {
                                    "anyOf": [
                                      {
                                        "type": "integer",
                                        "minimum": -9007199254740991,
                                        "maximum": 9007199254740991
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "rating": {
                                    "type": [
                                      "number",
                                      "null"
                                    ]
                                  },
                                  "sample": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "answered_share": {
                                    "type": [
                                      "number",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "count",
                                  "rating",
                                  "sample",
                                  "answered_share"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "maps_rank": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "sources": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "enum": [
                                "listings",
                                "maps",
                                "profile"
                              ]
                            }
                          }
                        },
                        "required": [
                          "name",
                          "domain",
                          "place_id",
                          "cid",
                          "is_you",
                          "category",
                          "category_ids",
                          "is_claimed",
                          "hours",
                          "rating",
                          "votes",
                          "stars",
                          "reviews",
                          "maps_rank",
                          "sources"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "state",
                    "as_of",
                    "rows"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/market": {
      "get": {
        "operationId": "get_market",
        "summary": "Who comes before the business on Google, which rivals and rival ads there are, and what the AI assistants said about it, with the reason for every section that is empty. It reads stored data only.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "as_of": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "place": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "granular": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "name",
                            "granular"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "rankings": {
                      "type": "object",
                      "properties": {
                        "rows": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "keyword": {
                                "type": "string"
                              },
                              "monthly_searches": {
                                "type": [
                                  "number",
                                  "null"
                                ]
                              },
                              "your_position": {
                                "type": [
                                  "number",
                                  "null"
                                ]
                              },
                              "first_result": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "required": [
                              "keyword",
                              "monthly_searches",
                              "your_position",
                              "first_result"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "gap": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "not_collected_yet",
                                "region_not_supported",
                                "budget_cap",
                                "task_pending",
                                "source_failed",
                                "no_page_id",
                                "not_shown_yet",
                                "nothing_found",
                                "none_tracked"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "rows",
                        "gap"
                      ],
                      "additionalProperties": false
                    },
                    "competitors": {
                      "type": "object",
                      "properties": {
                        "basis": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "visits",
                                "appearances"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "you": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "rows": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "domain": {
                                "type": "string"
                              },
                              "value": {
                                "type": "number"
                              },
                              "shot": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "suggested": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "domain",
                              "value",
                              "shot",
                              "suggested"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "gap": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "not_collected_yet",
                                "region_not_supported",
                                "budget_cap",
                                "task_pending",
                                "source_failed",
                                "no_page_id",
                                "not_shown_yet",
                                "nothing_found",
                                "none_tracked"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "basis",
                        "you",
                        "rows",
                        "gap"
                      ],
                      "additionalProperties": false
                    },
                    "ai_answers": {
                      "type": "object",
                      "properties": {
                        "rows": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "engine": {
                                "type": "string"
                              },
                              "prompt": {
                                "type": "string"
                              },
                              "answer": {
                                "type": "string"
                              },
                              "names_you": {
                                "type": "boolean"
                              },
                              "names": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              },
                              "tracked_mentions": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              }
                            },
                            "required": [
                              "engine",
                              "prompt",
                              "answer",
                              "names_you",
                              "names",
                              "tracked_mentions"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "asked": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "named_you": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "gap": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "not_collected_yet",
                                "region_not_supported",
                                "budget_cap",
                                "task_pending",
                                "source_failed",
                                "no_page_id",
                                "not_shown_yet",
                                "nothing_found",
                                "none_tracked"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "rows",
                        "asked",
                        "named_you",
                        "gap"
                      ],
                      "additionalProperties": false
                    },
                    "rival_ads": {
                      "type": "object",
                      "properties": {
                        "found": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "rows": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "competitor": {
                                "type": "string"
                              },
                              "source": {
                                "type": "string",
                                "enum": [
                                  "google_transparency",
                                  "meta_ad_library"
                                ]
                              },
                              "headline": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "first_seen": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "last_seen": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "required": [
                              "competitor",
                              "source",
                              "headline",
                              "first_seen",
                              "last_seen"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "gap": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "not_collected_yet",
                                "region_not_supported",
                                "budget_cap",
                                "task_pending",
                                "source_failed",
                                "no_page_id",
                                "not_shown_yet",
                                "nothing_found",
                                "none_tracked"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "found",
                        "rows",
                        "gap"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "as_of",
                    "place",
                    "rankings",
                    "competitors",
                    "ai_answers",
                    "rival_ads"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/notification-prefs": {
      "get": {
        "operationId": "get_notification_prefs",
        "summary": "Reads what you are told about, and how and when: every kind with its switch, and the delivery settings with the quiet hours. An agent reads the settings of the person who connected it. Reading only; a person changes them in the panel.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "kinds": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string"
                          },
                          "enabled": {
                            "type": "boolean"
                          },
                          "required": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "kind",
                          "enabled",
                          "required"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "delivery": {
                      "type": "object",
                      "properties": {
                        "mode": {
                          "type": "string",
                          "enum": [
                            "instant",
                            "digest"
                          ]
                        },
                        "digest_at": {
                          "type": "string"
                        },
                        "quiet": {
                          "type": "object",
                          "properties": {
                            "on": {
                              "type": "boolean"
                            },
                            "from": {
                              "type": "string"
                            },
                            "to": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "on",
                            "from",
                            "to"
                          ],
                          "additionalProperties": false
                        },
                        "agent": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "mode",
                        "digest_at",
                        "quiet",
                        "agent"
                      ],
                      "additionalProperties": false
                    },
                    "time_zone": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "kinds",
                    "delivery",
                    "time_zone"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/opportunities": {
      "get": {
        "operationId": "get_opportunities",
        "summary": "Searches where the business stands at places 4 to 20 on Google, from its weekly checks and from Search Console, most searched first, each with one plain reason built from its numbers and a detail (the place, the sites above, the change). It reads stored data only.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "as_of": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "search_console": {
                      "type": "object",
                      "properties": {
                        "connected": {
                          "type": "boolean"
                        },
                        "as_of": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "date"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "connected",
                        "as_of"
                      ],
                      "additionalProperties": false
                    },
                    "rows": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "keyword": {
                            "type": "string"
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "rank",
                              "search_console",
                              "both"
                            ]
                          },
                          "position": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "change": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "volume": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "impressions": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "clicks": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "gsc_position": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "above": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "above_named": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "above_domain": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "extra_clicks": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "reason": {
                            "type": "string"
                          },
                          "detail": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "keyword",
                          "source",
                          "position",
                          "change",
                          "volume",
                          "impressions",
                          "clicks",
                          "gsc_position",
                          "above",
                          "above_named",
                          "above_domain",
                          "extra_clicks",
                          "reason",
                          "detail"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "gap": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "not_collected_yet"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "as_of",
                    "search_console",
                    "rows",
                    "gap"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/tracking/question-suggestions": {
      "get": {
        "operationId": "get_question_suggestions",
        "summary": "Questions people ask that this business may want the AI assistants to be asked, and does not follow yet: the queries Google Search Console shows the site for that read as questions, most clicks first. A question that is already followed is marked `tracked`; one the customer archived is never offered; sentences with the business's own name are left out. Free: it reads stored data, and an empty list means no source has questions yet. Add one with add_tracked_questions.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "connected": {
                      "type": "boolean"
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "question": {
                            "type": "string"
                          },
                          "tracked": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "question",
                          "tracked"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "connected",
                    "items"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/rank-history": {
      "get": {
        "operationId": "get_rank_history",
        "summary": "Where the business stood on Google (or, with `engine`, on Bing or Yahoo) for each search it follows, week by week, up to 104 weeks (two years; the top results are kept for the last 90 days only): its place and the page that ranked, \"not ranked\" when it was not in the results, nothing for a week that was not checked, the change since the previous checked week, the best place, the monthly searches, the top results of the newest week and its place in Google Maps. For the last 90 days each point also names the features of the results page (featured snippet, People Also Ask, local pack, AI Overview, video, ads) and the ones the business is in itself. With `keyword` it answers for that search alone and gives the top results of every week. With `granularity=day` it gives one point a day over `days` days (7, 28 or 90) instead of one a week. It reads stored data only.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "weeks",
            "in": "query",
            "required": false,
            "schema": {
              "default": 12,
              "type": "integer",
              "minimum": 1,
              "maximum": 104
            }
          },
          {
            "name": "keyword",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "engine",
            "in": "query",
            "required": false,
            "schema": {
              "default": "google",
              "type": "string",
              "enum": [
                "google",
                "bing",
                "yahoo"
              ]
            }
          },
          {
            "name": "granularity",
            "in": "query",
            "required": false,
            "schema": {
              "default": "week",
              "type": "string",
              "enum": [
                "week",
                "day"
              ]
            }
          },
          {
            "name": "days",
            "in": "query",
            "required": false,
            "schema": {
              "default": 28,
              "type": "integer",
              "minimum": 1,
              "maximum": 90
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "granularity": {
                      "type": "string",
                      "enum": [
                        "week",
                        "day"
                      ]
                    },
                    "engine": {
                      "type": "string",
                      "enum": [
                        "google",
                        "bing",
                        "yahoo"
                      ]
                    },
                    "engines": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "google",
                          "bing",
                          "yahoo"
                        ]
                      }
                    },
                    "as_of": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "weeks": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "format": "date"
                      }
                    },
                    "keywords": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "keyword": {
                            "type": "string"
                          },
                          "engines": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "enum": [
                                "google",
                                "bing",
                                "yahoo"
                              ]
                            }
                          },
                          "points": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "week": {
                                  "type": "string",
                                  "format": "date"
                                },
                                "position": {
                                  "anyOf": [
                                    {
                                      "type": "integer",
                                      "minimum": -9007199254740991,
                                      "maximum": 9007199254740991
                                    },
                                    {
                                      "type": "string",
                                      "const": "not_ranked"
                                    }
                                  ]
                                },
                                "url": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "top10": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "position": {
                                        "type": "integer",
                                        "minimum": -9007199254740991,
                                        "maximum": 9007199254740991
                                      },
                                      "domain": {
                                        "type": "string"
                                      },
                                      "title": {
                                        "type": [
                                          "string",
                                          "null"
                                        ]
                                      },
                                      "url": {
                                        "type": [
                                          "string",
                                          "null"
                                        ]
                                      },
                                      "is_you": {
                                        "type": "boolean"
                                      }
                                    },
                                    "required": [
                                      "position",
                                      "domain",
                                      "title",
                                      "url",
                                      "is_you"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "features": {
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "enum": [
                                      "featured_snippet",
                                      "people_also_ask",
                                      "local_pack",
                                      "ai_overview",
                                      "video",
                                      "paid"
                                    ]
                                  }
                                },
                                "owned": {
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "enum": [
                                      "featured_snippet",
                                      "people_also_ask",
                                      "local_pack",
                                      "ai_overview"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "week",
                                "position",
                                "url"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "change": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "best": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "local_pack": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "string",
                                "const": "not_in_pack"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "volume": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "top10": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "week": {
                                    "type": "string",
                                    "format": "date"
                                  },
                                  "results": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "position": {
                                          "type": "integer",
                                          "minimum": -9007199254740991,
                                          "maximum": 9007199254740991
                                        },
                                        "domain": {
                                          "type": "string"
                                        },
                                        "title": {
                                          "type": [
                                            "string",
                                            "null"
                                          ]
                                        },
                                        "url": {
                                          "type": [
                                            "string",
                                            "null"
                                          ]
                                        },
                                        "is_you": {
                                          "type": "boolean"
                                        }
                                      },
                                      "required": [
                                        "position",
                                        "domain",
                                        "title",
                                        "url",
                                        "is_you"
                                      ],
                                      "additionalProperties": false
                                    }
                                  }
                                },
                                "required": [
                                  "week",
                                  "results"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "keyword",
                          "engines",
                          "points",
                          "change",
                          "best",
                          "local_pack",
                          "volume",
                          "top10"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "totals": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "week": {
                            "type": "string",
                            "format": "date"
                          },
                          "checked": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "ranked": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "avg_position": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "top3": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "top10": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "week",
                          "checked",
                          "ranked",
                          "avg_position",
                          "top3",
                          "top10"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "measure": {
                      "type": "object",
                      "properties": {
                        "outcome": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "ok",
                                "partial",
                                "no_credit",
                                "cap_reached",
                                "plan_required",
                                "connection_lost",
                                "provider_error",
                                "paused",
                                "stuck"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "skip_reason": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "ok",
                                "partial",
                                "no_credit",
                                "cap_reached",
                                "plan_required",
                                "connection_lost",
                                "provider_error",
                                "paused",
                                "stuck"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "skip_at": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "collected": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "planned": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "complete": {
                          "type": [
                            "boolean",
                            "null"
                          ]
                        },
                        "at": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "outcome",
                        "skip_reason",
                        "skip_at",
                        "collected",
                        "planned",
                        "complete",
                        "at"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "granularity",
                    "engine",
                    "engines",
                    "as_of",
                    "weeks",
                    "keywords",
                    "totals"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/recommendations/{recommendation_id}": {
      "get": {
        "operationId": "get_recommendation",
        "summary": "Reads one recommendation card in full: what changes, why now, the evidence and what speaks against it, the effect, the risk and how to undo it.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "recommendation_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "client_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "asset_id": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "channel": {
                      "type": "string",
                      "enum": [
                        "google_ads",
                        "meta_ads",
                        "openai_ads",
                        "linkedin_ads",
                        "seo",
                        "geo",
                        "site",
                        "tracking",
                        "cross"
                      ]
                    },
                    "area": {
                      "type": "string",
                      "enum": [
                        "preflight",
                        "tracking",
                        "waste",
                        "search_terms",
                        "bidding",
                        "budget",
                        "placement",
                        "targeting",
                        "lead_quality",
                        "landing_page",
                        "structure",
                        "creative",
                        "platform_change",
                        "seo",
                        "geo",
                        "competitor"
                      ]
                    },
                    "title": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 90
                    },
                    "why_now": {
                      "type": "object",
                      "properties": {
                        "trigger": {
                          "type": "string",
                          "enum": [
                            "new",
                            "threshold_crossed",
                            "window_matured",
                            "season",
                            "platform_change",
                            "user_ask"
                          ]
                        },
                        "since": {
                          "type": "string",
                          "format": "date"
                        },
                        "text": {
                          "type": "string",
                          "minLength": 1
                        },
                        "delay_cost": {
                          "type": "object",
                          "properties": {
                            "amount_minor": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "currency": {
                              "type": "string",
                              "pattern": "^[A-Z]{3}$"
                            },
                            "per": {
                              "type": "string",
                              "enum": [
                                "day",
                                "week",
                                "month"
                              ]
                            },
                            "is_estimate": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "amount_minor",
                            "currency",
                            "per",
                            "is_estimate"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "trigger",
                        "since",
                        "text"
                      ],
                      "additionalProperties": false
                    },
                    "evidence": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "fact_id": {
                            "type": "string",
                            "pattern": "^[0-9a-f]{16}$"
                          },
                          "label": {
                            "type": "string"
                          },
                          "value": {
                            "type": [
                              "number",
                              "string",
                              "null"
                            ]
                          },
                          "unit": {
                            "type": "string"
                          },
                          "window": {
                            "type": "object",
                            "properties": {
                              "from": {
                                "type": "string",
                                "format": "date"
                              },
                              "to": {
                                "type": "string",
                                "format": "date"
                              }
                            },
                            "required": [
                              "from",
                              "to"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "fact_id",
                          "label",
                          "value",
                          "unit"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "counter_evidence": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "fact_id": {
                            "type": "string",
                            "pattern": "^[0-9a-f]{16}$"
                          },
                          "label": {
                            "type": "string"
                          },
                          "value": {
                            "type": [
                              "number",
                              "string",
                              "null"
                            ]
                          },
                          "unit": {
                            "type": "string"
                          },
                          "window": {
                            "type": "object",
                            "properties": {
                              "from": {
                                "type": "string",
                                "format": "date"
                              },
                              "to": {
                                "type": "string",
                                "format": "date"
                              }
                            },
                            "required": [
                              "from",
                              "to"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "fact_id",
                          "label",
                          "value",
                          "unit"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "limits": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "impact": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "metric": {
                              "type": "string",
                              "minLength": 1
                            },
                            "low": {
                              "type": [
                                "number",
                                "null"
                              ]
                            },
                            "high": {
                              "type": [
                                "number",
                                "null"
                              ]
                            },
                            "unit": {
                              "type": "string",
                              "minLength": 1
                            },
                            "horizon_days": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "basis": {
                              "type": "string",
                              "enum": [
                                "estimate",
                                "bound",
                                "not_estimable"
                              ]
                            },
                            "fact_ids": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "pattern": "^[0-9a-f]{16}$"
                              }
                            },
                            "assumptions": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          },
                          "required": [
                            "metric",
                            "low",
                            "high",
                            "unit",
                            "horizon_days",
                            "basis",
                            "fact_ids",
                            "assumptions"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "confidence": {
                      "type": "string",
                      "enum": [
                        "established",
                        "likely",
                        "hypothesis",
                        "unknown"
                      ]
                    },
                    "confidence_reason": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "risk": {
                      "type": "object",
                      "properties": {
                        "level": {
                          "type": "string",
                          "enum": [
                            "low",
                            "medium",
                            "high"
                          ]
                        },
                        "worst_case": {
                          "type": "string"
                        },
                        "exposure_minor": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "currency": {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        }
                      },
                      "required": [
                        "level",
                        "worst_case",
                        "exposure_minor",
                        "currency"
                      ],
                      "additionalProperties": false
                    },
                    "effort": {
                      "type": "object",
                      "properties": {
                        "level": {
                          "type": "string",
                          "enum": [
                            "none",
                            "minutes",
                            "hours",
                            "days"
                          ]
                        },
                        "who": {
                          "type": "string",
                          "minLength": 1
                        },
                        "minutes": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "level",
                        "who"
                      ],
                      "additionalProperties": false
                    },
                    "reversibility": {
                      "type": "object",
                      "properties": {
                        "level": {
                          "type": "string",
                          "enum": [
                            "one_click",
                            "manual",
                            "none"
                          ]
                        },
                        "window_days": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        "how": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "level",
                        "how"
                      ],
                      "additionalProperties": false
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "auto_apply",
                        "approval",
                        "human_task",
                        "hold"
                      ]
                    },
                    "state": {
                      "type": "string",
                      "enum": [
                        "open",
                        "in_progress",
                        "snoozed",
                        "done",
                        "dismissed",
                        "expired",
                        "superseded"
                      ]
                    },
                    "slot": {
                      "type": "string",
                      "enum": [
                        "safety",
                        "top",
                        "queue",
                        "hold"
                      ]
                    },
                    "position": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "severity": {
                      "anyOf": [
                        {
                          "type": "number",
                          "const": 1
                        },
                        {
                          "type": "number",
                          "const": 2
                        },
                        {
                          "type": "number",
                          "const": 3
                        }
                      ]
                    },
                    "prerequisites": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "code": {
                            "type": "string",
                            "minLength": 1
                          },
                          "state": {
                            "type": "string",
                            "enum": [
                              "met",
                              "unmet",
                              "unknown"
                            ]
                          }
                        },
                        "required": [
                          "code",
                          "state"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "success": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "hypothesis": {
                              "type": "string"
                            },
                            "metric": {
                              "type": "string",
                              "minLength": 1
                            },
                            "baseline": {
                              "type": [
                                "number",
                                "null"
                              ]
                            },
                            "guardrail": {
                              "type": "object",
                              "properties": {
                                "metric": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "worse_than_pct": {
                                  "type": "number",
                                  "exclusiveMinimum": 0
                                }
                              },
                              "required": [
                                "metric",
                                "worse_than_pct"
                              ],
                              "additionalProperties": false
                            },
                            "review_after_days": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "hypothesis",
                            "metric",
                            "baseline",
                            "guardrail",
                            "review_after_days"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "action": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "blocked",
                            "pending",
                            "approved",
                            "auto_queued",
                            "executing",
                            "done",
                            "failed",
                            "unknown",
                            "rejected",
                            "expired",
                            "withdrawn",
                            "superseded"
                          ]
                        },
                        "requires": {
                          "type": "string",
                          "enum": [
                            "operator",
                            "client"
                          ]
                        },
                        "expires_at": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "date-time"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "status",
                        "requires",
                        "expires_at"
                      ],
                      "additionalProperties": false
                    },
                    "finding_ref": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "before_after": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "before": {
                              "type": "string",
                              "minLength": 1
                            },
                            "after": {
                              "type": "string",
                              "minLength": 1
                            }
                          },
                          "required": [
                            "before",
                            "after"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "impact_null_reason": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "buttons": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "code": {
                            "type": "string",
                            "enum": [
                              "approve",
                              "not_now",
                              "ask",
                              "done",
                              "snooze",
                              "too_early",
                              "undo"
                            ]
                          },
                          "primary": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "code",
                          "primary"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "next_action": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "identity",
                                "payment",
                                "oauth",
                                "approval",
                                "wait"
                              ]
                            },
                            "url": {
                              "type": "string",
                              "minLength": 1
                            },
                            "why": {
                              "type": "string",
                              "minLength": 1
                            },
                            "resume": {
                              "type": "string"
                            },
                            "poll_after_s": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "kind",
                            "url",
                            "why"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "change": {
                      "type": "object",
                      "properties": {
                        "platform": {
                          "type": "string",
                          "enum": [
                            "google_ads",
                            "meta_ads"
                          ]
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "ADD_NEGATIVE",
                            "PAUSE_KEYWORD",
                            "PAUSE_AD",
                            "PAUSE_ADSET",
                            "PAUSE_CAMPAIGN",
                            "SET_BUDGET",
                            "SET_MAX_CPC",
                            "ENABLE_ENTITY",
                            "SET_NETWORKS",
                            "SET_GEO_PRESENCE",
                            "ADD_KEYWORD",
                            "SET_BID_STRATEGY",
                            "SET_PLACEMENTS",
                            "SET_AUDIENCE_OPTION",
                            "SET_CREATIVE_FEATURES",
                            "CREATE_CAMPAIGN_DRAFT",
                            "CREATE_AD_DRAFT",
                            "LAUNCH_CAMPAIGN"
                          ]
                        },
                        "entity_ref": {
                          "type": "string",
                          "minLength": 1
                        },
                        "direction": {
                          "type": "string",
                          "enum": [
                            "increase",
                            "decrease",
                            "neutral"
                          ]
                        },
                        "from": {},
                        "to": {},
                        "month_projection_minor": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "monthly_cap_minor": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "platform",
                        "type",
                        "entity_ref",
                        "direction",
                        "from",
                        "to"
                      ],
                      "additionalProperties": false
                    },
                    "task": {
                      "type": "object",
                      "properties": {
                        "steps": {
                          "type": "array",
                          "items": {}
                        },
                        "draft": {},
                        "target": {},
                        "items": {
                          "type": "array",
                          "items": {}
                        },
                        "measure": {
                          "type": "object",
                          "properties": {
                            "verdict": {
                              "type": "string",
                              "enum": [
                                "pending",
                                "counted",
                                "mixed",
                                "not_counted"
                              ]
                            },
                            "reason": {
                              "type": "string",
                              "enum": [
                                "no_search_console",
                                "no_page_to_compare",
                                "no_ai_tracking"
                              ]
                            },
                            "window_days": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "clicks_before": {
                              "type": "number",
                              "minimum": 0
                            },
                            "clicks_after": {
                              "type": "number",
                              "minimum": 0
                            }
                          },
                          "required": [
                            "verdict"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "steps"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "id",
                    "client_id",
                    "asset_id",
                    "channel",
                    "area",
                    "title",
                    "why_now",
                    "evidence",
                    "counter_evidence",
                    "limits",
                    "impact",
                    "confidence",
                    "confidence_reason",
                    "risk",
                    "effort",
                    "reversibility",
                    "kind",
                    "state",
                    "slot",
                    "position",
                    "prerequisites",
                    "success",
                    "finding_ref",
                    "created_at",
                    "before_after",
                    "impact_null_reason",
                    "buttons",
                    "next_action"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "update_recommendation",
        "summary": "Snoozes a card until a date, or declines it with a reason code. A card whose change waits for a decision is decided with the approval, not here.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "recommendation_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "snooze",
                      "dismiss"
                    ]
                  },
                  "until": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "reason_code": {
                    "type": "string",
                    "enum": [
                      "not_relevant",
                      "already_done",
                      "wrong_data",
                      "too_risky",
                      "too_soon",
                      "no_budget",
                      "client_preference",
                      "other"
                    ]
                  }
                },
                "required": [
                  "action"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "client_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "asset_id": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "channel": {
                      "type": "string",
                      "enum": [
                        "google_ads",
                        "meta_ads",
                        "openai_ads",
                        "linkedin_ads",
                        "seo",
                        "geo",
                        "site",
                        "tracking",
                        "cross"
                      ]
                    },
                    "area": {
                      "type": "string",
                      "enum": [
                        "preflight",
                        "tracking",
                        "waste",
                        "search_terms",
                        "bidding",
                        "budget",
                        "placement",
                        "targeting",
                        "lead_quality",
                        "landing_page",
                        "structure",
                        "creative",
                        "platform_change",
                        "seo",
                        "geo",
                        "competitor"
                      ]
                    },
                    "title": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 90
                    },
                    "why_now": {
                      "type": "object",
                      "properties": {
                        "trigger": {
                          "type": "string",
                          "enum": [
                            "new",
                            "threshold_crossed",
                            "window_matured",
                            "season",
                            "platform_change",
                            "user_ask"
                          ]
                        },
                        "since": {
                          "type": "string",
                          "format": "date"
                        },
                        "text": {
                          "type": "string",
                          "minLength": 1
                        },
                        "delay_cost": {
                          "type": "object",
                          "properties": {
                            "amount_minor": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "currency": {
                              "type": "string",
                              "pattern": "^[A-Z]{3}$"
                            },
                            "per": {
                              "type": "string",
                              "enum": [
                                "day",
                                "week",
                                "month"
                              ]
                            },
                            "is_estimate": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "amount_minor",
                            "currency",
                            "per",
                            "is_estimate"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "trigger",
                        "since",
                        "text"
                      ],
                      "additionalProperties": false
                    },
                    "evidence": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "fact_id": {
                            "type": "string",
                            "pattern": "^[0-9a-f]{16}$"
                          },
                          "label": {
                            "type": "string"
                          },
                          "value": {
                            "type": [
                              "number",
                              "string",
                              "null"
                            ]
                          },
                          "unit": {
                            "type": "string"
                          },
                          "window": {
                            "type": "object",
                            "properties": {
                              "from": {
                                "type": "string",
                                "format": "date"
                              },
                              "to": {
                                "type": "string",
                                "format": "date"
                              }
                            },
                            "required": [
                              "from",
                              "to"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "fact_id",
                          "label",
                          "value",
                          "unit"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "counter_evidence": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "fact_id": {
                            "type": "string",
                            "pattern": "^[0-9a-f]{16}$"
                          },
                          "label": {
                            "type": "string"
                          },
                          "value": {
                            "type": [
                              "number",
                              "string",
                              "null"
                            ]
                          },
                          "unit": {
                            "type": "string"
                          },
                          "window": {
                            "type": "object",
                            "properties": {
                              "from": {
                                "type": "string",
                                "format": "date"
                              },
                              "to": {
                                "type": "string",
                                "format": "date"
                              }
                            },
                            "required": [
                              "from",
                              "to"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "fact_id",
                          "label",
                          "value",
                          "unit"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "limits": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "impact": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "metric": {
                              "type": "string",
                              "minLength": 1
                            },
                            "low": {
                              "type": [
                                "number",
                                "null"
                              ]
                            },
                            "high": {
                              "type": [
                                "number",
                                "null"
                              ]
                            },
                            "unit": {
                              "type": "string",
                              "minLength": 1
                            },
                            "horizon_days": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "basis": {
                              "type": "string",
                              "enum": [
                                "estimate",
                                "bound",
                                "not_estimable"
                              ]
                            },
                            "fact_ids": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "pattern": "^[0-9a-f]{16}$"
                              }
                            },
                            "assumptions": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          },
                          "required": [
                            "metric",
                            "low",
                            "high",
                            "unit",
                            "horizon_days",
                            "basis",
                            "fact_ids",
                            "assumptions"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "confidence": {
                      "type": "string",
                      "enum": [
                        "established",
                        "likely",
                        "hypothesis",
                        "unknown"
                      ]
                    },
                    "confidence_reason": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "risk": {
                      "type": "object",
                      "properties": {
                        "level": {
                          "type": "string",
                          "enum": [
                            "low",
                            "medium",
                            "high"
                          ]
                        },
                        "worst_case": {
                          "type": "string"
                        },
                        "exposure_minor": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "currency": {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        }
                      },
                      "required": [
                        "level",
                        "worst_case",
                        "exposure_minor",
                        "currency"
                      ],
                      "additionalProperties": false
                    },
                    "effort": {
                      "type": "object",
                      "properties": {
                        "level": {
                          "type": "string",
                          "enum": [
                            "none",
                            "minutes",
                            "hours",
                            "days"
                          ]
                        },
                        "who": {
                          "type": "string",
                          "minLength": 1
                        },
                        "minutes": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "level",
                        "who"
                      ],
                      "additionalProperties": false
                    },
                    "reversibility": {
                      "type": "object",
                      "properties": {
                        "level": {
                          "type": "string",
                          "enum": [
                            "one_click",
                            "manual",
                            "none"
                          ]
                        },
                        "window_days": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        "how": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "level",
                        "how"
                      ],
                      "additionalProperties": false
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "auto_apply",
                        "approval",
                        "human_task",
                        "hold"
                      ]
                    },
                    "state": {
                      "type": "string",
                      "enum": [
                        "open",
                        "in_progress",
                        "snoozed",
                        "done",
                        "dismissed",
                        "expired",
                        "superseded"
                      ]
                    },
                    "slot": {
                      "type": "string",
                      "enum": [
                        "safety",
                        "top",
                        "queue",
                        "hold"
                      ]
                    },
                    "position": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "severity": {
                      "anyOf": [
                        {
                          "type": "number",
                          "const": 1
                        },
                        {
                          "type": "number",
                          "const": 2
                        },
                        {
                          "type": "number",
                          "const": 3
                        }
                      ]
                    },
                    "prerequisites": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "code": {
                            "type": "string",
                            "minLength": 1
                          },
                          "state": {
                            "type": "string",
                            "enum": [
                              "met",
                              "unmet",
                              "unknown"
                            ]
                          }
                        },
                        "required": [
                          "code",
                          "state"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "success": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "hypothesis": {
                              "type": "string"
                            },
                            "metric": {
                              "type": "string",
                              "minLength": 1
                            },
                            "baseline": {
                              "type": [
                                "number",
                                "null"
                              ]
                            },
                            "guardrail": {
                              "type": "object",
                              "properties": {
                                "metric": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "worse_than_pct": {
                                  "type": "number",
                                  "exclusiveMinimum": 0
                                }
                              },
                              "required": [
                                "metric",
                                "worse_than_pct"
                              ],
                              "additionalProperties": false
                            },
                            "review_after_days": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "hypothesis",
                            "metric",
                            "baseline",
                            "guardrail",
                            "review_after_days"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "action": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "blocked",
                            "pending",
                            "approved",
                            "auto_queued",
                            "executing",
                            "done",
                            "failed",
                            "unknown",
                            "rejected",
                            "expired",
                            "withdrawn",
                            "superseded"
                          ]
                        },
                        "requires": {
                          "type": "string",
                          "enum": [
                            "operator",
                            "client"
                          ]
                        },
                        "expires_at": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "date-time"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "status",
                        "requires",
                        "expires_at"
                      ],
                      "additionalProperties": false
                    },
                    "finding_ref": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "before_after": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "before": {
                              "type": "string",
                              "minLength": 1
                            },
                            "after": {
                              "type": "string",
                              "minLength": 1
                            }
                          },
                          "required": [
                            "before",
                            "after"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "impact_null_reason": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "buttons": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "code": {
                            "type": "string",
                            "enum": [
                              "approve",
                              "not_now",
                              "ask",
                              "done",
                              "snooze",
                              "too_early",
                              "undo"
                            ]
                          },
                          "primary": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "code",
                          "primary"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "next_action": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "identity",
                                "payment",
                                "oauth",
                                "approval",
                                "wait"
                              ]
                            },
                            "url": {
                              "type": "string",
                              "minLength": 1
                            },
                            "why": {
                              "type": "string",
                              "minLength": 1
                            },
                            "resume": {
                              "type": "string"
                            },
                            "poll_after_s": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "kind",
                            "url",
                            "why"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "change": {
                      "type": "object",
                      "properties": {
                        "platform": {
                          "type": "string",
                          "enum": [
                            "google_ads",
                            "meta_ads"
                          ]
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "ADD_NEGATIVE",
                            "PAUSE_KEYWORD",
                            "PAUSE_AD",
                            "PAUSE_ADSET",
                            "PAUSE_CAMPAIGN",
                            "SET_BUDGET",
                            "SET_MAX_CPC",
                            "ENABLE_ENTITY",
                            "SET_NETWORKS",
                            "SET_GEO_PRESENCE",
                            "ADD_KEYWORD",
                            "SET_BID_STRATEGY",
                            "SET_PLACEMENTS",
                            "SET_AUDIENCE_OPTION",
                            "SET_CREATIVE_FEATURES",
                            "CREATE_CAMPAIGN_DRAFT",
                            "CREATE_AD_DRAFT",
                            "LAUNCH_CAMPAIGN"
                          ]
                        },
                        "entity_ref": {
                          "type": "string",
                          "minLength": 1
                        },
                        "direction": {
                          "type": "string",
                          "enum": [
                            "increase",
                            "decrease",
                            "neutral"
                          ]
                        },
                        "from": {},
                        "to": {},
                        "month_projection_minor": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "monthly_cap_minor": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "platform",
                        "type",
                        "entity_ref",
                        "direction",
                        "from",
                        "to"
                      ],
                      "additionalProperties": false
                    },
                    "task": {
                      "type": "object",
                      "properties": {
                        "steps": {
                          "type": "array",
                          "items": {}
                        },
                        "draft": {},
                        "target": {},
                        "items": {
                          "type": "array",
                          "items": {}
                        },
                        "measure": {
                          "type": "object",
                          "properties": {
                            "verdict": {
                              "type": "string",
                              "enum": [
                                "pending",
                                "counted",
                                "mixed",
                                "not_counted"
                              ]
                            },
                            "reason": {
                              "type": "string",
                              "enum": [
                                "no_search_console",
                                "no_page_to_compare",
                                "no_ai_tracking"
                              ]
                            },
                            "window_days": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "clicks_before": {
                              "type": "number",
                              "minimum": 0
                            },
                            "clicks_after": {
                              "type": "number",
                              "minimum": 0
                            }
                          },
                          "required": [
                            "verdict"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "steps"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "id",
                    "client_id",
                    "asset_id",
                    "channel",
                    "area",
                    "title",
                    "why_now",
                    "evidence",
                    "counter_evidence",
                    "limits",
                    "impact",
                    "confidence",
                    "confidence_reason",
                    "risk",
                    "effort",
                    "reversibility",
                    "kind",
                    "state",
                    "slot",
                    "position",
                    "prerequisites",
                    "success",
                    "finding_ref",
                    "created_at",
                    "before_after",
                    "impact_null_reason",
                    "buttons",
                    "next_action"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/research/related-keywords": {
      "post": {
        "operationId": "get_related_keywords",
        "summary": "Searches close to one phrase, with searches a month, cost per click (USD), competition, difficulty and intent, the most searched first. `kind`: related (Google's \"related searches\", two levels deep) or suggestions (searches that contain the phrase). Send `keyword` and, for another country than the business's, `country`. Up to 100 rows. Costs 5 credits: an agent or key sends max_credits (estimate_spend gives the price). Nothing is charged when nothing comes back.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Optional. Send the same value to repeat this paid call without paying twice; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused). The CLI sends one made from the request.",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "keyword": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 200,
                    "pattern": "^[^\\p{Cc}]*$"
                  },
                  "kind": {
                    "default": "related",
                    "type": "string",
                    "enum": [
                      "related",
                      "suggestions"
                    ]
                  },
                  "country": {
                    "type": "string",
                    "pattern": "^[A-Za-z]{2}$"
                  },
                  "limit": {
                    "default": 50,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "description": "The most rows to return."
                  },
                  "max_credits": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000,
                    "description": "The most credits this call may spend. A call that costs more is refused and nothing is spent. estimate_spend gives the price."
                  }
                },
                "required": [
                  "keyword"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "keyword": {
                      "type": "string"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "related",
                        "suggestions"
                      ]
                    },
                    "country": {
                      "type": "string"
                    },
                    "rows": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "keyword": {
                            "type": "string"
                          },
                          "monthly_searches": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "cpc_usd": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "competition": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "difficulty": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "intent": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "keyword",
                          "monthly_searches",
                          "cpc_usd",
                          "competition",
                          "difficulty",
                          "intent"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "credits": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "balance": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "keyword",
                    "kind",
                    "country",
                    "rows",
                    "credits",
                    "balance"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "The credit cap or balance is short (G-COST), or the organization has no paid plan (G-ENTITLEMENT). missing and next_action say what to do.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/report": {
      "get": {
        "operationId": "get_report",
        "summary": "Reads the latest weekly letter or monthly report of one business: the brief, the text, and the ledger lines of a month. Every surface shows this one snapshot.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "default": "weekly_digest",
              "type": "string",
              "enum": [
                "weekly_digest",
                "monthly_report"
              ]
            }
          },
          {
            "name": "id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "weekly_digest",
                        "monthly_report"
                      ]
                    },
                    "period": {
                      "type": "object",
                      "properties": {
                        "start": {
                          "type": "string",
                          "format": "date"
                        },
                        "end": {
                          "type": "string",
                          "format": "date"
                        }
                      },
                      "required": [
                        "start",
                        "end"
                      ],
                      "additionalProperties": false
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "fact_ids": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "brief": {
                      "type": "object",
                      "properties": {
                        "verdict_code": {
                          "type": "string",
                          "enum": [
                            "good",
                            "watch",
                            "problem",
                            "calm",
                            "data_gap"
                          ]
                        },
                        "period": {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "week",
                                "month"
                              ]
                            },
                            "start": {
                              "type": "string",
                              "format": "date"
                            },
                            "end": {
                              "type": "string",
                              "format": "date"
                            },
                            "timezone": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "kind",
                            "start",
                            "end",
                            "timezone"
                          ],
                          "additionalProperties": false
                        },
                        "pending_count": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "next_look": {
                          "type": "string",
                          "format": "date"
                        },
                        "moves": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "title": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "title"
                            ],
                            "additionalProperties": {}
                          }
                        },
                        "actions": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "enum": [
                                  "open",
                                  "answer",
                                  "results"
                                ]
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "primary",
                                  "link"
                                ]
                              },
                              "path": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "kind",
                              "path"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "verdict_code",
                        "period",
                        "pending_count",
                        "next_look",
                        "moves",
                        "actions"
                      ],
                      "additionalProperties": {}
                    },
                    "letter": {
                      "type": "object",
                      "properties": {
                        "lang": {
                          "type": "string"
                        },
                        "locale": {
                          "type": "string"
                        },
                        "calm": {
                          "type": "boolean"
                        },
                        "headline": {
                          "type": "string"
                        },
                        "story": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "period": {
                          "type": "string"
                        },
                        "stats": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "label": {
                                "type": "string"
                              },
                              "value": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "label",
                              "value"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "did": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "moves": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "left_alone": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "unknowns": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "question": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "need": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "words": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "lang",
                        "locale",
                        "calm",
                        "headline",
                        "story",
                        "period",
                        "stats",
                        "did",
                        "moves",
                        "left_alone",
                        "unknowns",
                        "question",
                        "need",
                        "words"
                      ],
                      "additionalProperties": false
                    },
                    "ledger": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "lines": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "decisions": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          },
                          "required": [
                            "lines",
                            "decisions"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "kind",
                    "period",
                    "created_at",
                    "fact_ids",
                    "brief",
                    "letter",
                    "ledger"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/scans/{id}/events": {
      "get": {
        "operationId": "get_scan_events",
        "summary": "Reads the progress of a scan after the last event the caller has seen.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "schema": {
              "default": 0,
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 100,
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "description": "The most rows to return."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string"
                    },
                    "next": {
                      "type": "number"
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "seq": {
                            "type": "number"
                          },
                          "event": {}
                        },
                        "required": [
                          "seq",
                          "event"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "status",
                    "next",
                    "events"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/scans/{id}/favicons/{domain}": {
      "get": {
        "operationId": "get_scan_favicon",
        "summary": "The small icon of a site that this scan names, as base64. The visitor's browser asks us, never a third party.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "domain",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 253
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "content_type": {
                      "type": "string"
                    },
                    "data_base64": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "content_type",
                    "data_base64"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/scans/{id}/fixes": {
      "get": {
        "operationId": "get_scan_fixes",
        "summary": "The written fixes of a scan of a paying organization: what to change on which page. Before payment the list is empty and the status says so.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string"
                    },
                    "items": {
                      "type": "array",
                      "items": {}
                    }
                  },
                  "required": [
                    "status",
                    "items"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/scans/{id}/report": {
      "get": {
        "operationId": "get_scan_report",
        "summary": "The report of a scan: the score (`result.score`), its `history`, the `weekly` plan and when the next weekly rescan runs (`next_scan_at`). A visitor sees the worst problem in full once the scan has a proven e-mail address (before that: 403 email_required); a paying customer, or an agent or key of theirs, sees everything and the written fixes. The scan id of a business is `clients[].scan.id` in get_bootstrap.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "business": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "domain": {
                              "type": "string"
                            },
                            "name": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "summary": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "country": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "language": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "services": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "city": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "domain",
                            "name",
                            "summary",
                            "country",
                            "language",
                            "services",
                            "city"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "result": {
                      "anyOf": [
                        {},
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "data": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "paid": {
                      "type": "boolean"
                    },
                    "locked": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "area": {
                            "type": "string"
                          },
                          "severity": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "id",
                          "area",
                          "severity"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "fixes": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string"
                        },
                        "items": {
                          "type": "array",
                          "items": {}
                        }
                      },
                      "required": [
                        "status",
                        "items"
                      ],
                      "additionalProperties": false
                    },
                    "weekly": {
                      "anyOf": [
                        {},
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "history": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "at": {
                            "type": "string"
                          },
                          "score": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "problemCount": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "at",
                          "score",
                          "problemCount"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "next_scan_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "weekly_mail": {
                      "type": "boolean"
                    },
                    "offer": {
                      "type": "object",
                      "properties": {
                        "primary": {
                          "type": "string",
                          "enum": [
                            "ads",
                            "seo"
                          ]
                        },
                        "reason": {
                          "type": "string",
                          "enum": [
                            "ads_tag_found",
                            "shop_without_ads_tag",
                            "no_ads_tag",
                            "tags_unread"
                          ]
                        },
                        "signals": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "ads_open": {
                          "type": "boolean"
                        },
                        "seo_open": {
                          "type": "boolean"
                        },
                        "agency_link": {
                          "type": "boolean"
                        },
                        "free_open": {
                          "type": "boolean"
                        },
                        "ads_closed_reason": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "beta"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "capabilities": {
                          "type": "object",
                          "properties": {
                            "google_write": {
                              "type": "boolean"
                            },
                            "meta_write": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "google_write",
                            "meta_write"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "primary",
                        "reason",
                        "signals",
                        "ads_open",
                        "seo_open",
                        "agency_link",
                        "free_open",
                        "ads_closed_reason",
                        "capabilities"
                      ],
                      "additionalProperties": false
                    },
                    "kept": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "scans": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "fixes": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "scans",
                            "fixes"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "can_start": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "business",
                    "result",
                    "data",
                    "paid",
                    "locked",
                    "fixes",
                    "weekly",
                    "history",
                    "next_scan_at",
                    "weekly_mail",
                    "offer",
                    "kept",
                    "can_start"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/scans/{id}/shots/{shot}": {
      "get": {
        "operationId": "get_scan_shot",
        "summary": "A picture of the website that this scan took, as base64.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "shot",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 64,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "content_type": {
                      "type": "string"
                    },
                    "data_base64": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "content_type",
                    "data_base64"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/scans/{id}/teaser": {
      "get": {
        "operationId": "get_scan_teaser",
        "summary": "The score of a finished scan and the area and severity of its worst problems. The headlines open with a proven e-mail address, in the report.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "score": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "problem_count": {
                      "type": "number"
                    },
                    "top": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "area": {
                            "type": "string"
                          },
                          "severity": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "id",
                          "area",
                          "severity"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "score",
                    "problem_count",
                    "top"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/search-console/near-page-one": {
      "get": {
        "operationId": "get_search_near_page_one",
        "summary": "Searches the site shows for on Google at an average place of 5 to 20 (close to page 1), from Search Console, most shown first (the numbers come from Google's rows for each query and page together, so a query two pages showed for adds up their impressions and its place is weighted by them; they are not the Queries tab of Search Console, and a query Google hides is missing): the place, impressions, clicks, click rate, the page shown most and whether the search is already followed. Filters: `days` (7, 28 or 90), `page` with `page_match` (contains, the default, or exact: a full address or a path starting with /). `site:` searches, sentences over 80 characters and searches with the business's own name are left out and counted in `hidden`. There is no device or country filter: Search Console's queries carry neither, so the list covers every device and country. Free: it reads stored data. Follow one with set_tracked_keywords.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "days",
            "in": "query",
            "required": false,
            "schema": {
              "default": 28,
              "anyOf": [
                {
                  "type": "number",
                  "const": 7
                },
                {
                  "type": "number",
                  "const": 28
                },
                {
                  "type": "number",
                  "const": 90
                }
              ]
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 2000
            }
          },
          {
            "name": "page_match",
            "in": "query",
            "required": false,
            "schema": {
              "default": "contains",
              "type": "string",
              "enum": [
                "contains",
                "exact"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "connected": {
                      "type": "boolean"
                    },
                    "as_of": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "days": {
                      "anyOf": [
                        {
                          "type": "number",
                          "const": 7
                        },
                        {
                          "type": "number",
                          "const": 28
                        },
                        {
                          "type": "number",
                          "const": 90
                        }
                      ]
                    },
                    "window": {
                      "type": "object",
                      "properties": {
                        "from": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "to": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "from",
                        "to"
                      ],
                      "additionalProperties": false
                    },
                    "total": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "hidden": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "rows": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "query": {
                            "type": "string"
                          },
                          "position": {
                            "type": "number"
                          },
                          "impressions": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "clicks": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "ctr": {
                            "type": "number"
                          },
                          "page": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "tracked": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "query",
                          "position",
                          "impressions",
                          "clicks",
                          "ctr",
                          "page",
                          "tracked"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "gap": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "not_collected_yet"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "connected",
                    "as_of",
                    "days",
                    "window",
                    "total",
                    "hidden",
                    "rows",
                    "gap"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/search-performance": {
      "get": {
        "operationId": "get_search_performance",
        "summary": "Reads Google Search Console for the business's site: clicks, impressions, click rate and average position over the last 7, 28 or 90 final days against the days before, one point a day, the sum of each seven days, the biggest queries and pages. The totals are the whole site's. The queries and pages come from Google's rows for each query and page together, so they are not the Queries and Pages tabs of Search Console: a query Google hides is in no query or page row (the rows add up to less than the totals), and a query that two of the site's pages showed for adds up their impressions (its impressions can be higher, its click rate lower and its average place worse than in Search Console). The average place is weighted by impressions. With `page` (a stored page, a full address or a path starting with /) the numbers, the series and the queries are that page's alone. It reads stored data only; with no property linked it says so and gives no number.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "days",
            "in": "query",
            "required": false,
            "schema": {
              "default": 28,
              "anyOf": [
                {
                  "type": "number",
                  "const": 7
                },
                {
                  "type": "number",
                  "const": 28
                },
                {
                  "type": "number",
                  "const": 90
                }
              ]
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 2000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "connected": {
                      "type": "boolean"
                    },
                    "as_of": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "days": {
                      "anyOf": [
                        {
                          "type": "number",
                          "const": 7
                        },
                        {
                          "type": "number",
                          "const": 28
                        },
                        {
                          "type": "number",
                          "const": 90
                        }
                      ]
                    },
                    "covered_days": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "totals": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "clicks": {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                },
                                "previous": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                },
                                "change": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                },
                                "change_pct": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                }
                              },
                              "required": [
                                "value",
                                "previous",
                                "change",
                                "change_pct"
                              ],
                              "additionalProperties": false
                            },
                            "impressions": {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                },
                                "previous": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                },
                                "change": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                },
                                "change_pct": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                }
                              },
                              "required": [
                                "value",
                                "previous",
                                "change",
                                "change_pct"
                              ],
                              "additionalProperties": false
                            },
                            "ctr": {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                },
                                "previous": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                },
                                "change": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                },
                                "change_pct": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                }
                              },
                              "required": [
                                "value",
                                "previous",
                                "change",
                                "change_pct"
                              ],
                              "additionalProperties": false
                            },
                            "position": {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                },
                                "previous": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                },
                                "change": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                },
                                "change_pct": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                }
                              },
                              "required": [
                                "value",
                                "previous",
                                "change",
                                "change_pct"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "clicks",
                            "impressions",
                            "ctr",
                            "position"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "weeks": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "week": {
                            "type": "string",
                            "format": "date"
                          },
                          "clicks": {
                            "type": "number"
                          },
                          "impressions": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "week",
                          "clicks",
                          "impressions"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "series": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "date": {
                            "type": "string",
                            "format": "date"
                          },
                          "clicks": {
                            "type": "number"
                          },
                          "impressions": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "date",
                          "clicks",
                          "impressions"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "queries": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "query": {
                            "type": "string"
                          },
                          "clicks": {
                            "type": "number"
                          },
                          "impressions": {
                            "type": "number"
                          },
                          "ctr": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "position": {
                            "type": [
                              "number",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "query",
                          "clicks",
                          "impressions",
                          "ctr",
                          "position"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "pages": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "page": {
                            "type": "string"
                          },
                          "clicks": {
                            "type": "number"
                          },
                          "impressions": {
                            "type": "number"
                          },
                          "ctr": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "position": {
                            "type": [
                              "number",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "page",
                          "clicks",
                          "impressions",
                          "ctr",
                          "position"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "page": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "connected",
                    "as_of",
                    "days",
                    "covered_days",
                    "totals",
                    "weeks",
                    "series",
                    "queries",
                    "pages",
                    "page"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/research/autocomplete": {
      "post": {
        "operationId": "get_search_suggestions",
        "summary": "What Google suggests while someone types a phrase (autocomplete), in Google's order. Send `keyword` and, for another country than the business's, `country`. Costs 1 credit: an agent or key sends max_credits. Nothing is charged when Google suggests nothing.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Optional. Send the same value to repeat this paid call without paying twice; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused). The CLI sends one made from the request.",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "keyword": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 200,
                    "pattern": "^[^\\p{Cc}]*$"
                  },
                  "country": {
                    "type": "string",
                    "pattern": "^[A-Za-z]{2}$"
                  },
                  "max_credits": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000,
                    "description": "The most credits this call may spend. A call that costs more is refused and nothing is spent. estimate_spend gives the price."
                  }
                },
                "required": [
                  "keyword"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "keyword": {
                      "type": "string"
                    },
                    "country": {
                      "type": "string"
                    },
                    "suggestions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "credits": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "balance": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "keyword",
                    "country",
                    "suggestions",
                    "credits",
                    "balance"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "The credit cap or balance is short (G-COST), or the organization has no paid plan (G-ENTITLEMENT). missing and next_action say what to do.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/serp": {
      "get": {
        "operationId": "get_serp",
        "summary": "The results page of one search the business follows, as the check stored it on one day (the newest, or `date`): for each result its place, domain, title, address and the snippet shown, which one is the business, and the business's place in Google Maps. With `engine` it reads Bing or Yahoo. It reads stored data only.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "keyword",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "engine",
            "in": "query",
            "required": false,
            "schema": {
              "default": "google",
              "type": "string",
              "enum": [
                "google",
                "bing",
                "yahoo"
              ]
            }
          },
          {
            "name": "date",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "keyword": {
                      "type": "string"
                    },
                    "engine": {
                      "type": "string",
                      "enum": [
                        "google",
                        "bing",
                        "yahoo"
                      ]
                    },
                    "date": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "dates": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "format": "date"
                      }
                    },
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "position": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "domain": {
                            "type": "string"
                          },
                          "title": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "url": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "snippet": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "is_you": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "position",
                          "domain",
                          "title",
                          "url",
                          "snippet",
                          "is_you"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "local_pack": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "string",
                          "const": "not_in_pack"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "measure": {
                      "type": "object",
                      "properties": {
                        "outcome": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "ok",
                                "partial",
                                "no_credit",
                                "cap_reached",
                                "plan_required",
                                "connection_lost",
                                "provider_error",
                                "paused",
                                "stuck"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "skip_reason": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "ok",
                                "partial",
                                "no_credit",
                                "cap_reached",
                                "plan_required",
                                "connection_lost",
                                "provider_error",
                                "paused",
                                "stuck"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "skip_at": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "collected": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "planned": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "complete": {
                          "type": [
                            "boolean",
                            "null"
                          ]
                        },
                        "at": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "outcome",
                        "skip_reason",
                        "skip_at",
                        "collected",
                        "planned",
                        "complete",
                        "at"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "keyword",
                    "engine",
                    "date",
                    "dates",
                    "results",
                    "local_pack"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/setup": {
      "get": {
        "operationId": "get_setup",
        "summary": "The end-of-setup page of a business: the profile rows to check (value, who gave it, confirmed or not), Search Console and Analytics, the mode, the monthly cap of each ad account and the dates of what happens next. Reading only; a person saves the steps in the panel.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "client_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "version": {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991
                    },
                    "timezone": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "mode": {
                      "type": "string",
                      "enum": [
                        "guide",
                        "autopilot"
                      ]
                    },
                    "rows": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "field": {
                            "type": "string"
                          },
                          "value": {
                            "type": "string"
                          },
                          "source": {
                            "type": "string"
                          },
                          "confirmed": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "field",
                          "value",
                          "source",
                          "confirmed"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "steps": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "step": {
                            "type": "string",
                            "enum": [
                              "profile",
                              "search_console",
                              "ga4",
                              "mode"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "pending",
                              "done",
                              "skipped",
                              "not_applicable"
                            ]
                          }
                        },
                        "required": [
                          "step",
                          "status"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "properties": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "enum": [
                              "search_console",
                              "ga4"
                            ]
                          },
                          "connected": {
                            "type": "boolean"
                          },
                          "label": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "kind",
                          "connected",
                          "label"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "caps": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "asset_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "label": {
                            "type": "string"
                          },
                          "currency": {
                            "type": "string"
                          },
                          "cap_minor": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "suggested_minor": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "asset_id",
                          "label",
                          "currency",
                          "cap_minor",
                          "suggested_minor"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "schedule": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "key": {
                            "type": "string",
                            "enum": [
                              "today",
                              "tomorrow",
                              "weekly",
                              "first_result",
                              "monthly"
                            ]
                          },
                          "at": {
                            "type": "string"
                          },
                          "approx": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "key",
                          "at",
                          "approx"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "done": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "client_id",
                    "version",
                    "timezone",
                    "mode",
                    "rows",
                    "steps",
                    "properties",
                    "caps",
                    "schedule",
                    "done"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/setup-status": {
      "get": {
        "operationId": "get_setup_status",
        "summary": "What is done and what is missing before Upnatus can work on a business: a plan (SEO and GEO, or ads), an ad account when the plan has ads, the profile, waiting approvals. When a person has to do the next step, next_action says where; give it to the person and call this again.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "client_id": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "ready": {
                      "type": "boolean"
                    },
                    "steps": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "step": {
                            "type": "string",
                            "enum": [
                              "identity",
                              "payment",
                              "oauth",
                              "profile",
                              "approval"
                            ]
                          },
                          "done": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "step",
                          "done"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "missing_profile": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "country",
                          "service_area",
                          "business_model",
                          "monthly_budget",
                          "lead_response_channel"
                        ]
                      }
                    },
                    "waiting_approvals": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "next_action": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "identity",
                                "payment",
                                "oauth",
                                "approval",
                                "wait"
                              ]
                            },
                            "url": {
                              "type": "string",
                              "minLength": 1
                            },
                            "why": {
                              "type": "string",
                              "minLength": 1
                            },
                            "resume": {
                              "type": "string"
                            },
                            "poll_after_s": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "kind",
                            "url",
                            "why"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "client_id",
                    "ready",
                    "steps",
                    "missing_profile",
                    "waiting_approvals",
                    "next_action"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/site-audit": {
      "get": {
        "operationId": "get_site_audit",
        "summary": "What the newest scan found on the business site: issues grouped by severity, each in plain words (what it is, why it matters, how to fix it) with the pages it touches and the task made from it, what each page says, what robots.txt says about the AI crawlers, the PageSpeed numbers for phone and desktop, and the open suggestions the scan made about the site (the ones Today shows). It reads stored data only.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "as_of": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "pages_checked": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "sitemap_pages": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "incomplete": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "js_not_rendered",
                            "no_pages",
                            "partial"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "js_rendered": {
                      "type": [
                        "boolean",
                        "null"
                      ]
                    },
                    "issues": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "severity": {
                            "type": "string",
                            "enum": [
                              "critical",
                              "warning",
                              "notice"
                            ]
                          },
                          "scope": {
                            "type": "string",
                            "enum": [
                              "page",
                              "site"
                            ]
                          },
                          "count": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "pages": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "title": {
                            "type": "string"
                          },
                          "what": {
                            "type": "string"
                          },
                          "why": {
                            "type": "string"
                          },
                          "fix": {
                            "type": "string"
                          },
                          "task": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "status": {
                                    "type": "string",
                                    "enum": [
                                      "open",
                                      "done",
                                      "postponed",
                                      "rejected"
                                    ]
                                  }
                                },
                                "required": [
                                  "id",
                                  "status"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "severity",
                          "scope",
                          "count",
                          "pages",
                          "title",
                          "what",
                          "why",
                          "fix",
                          "task"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "by_severity": {
                      "type": "object",
                      "properties": {
                        "critical": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "warning": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "notice": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "critical",
                        "warning",
                        "notice"
                      ],
                      "additionalProperties": false
                    },
                    "pages": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "url": {
                            "type": "string"
                          },
                          "status": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "title": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "description": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "h1": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "canonical": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "noindex": {
                            "type": "boolean"
                          },
                          "words": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "schema_types": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "images": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "images_no_alt": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "url",
                          "status",
                          "title",
                          "description",
                          "h1",
                          "canonical",
                          "noindex",
                          "words",
                          "schema_types",
                          "images",
                          "images_no_alt"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "robots_ai": {
                      "anyOf": [
                        {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "string",
                            "enum": [
                              "allowed",
                              "blocked",
                              "not_mentioned"
                            ]
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "robots_ai_gap": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "not_collected_yet",
                            "region_not_supported",
                            "budget_cap",
                            "task_pending",
                            "source_failed",
                            "no_page_id",
                            "not_shown_yet",
                            "nothing_found",
                            "none_tracked"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "speed": {
                      "type": "object",
                      "properties": {
                        "mobile": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "score": {
                                  "type": "number"
                                },
                                "lcp_ms": {
                                  "type": "number"
                                },
                                "cls": {
                                  "type": "number"
                                },
                                "tbt_ms": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "score",
                                "lcp_ms",
                                "cls",
                                "tbt_ms"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "desktop": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "score": {
                                  "type": "number"
                                },
                                "lcp_ms": {
                                  "type": "number"
                                },
                                "cls": {
                                  "type": "number"
                                },
                                "tbt_ms": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "score",
                                "lcp_ms",
                                "cls",
                                "tbt_ms"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "gap": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "not_collected_yet",
                                "region_not_supported",
                                "budget_cap",
                                "task_pending",
                                "source_failed",
                                "no_page_id",
                                "not_shown_yet",
                                "nothing_found",
                                "none_tracked"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "field": {
                          "anyOf": [
                            {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "url": {
                                    "type": "string"
                                  },
                                  "status": {
                                    "type": "string",
                                    "enum": [
                                      "ok",
                                      "no_data"
                                    ]
                                  },
                                  "lcp_ms": {
                                    "type": [
                                      "number",
                                      "null"
                                    ]
                                  },
                                  "cls": {
                                    "type": [
                                      "number",
                                      "null"
                                    ]
                                  },
                                  "inp_ms": {
                                    "type": [
                                      "number",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "url",
                                  "status",
                                  "lcp_ms",
                                  "cls",
                                  "inp_ms"
                                ],
                                "additionalProperties": false
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "mobile",
                        "desktop",
                        "gap",
                        "field"
                      ],
                      "additionalProperties": false
                    },
                    "suggestions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "recommendation_id": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "why": {
                            "type": "string"
                          },
                          "slot": {
                            "type": "string",
                            "enum": [
                              "safety",
                              "top",
                              "queue",
                              "hold"
                            ]
                          },
                          "severity": {
                            "anyOf": [
                              {
                                "anyOf": [
                                  {
                                    "type": "number",
                                    "const": 1
                                  },
                                  {
                                    "type": "number",
                                    "const": 2
                                  },
                                  {
                                    "type": "number",
                                    "const": 3
                                  }
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "recommendation_id",
                          "title",
                          "why",
                          "slot",
                          "severity"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "gap": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "not_collected_yet",
                            "region_not_supported",
                            "budget_cap",
                            "task_pending",
                            "source_failed",
                            "no_page_id",
                            "not_shown_yet",
                            "nothing_found",
                            "none_tracked"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "measure": {
                      "type": "object",
                      "properties": {
                        "outcome": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "ok",
                                "partial",
                                "no_credit",
                                "cap_reached",
                                "plan_required",
                                "connection_lost",
                                "provider_error",
                                "paused",
                                "stuck"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "skip_reason": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "ok",
                                "partial",
                                "no_credit",
                                "cap_reached",
                                "plan_required",
                                "connection_lost",
                                "provider_error",
                                "paused",
                                "stuck"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "skip_at": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "collected": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "planned": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "complete": {
                          "type": [
                            "boolean",
                            "null"
                          ]
                        },
                        "at": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "outcome",
                        "skip_reason",
                        "skip_at",
                        "collected",
                        "planned",
                        "complete",
                        "at"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "as_of",
                    "pages_checked",
                    "sitemap_pages",
                    "incomplete",
                    "js_rendered",
                    "issues",
                    "by_severity",
                    "pages",
                    "robots_ai",
                    "robots_ai_gap",
                    "speed",
                    "suggestions",
                    "gap"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/site-traffic": {
      "get": {
        "operationId": "get_site_traffic",
        "summary": "Reads Google Analytics for the business's site: visits (sessions), engaged visits and key events over the last 7, 28 or 90 final days against the days before, the sum of each seven days, the channels, the biggest sources and landing pages, and the key events by name. Stored data only; with no GA4 property linked it says so and gives no number.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "days",
            "in": "query",
            "required": false,
            "schema": {
              "default": 28,
              "anyOf": [
                {
                  "type": "number",
                  "const": 7
                },
                {
                  "type": "number",
                  "const": 28
                },
                {
                  "type": "number",
                  "const": 90
                }
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "connected": {
                      "type": "boolean"
                    },
                    "as_of": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "days": {
                      "anyOf": [
                        {
                          "type": "number",
                          "const": 7
                        },
                        {
                          "type": "number",
                          "const": 28
                        },
                        {
                          "type": "number",
                          "const": 90
                        }
                      ]
                    },
                    "covered_days": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "totals": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "sessions": {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                },
                                "previous": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                },
                                "change": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                },
                                "change_pct": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                }
                              },
                              "required": [
                                "value",
                                "previous",
                                "change",
                                "change_pct"
                              ],
                              "additionalProperties": false
                            },
                            "engaged_sessions": {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                },
                                "previous": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                },
                                "change": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                },
                                "change_pct": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                }
                              },
                              "required": [
                                "value",
                                "previous",
                                "change",
                                "change_pct"
                              ],
                              "additionalProperties": false
                            },
                            "key_events": {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                },
                                "previous": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                },
                                "change": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                },
                                "change_pct": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                }
                              },
                              "required": [
                                "value",
                                "previous",
                                "change",
                                "change_pct"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "sessions",
                            "engaged_sessions",
                            "key_events"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "weeks": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "week": {
                            "type": "string",
                            "format": "date"
                          },
                          "sessions": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "key_events": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "week",
                          "sessions",
                          "key_events"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "channels": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "channel": {
                            "type": "string"
                          },
                          "sessions": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "key_events": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "channel",
                          "sessions",
                          "key_events"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "sources": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "source": {
                            "type": "string"
                          },
                          "sessions": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "key_events": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "source",
                          "sessions",
                          "key_events"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "landing_pages": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "page": {
                            "type": "string"
                          },
                          "sessions": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "key_events": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "page",
                          "sessions",
                          "key_events"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "event": {
                            "type": "string"
                          },
                          "key_events": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "event",
                          "key_events"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "thresholded": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "connected",
                    "as_of",
                    "days",
                    "covered_days",
                    "totals",
                    "weeks",
                    "channels",
                    "sources",
                    "landing_pages",
                    "events",
                    "thresholded"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/status": {
      "get": {
        "operationId": "get_status",
        "summary": "Tells whether the service is up and what time it is there.",
        "x-stability": "stable",
        "security": [
          {},
          {
            "bearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "const": "ok"
                    },
                    "time": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "required": [
                    "status",
                    "time"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/today": {
      "get": {
        "operationId": "get_today",
        "summary": "What needs the person now: urgent things first, then the changes that wait for a decision, then at most three moves, and a short `account` line (credits, chat answers left, plan or trial, followed checks). It reads stored facts only, so it is quick and may be read as often as needed.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "client_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "variant": {
                      "type": "string",
                      "enum": [
                        "local",
                        "store",
                        "b2b"
                      ]
                    },
                    "sources": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "platform": {
                            "type": "string",
                            "enum": [
                              "shopify",
                              "merchant",
                              "hubspot",
                              "pipedrive",
                              "linkedin_ads"
                            ]
                          },
                          "state": {
                            "type": "string",
                            "enum": [
                              "connected",
                              "lost",
                              "missing"
                            ]
                          },
                          "read_only": {
                            "type": "boolean"
                          },
                          "url": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": [
                          "platform",
                          "state",
                          "read_only",
                          "url"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "headline": {
                      "type": "string",
                      "minLength": 1
                    },
                    "silent": {
                      "type": "boolean"
                    },
                    "status": {
                      "type": "object",
                      "properties": {
                        "mode": {
                          "type": "string",
                          "enum": [
                            "guide",
                            "autopilot"
                          ]
                        },
                        "paused": {
                          "type": "boolean"
                        },
                        "restricted": {
                          "type": "boolean"
                        },
                        "cap": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "amount_minor": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "currency": {
                                  "type": "string",
                                  "pattern": "^[A-Z]{3}$"
                                },
                                "forecast_minor": {
                                  "anyOf": [
                                    {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 9007199254740991
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "amount_minor",
                                "currency",
                                "forecast_minor"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "mode",
                        "paused",
                        "restricted",
                        "cap"
                      ],
                      "additionalProperties": false
                    },
                    "needs_you": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "enum": [
                              "safety",
                              "connection",
                              "approval"
                            ]
                          },
                          "title": {
                            "type": "string",
                            "minLength": 1
                          },
                          "platform": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "count": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          },
                          "recommendation_id": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "uuid"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "url": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": [
                          "kind",
                          "title",
                          "platform",
                          "count",
                          "recommendation_id",
                          "url"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "moves": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "client_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "asset_id": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "uuid"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "channel": {
                            "type": "string",
                            "enum": [
                              "google_ads",
                              "meta_ads",
                              "openai_ads",
                              "linkedin_ads",
                              "seo",
                              "geo",
                              "site",
                              "tracking",
                              "cross"
                            ]
                          },
                          "area": {
                            "type": "string",
                            "enum": [
                              "preflight",
                              "tracking",
                              "waste",
                              "search_terms",
                              "bidding",
                              "budget",
                              "placement",
                              "targeting",
                              "lead_quality",
                              "landing_page",
                              "structure",
                              "creative",
                              "platform_change",
                              "seo",
                              "geo",
                              "competitor"
                            ]
                          },
                          "title": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 90
                          },
                          "why_now": {
                            "type": "object",
                            "properties": {
                              "trigger": {
                                "type": "string",
                                "enum": [
                                  "new",
                                  "threshold_crossed",
                                  "window_matured",
                                  "season",
                                  "platform_change",
                                  "user_ask"
                                ]
                              },
                              "since": {
                                "type": "string",
                                "format": "date"
                              },
                              "text": {
                                "type": "string",
                                "minLength": 1
                              },
                              "delay_cost": {
                                "type": "object",
                                "properties": {
                                  "amount_minor": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "currency": {
                                    "type": "string",
                                    "pattern": "^[A-Z]{3}$"
                                  },
                                  "per": {
                                    "type": "string",
                                    "enum": [
                                      "day",
                                      "week",
                                      "month"
                                    ]
                                  },
                                  "is_estimate": {
                                    "type": "boolean"
                                  }
                                },
                                "required": [
                                  "amount_minor",
                                  "currency",
                                  "per",
                                  "is_estimate"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "required": [
                              "trigger",
                              "since",
                              "text"
                            ],
                            "additionalProperties": false
                          },
                          "evidence": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "fact_id": {
                                  "type": "string",
                                  "pattern": "^[0-9a-f]{16}$"
                                },
                                "label": {
                                  "type": "string"
                                },
                                "value": {
                                  "type": [
                                    "number",
                                    "string",
                                    "null"
                                  ]
                                },
                                "unit": {
                                  "type": "string"
                                },
                                "window": {
                                  "type": "object",
                                  "properties": {
                                    "from": {
                                      "type": "string",
                                      "format": "date"
                                    },
                                    "to": {
                                      "type": "string",
                                      "format": "date"
                                    }
                                  },
                                  "required": [
                                    "from",
                                    "to"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "required": [
                                "fact_id",
                                "label",
                                "value",
                                "unit"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "counter_evidence": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "fact_id": {
                                  "type": "string",
                                  "pattern": "^[0-9a-f]{16}$"
                                },
                                "label": {
                                  "type": "string"
                                },
                                "value": {
                                  "type": [
                                    "number",
                                    "string",
                                    "null"
                                  ]
                                },
                                "unit": {
                                  "type": "string"
                                },
                                "window": {
                                  "type": "object",
                                  "properties": {
                                    "from": {
                                      "type": "string",
                                      "format": "date"
                                    },
                                    "to": {
                                      "type": "string",
                                      "format": "date"
                                    }
                                  },
                                  "required": [
                                    "from",
                                    "to"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "required": [
                                "fact_id",
                                "label",
                                "value",
                                "unit"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "limits": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "impact": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "metric": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "low": {
                                    "type": [
                                      "number",
                                      "null"
                                    ]
                                  },
                                  "high": {
                                    "type": [
                                      "number",
                                      "null"
                                    ]
                                  },
                                  "unit": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "horizon_days": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "basis": {
                                    "type": "string",
                                    "enum": [
                                      "estimate",
                                      "bound",
                                      "not_estimable"
                                    ]
                                  },
                                  "fact_ids": {
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "pattern": "^[0-9a-f]{16}$"
                                    }
                                  },
                                  "assumptions": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  }
                                },
                                "required": [
                                  "metric",
                                  "low",
                                  "high",
                                  "unit",
                                  "horizon_days",
                                  "basis",
                                  "fact_ids",
                                  "assumptions"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "confidence": {
                            "type": "string",
                            "enum": [
                              "established",
                              "likely",
                              "hypothesis",
                              "unknown"
                            ]
                          },
                          "confidence_reason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "risk": {
                            "type": "object",
                            "properties": {
                              "level": {
                                "type": "string",
                                "enum": [
                                  "low",
                                  "medium",
                                  "high"
                                ]
                              },
                              "worst_case": {
                                "type": "string"
                              },
                              "exposure_minor": {
                                "anyOf": [
                                  {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "currency": {
                                "type": "string",
                                "pattern": "^[A-Z]{3}$"
                              }
                            },
                            "required": [
                              "level",
                              "worst_case",
                              "exposure_minor",
                              "currency"
                            ],
                            "additionalProperties": false
                          },
                          "effort": {
                            "type": "object",
                            "properties": {
                              "level": {
                                "type": "string",
                                "enum": [
                                  "none",
                                  "minutes",
                                  "hours",
                                  "days"
                                ]
                              },
                              "who": {
                                "type": "string",
                                "minLength": 1
                              },
                              "minutes": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              }
                            },
                            "required": [
                              "level",
                              "who"
                            ],
                            "additionalProperties": false
                          },
                          "reversibility": {
                            "type": "object",
                            "properties": {
                              "level": {
                                "type": "string",
                                "enum": [
                                  "one_click",
                                  "manual",
                                  "none"
                                ]
                              },
                              "window_days": {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 9007199254740991
                              },
                              "how": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "level",
                              "how"
                            ],
                            "additionalProperties": false
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "auto_apply",
                              "approval",
                              "human_task",
                              "hold"
                            ]
                          },
                          "state": {
                            "type": "string",
                            "enum": [
                              "open",
                              "in_progress",
                              "snoozed",
                              "done",
                              "dismissed",
                              "expired",
                              "superseded"
                            ]
                          },
                          "slot": {
                            "type": "string",
                            "enum": [
                              "safety",
                              "top",
                              "queue",
                              "hold"
                            ]
                          },
                          "position": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "severity": {
                            "anyOf": [
                              {
                                "type": "number",
                                "const": 1
                              },
                              {
                                "type": "number",
                                "const": 2
                              },
                              {
                                "type": "number",
                                "const": 3
                              }
                            ]
                          },
                          "prerequisites": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "code": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "state": {
                                  "type": "string",
                                  "enum": [
                                    "met",
                                    "unmet",
                                    "unknown"
                                  ]
                                }
                              },
                              "required": [
                                "code",
                                "state"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "success": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "hypothesis": {
                                    "type": "string"
                                  },
                                  "metric": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "baseline": {
                                    "type": [
                                      "number",
                                      "null"
                                    ]
                                  },
                                  "guardrail": {
                                    "type": "object",
                                    "properties": {
                                      "metric": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "worse_than_pct": {
                                        "type": "number",
                                        "exclusiveMinimum": 0
                                      }
                                    },
                                    "required": [
                                      "metric",
                                      "worse_than_pct"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "review_after_days": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "hypothesis",
                                  "metric",
                                  "baseline",
                                  "guardrail",
                                  "review_after_days"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "action": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "blocked",
                                  "pending",
                                  "approved",
                                  "auto_queued",
                                  "executing",
                                  "done",
                                  "failed",
                                  "unknown",
                                  "rejected",
                                  "expired",
                                  "withdrawn",
                                  "superseded"
                                ]
                              },
                              "requires": {
                                "type": "string",
                                "enum": [
                                  "operator",
                                  "client"
                                ]
                              },
                              "expires_at": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "id",
                              "status",
                              "requires",
                              "expires_at"
                            ],
                            "additionalProperties": false
                          },
                          "finding_ref": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 1
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "before_after": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "before": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "after": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                },
                                "required": [
                                  "before",
                                  "after"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "impact_null_reason": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 1
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "buttons": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "code": {
                                  "type": "string",
                                  "enum": [
                                    "approve",
                                    "not_now",
                                    "ask",
                                    "done",
                                    "snooze",
                                    "too_early",
                                    "undo"
                                  ]
                                },
                                "primary": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "code",
                                "primary"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "next_action": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "identity",
                                      "payment",
                                      "oauth",
                                      "approval",
                                      "wait"
                                    ]
                                  },
                                  "url": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "why": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "resume": {
                                    "type": "string"
                                  },
                                  "poll_after_s": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "kind",
                                  "url",
                                  "why"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "change": {
                            "type": "object",
                            "properties": {
                              "platform": {
                                "type": "string",
                                "enum": [
                                  "google_ads",
                                  "meta_ads"
                                ]
                              },
                              "type": {
                                "type": "string",
                                "enum": [
                                  "ADD_NEGATIVE",
                                  "PAUSE_KEYWORD",
                                  "PAUSE_AD",
                                  "PAUSE_ADSET",
                                  "PAUSE_CAMPAIGN",
                                  "SET_BUDGET",
                                  "SET_MAX_CPC",
                                  "ENABLE_ENTITY",
                                  "SET_NETWORKS",
                                  "SET_GEO_PRESENCE",
                                  "ADD_KEYWORD",
                                  "SET_BID_STRATEGY",
                                  "SET_PLACEMENTS",
                                  "SET_AUDIENCE_OPTION",
                                  "SET_CREATIVE_FEATURES",
                                  "CREATE_CAMPAIGN_DRAFT",
                                  "CREATE_AD_DRAFT",
                                  "LAUNCH_CAMPAIGN"
                                ]
                              },
                              "entity_ref": {
                                "type": "string",
                                "minLength": 1
                              },
                              "direction": {
                                "type": "string",
                                "enum": [
                                  "increase",
                                  "decrease",
                                  "neutral"
                                ]
                              },
                              "from": {},
                              "to": {},
                              "month_projection_minor": {
                                "anyOf": [
                                  {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "monthly_cap_minor": {
                                "anyOf": [
                                  {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "platform",
                              "type",
                              "entity_ref",
                              "direction",
                              "from",
                              "to"
                            ],
                            "additionalProperties": false
                          },
                          "task": {
                            "type": "object",
                            "properties": {
                              "steps": {
                                "type": "array",
                                "items": {}
                              },
                              "draft": {},
                              "target": {},
                              "items": {
                                "type": "array",
                                "items": {}
                              },
                              "measure": {
                                "type": "object",
                                "properties": {
                                  "verdict": {
                                    "type": "string",
                                    "enum": [
                                      "pending",
                                      "counted",
                                      "mixed",
                                      "not_counted"
                                    ]
                                  },
                                  "reason": {
                                    "type": "string",
                                    "enum": [
                                      "no_search_console",
                                      "no_page_to_compare",
                                      "no_ai_tracking"
                                    ]
                                  },
                                  "window_days": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "clicks_before": {
                                    "type": "number",
                                    "minimum": 0
                                  },
                                  "clicks_after": {
                                    "type": "number",
                                    "minimum": 0
                                  }
                                },
                                "required": [
                                  "verdict"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "required": [
                              "steps"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "id",
                          "client_id",
                          "asset_id",
                          "channel",
                          "area",
                          "title",
                          "why_now",
                          "evidence",
                          "counter_evidence",
                          "limits",
                          "impact",
                          "confidence",
                          "confidence_reason",
                          "risk",
                          "effort",
                          "reversibility",
                          "kind",
                          "state",
                          "slot",
                          "position",
                          "prerequisites",
                          "success",
                          "finding_ref",
                          "created_at",
                          "before_after",
                          "impact_null_reason",
                          "buttons",
                          "next_action"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "queue_count": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "did": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "at": {
                            "type": "string"
                          },
                          "text": {
                            "type": "string",
                            "minLength": 1
                          },
                          "actor": {
                            "type": "string",
                            "enum": [
                              "person",
                              "system"
                            ]
                          }
                        },
                        "required": [
                          "at",
                          "text",
                          "actor"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "facts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "metric": {
                            "type": "string"
                          },
                          "asset_id": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "uuid"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "platform": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "value": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "unit": {
                            "type": "string"
                          },
                          "currency": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "undefined_reason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "is_estimate": {
                            "type": "boolean"
                          },
                          "window": {
                            "type": "object",
                            "properties": {
                              "start": {
                                "type": "string"
                              },
                              "end": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "start",
                              "end"
                            ],
                            "additionalProperties": false
                          },
                          "compare_pct": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "fact_id": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "metric",
                          "asset_id",
                          "platform",
                          "value",
                          "unit",
                          "currency",
                          "undefined_reason",
                          "is_estimate",
                          "window",
                          "compare_pct",
                          "fact_id"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "timeline": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "label": {
                            "type": "string",
                            "minLength": 1
                          },
                          "at": {
                            "type": "string"
                          },
                          "state": {
                            "type": "string",
                            "enum": [
                              "next"
                            ]
                          }
                        },
                        "required": [
                          "label",
                          "at",
                          "state"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "banners": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "enum": [
                              "past_due",
                              "restricted",
                              "paused"
                            ]
                          },
                          "text": {
                            "type": "string",
                            "minLength": 1
                          },
                          "url": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": [
                          "kind",
                          "text",
                          "url"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "onboarding_missing": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "country",
                          "service_area",
                          "business_model",
                          "monthly_budget",
                          "lead_response_channel"
                        ]
                      }
                    },
                    "data_as_of": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "account": {
                      "type": "object",
                      "properties": {
                        "credits": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "chat": {
                          "type": "object",
                          "properties": {
                            "remaining": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "limit": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "answer_credits": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "remaining",
                            "limit",
                            "answer_credits"
                          ],
                          "additionalProperties": false
                        },
                        "plan": {
                          "type": "object",
                          "properties": {
                            "tier": {
                              "type": "string"
                            },
                            "trial_ends_at": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "tier",
                            "trial_ends_at"
                          ],
                          "additionalProperties": false
                        },
                        "tracking": {
                          "type": "object",
                          "properties": {
                            "keyword_checks": {
                              "type": "object",
                              "properties": {
                                "used": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                "max": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                }
                              },
                              "required": [
                                "used",
                                "max"
                              ],
                              "additionalProperties": false
                            },
                            "prompt_checks": {
                              "type": "object",
                              "properties": {
                                "used": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                "max": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                }
                              },
                              "required": [
                                "used",
                                "max"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "keyword_checks",
                            "prompt_checks"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "credits",
                        "chat",
                        "plan",
                        "tracking"
                      ],
                      "additionalProperties": false
                    },
                    "locked": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "what": {
                            "type": "string",
                            "enum": [
                              "ads"
                            ]
                          },
                          "price": {
                            "type": "object",
                            "properties": {
                              "amount_minor": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "currency": {
                                "type": "string",
                                "pattern": "^[A-Z]{3}$"
                              },
                              "interval": {
                                "type": "string",
                                "const": "month"
                              }
                            },
                            "required": [
                              "amount_minor",
                              "currency",
                              "interval"
                            ],
                            "additionalProperties": false
                          },
                          "url": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": [
                          "what",
                          "price",
                          "url"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "client_id",
                    "variant",
                    "sources",
                    "headline",
                    "silent",
                    "status",
                    "needs_you",
                    "moves",
                    "queue_count",
                    "did",
                    "facts",
                    "timeline",
                    "banners",
                    "onboarding_missing",
                    "data_as_of",
                    "account",
                    "locked"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/tracking-status": {
      "get": {
        "operationId": "get_tracking_status",
        "summary": "Whether the business is being tracked: waiting for its first check, running, or paused (the month’s data limit is used up, or there is no plan), with the last and next check and how much of the month’s limit is used.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "state": {
                      "type": "string",
                      "enum": [
                        "waiting_first",
                        "running",
                        "paused"
                      ]
                    },
                    "last_check_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "next_check_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "paused_until": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "reason": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "monthly_limit",
                            "no_plan"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "used_share": {
                      "type": "number",
                      "minimum": 0,
                      "maximum": 1
                    },
                    "keyword_every_days": {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991
                    },
                    "prompt_every_days": {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991
                    },
                    "measure": {
                      "type": "object",
                      "properties": {
                        "outcome": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "ok",
                                "partial",
                                "no_credit",
                                "cap_reached",
                                "plan_required",
                                "connection_lost",
                                "provider_error",
                                "paused",
                                "stuck"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "skip_reason": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "ok",
                                "partial",
                                "no_credit",
                                "cap_reached",
                                "plan_required",
                                "connection_lost",
                                "provider_error",
                                "paused",
                                "stuck"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "skip_at": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "collected": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "planned": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "complete": {
                          "type": [
                            "boolean",
                            "null"
                          ]
                        },
                        "at": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "outcome",
                        "skip_reason",
                        "skip_at",
                        "collected",
                        "planned",
                        "complete",
                        "at"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "state",
                    "last_check_at",
                    "next_check_at",
                    "paused_until",
                    "reason",
                    "used_share",
                    "keyword_every_days",
                    "prompt_every_days"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/tracking/suggestions": {
      "get": {
        "operationId": "get_tracking_suggestions",
        "summary": "Searches this business may want to follow and does not yet: the queries Google Search Console shows the site for and the searches its rank checks read where the business ranks, each with its place on Google, its monthly searches when known, the clicks a month it brings (an estimate) and where it came from (`search_console`, `ranking`, or both). Searches that are already followed are left out. `site:` searches, sentences over 80 characters and searches with the business's own name are left out too and counted in `hidden`. Free: it reads stored data. Add one with set_tracked_keywords.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "connected": {
                      "type": "boolean"
                    },
                    "as_of": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "hidden": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "keyword": {
                            "type": "string"
                          },
                          "place": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "searches_per_month": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "est_traffic": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "sources": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "enum": [
                                "search_console",
                                "ranking"
                              ]
                            }
                          }
                        },
                        "required": [
                          "keyword",
                          "place",
                          "searches_per_month",
                          "est_traffic",
                          "sources"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "connected",
                    "as_of",
                    "hidden",
                    "items"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/visibility-share": {
      "get": {
        "operationId": "get_visibility_share",
        "summary": "Each week, the share of the clicks on the searches the business follows that goes to the business and to each rival it follows, weighted by the local searches of each search. A share, not a count of clicks. It reads stored data only.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "as_of": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "rivals": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "domain": {
                            "type": "string"
                          },
                          "name": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "suggested",
                              "tracked"
                            ]
                          }
                        },
                        "required": [
                          "domain",
                          "name",
                          "status"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "weeks": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "week": {
                            "type": "string",
                            "format": "date"
                          },
                          "counted": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "total": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "you": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "rivals": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "domain": {
                                  "type": "string"
                                },
                                "share": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                }
                              },
                              "required": [
                                "domain",
                                "share"
                              ],
                              "additionalProperties": false
                            }
                          }
                        },
                        "required": [
                          "week",
                          "counted",
                          "total",
                          "you",
                          "rivals"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "gap": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "not_collected_yet",
                            "no_volumes"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "as_of",
                    "rivals",
                    "weeks",
                    "gap"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/saved-keywords/import": {
      "post": {
        "operationId": "import_saved_keywords",
        "summary": "Saves pasted keywords (one per line, at most 500 lines of 200 characters; duplicates dropped) to the free list, with an optional tag. With with_numbers it also fetches searches a month, cost per click and difficulty for the saved keywords that have none: 3 credits for one keyword up to 15 for 500, an agent or key sends max_credits. Numbers arrive in a few seconds; read them with list_saved_keywords.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "maxLength": 202000
                  },
                  "tag": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40,
                    "pattern": "^[^\\p{Cc}]*$"
                  },
                  "with_numbers": {
                    "type": "boolean"
                  },
                  "max_credits": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000,
                    "description": "The most credits this call may spend. A call that costs more is refused and nothing is spent. estimate_spend gives the price."
                  }
                },
                "required": [
                  "text"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "added": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "already_saved": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "too_long": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "refused": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "duplicates": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "numbers": {
                      "type": "string",
                      "enum": [
                        "none",
                        "queued"
                      ]
                    },
                    "credits": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "run_id": {
                      "description": "The run behind this call. GET /v1/runs/{run_id}/events streams its progress (server-sent events: run.progress, run.partial, run.deferred, run.done, run.failed). null when no run started.",
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "added",
                    "already_saved",
                    "too_long",
                    "refused",
                    "duplicates",
                    "numbers",
                    "credits",
                    "run_id"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "The credit cap or balance is short (G-COST), or the organization has no paid plan (G-ENTITLEMENT). missing and next_action say what to do.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/campaign-drafts/{draft_id}/launch": {
      "post": {
        "operationId": "launch_campaign",
        "summary": "Proposes to start a campaign that was made paused. Only an owner or an admin, signed in on the panel with a recent confirmation, can ask; the change is then approved on its card.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "draft_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "draft_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "client_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "asset_id": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "platform": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "plan": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "creatives": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "creative_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "status": {
                            "type": "string"
                          },
                          "angle": {
                            "type": "string"
                          },
                          "headlines": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "descriptions": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "brief": {}
                        },
                        "required": [
                          "creative_id",
                          "status",
                          "angle",
                          "headlines",
                          "descriptions",
                          "brief"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "preflight": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "ok": {
                              "type": "boolean"
                            },
                            "checked_at": {
                              "type": "string"
                            },
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "n": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "group": {
                                    "type": "string"
                                  },
                                  "ok": {
                                    "type": "boolean"
                                  },
                                  "why": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "fix": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "n",
                                  "group",
                                  "ok",
                                  "why",
                                  "fix"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "ok",
                            "checked_at",
                            "items"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "delivery": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "looks": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "hours": {
                                    "type": "number"
                                  },
                                  "at": {
                                    "type": "string"
                                  },
                                  "status": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "issues": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  },
                                  "impressions": {
                                    "type": [
                                      "number",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "hours",
                                  "at",
                                  "status",
                                  "issues",
                                  "impressions"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "warnings": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "code": {
                                    "type": "string"
                                  },
                                  "at": {
                                    "type": "string"
                                  },
                                  "message": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "code",
                                  "at",
                                  "message"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "looks",
                            "warnings"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "create_action_id": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "launch_action_id": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "next_step": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "draft_id",
                    "client_id",
                    "asset_id",
                    "platform",
                    "status",
                    "plan",
                    "creatives",
                    "preflight",
                    "delivery",
                    "create_action_id",
                    "launch_action_id",
                    "next_step"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/actions": {
      "get": {
        "operationId": "list_actions",
        "summary": "Returns the recent actions of one business, optionally of one status.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "blocked",
                "pending",
                "approved",
                "auto_queued",
                "executing",
                "done",
                "failed",
                "unknown",
                "rejected",
                "expired",
                "withdrawn",
                "superseded"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "description": "The most rows to return."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "actions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "action_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "client_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "asset_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "platform": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "ADD_NEGATIVE",
                              "PAUSE_KEYWORD",
                              "PAUSE_AD",
                              "PAUSE_ADSET",
                              "PAUSE_CAMPAIGN",
                              "SET_BUDGET",
                              "SET_MAX_CPC",
                              "ENABLE_ENTITY",
                              "SET_NETWORKS",
                              "SET_GEO_PRESENCE",
                              "ADD_KEYWORD",
                              "SET_BID_STRATEGY",
                              "SET_PLACEMENTS",
                              "SET_AUDIENCE_OPTION",
                              "SET_CREATIVE_FEATURES",
                              "CREATE_CAMPAIGN_DRAFT",
                              "CREATE_AD_DRAFT",
                              "LAUNCH_CAMPAIGN"
                            ]
                          },
                          "direction": {
                            "type": "string",
                            "enum": [
                              "increase",
                              "decrease",
                              "neutral"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "blocked",
                              "pending",
                              "approved",
                              "auto_queued",
                              "executing",
                              "done",
                              "failed",
                              "unknown",
                              "rejected",
                              "expired",
                              "withdrawn",
                              "superseded"
                            ]
                          },
                          "reason_codes": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "enum": [
                                "not_enough_data",
                                "too_soon_after_last_change",
                                "over_limit",
                                "cap_required",
                                "cap_would_be_exceeded",
                                "account_paused",
                                "tracking_unhealthy",
                                "stale_data",
                                "conflicts_open_change",
                                "unit_or_scale_suspect",
                                "shared_budget",
                                "drift",
                                "platform_refused",
                                "account_not_enabled",
                                "object_missing",
                                "already_undone",
                                "write_gate_closed",
                                "asset_not_linked",
                                "one_click_required",
                                "autopilot_stopped",
                                "hands_off",
                                "shift_waiting",
                                "area_not_approved"
                              ]
                            }
                          },
                          "approval_level": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "operator",
                                  "owner_admin"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "before": {
                            "anyOf": [
                              {
                                "type": "object",
                                "propertyNames": {
                                  "type": "string"
                                },
                                "additionalProperties": {}
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "after": {
                            "anyOf": [
                              {
                                "type": "object",
                                "propertyNames": {
                                  "type": "string"
                                },
                                "additionalProperties": {}
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "params": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {}
                          },
                          "card_body": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {}
                          },
                          "card_sha256": {
                            "type": "string"
                          },
                          "undo_of": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "uuid"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "undone_by": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "uuid"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "retry_of": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "uuid"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "supersedes": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "uuid"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "is_noop": {
                            "type": "boolean"
                          },
                          "emergency": {
                            "type": "boolean"
                          },
                          "created_at": {
                            "type": "string"
                          },
                          "applied_at": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "expected_current": {
                            "anyOf": [
                              {
                                "type": "object",
                                "propertyNames": {
                                  "type": "string"
                                },
                                "additionalProperties": {}
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "before_after": {
                            "type": "object",
                            "properties": {
                              "before": {
                                "type": "string",
                                "minLength": 1
                              },
                              "after": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "required": [
                              "before",
                              "after"
                            ],
                            "additionalProperties": false
                          },
                          "undo": {
                            "type": "object",
                            "properties": {
                              "possible": {
                                "type": "boolean"
                              },
                              "until": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "note": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "required": [
                              "possible",
                              "until",
                              "note"
                            ],
                            "additionalProperties": false
                          },
                          "note": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "approved_by": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "uuid"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "approved_via": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "panel",
                                  "email_link"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "approved_at": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "currency": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^[A-Z]{3}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "action_id",
                          "client_id",
                          "asset_id",
                          "platform",
                          "type",
                          "direction",
                          "status",
                          "reason_codes",
                          "approval_level",
                          "before",
                          "after",
                          "params",
                          "card_body",
                          "card_sha256",
                          "undo_of",
                          "undone_by",
                          "retry_of",
                          "supersedes",
                          "is_noop",
                          "emergency",
                          "created_at",
                          "applied_at",
                          "expected_current",
                          "before_after",
                          "undo",
                          "note",
                          "approved_by",
                          "approved_via",
                          "approved_at",
                          "currency"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "actions"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/research/backlinks/list": {
      "post": {
        "operationId": "list_backlinks",
        "summary": "One list of the links to a site, page or folder, the strongest first: `view` is referring_domains (sites that link), backlinks (each link with its words and whether it follows), top_pages (the pages with most links), new or lost (links first seen, or last seen before they went, in the last 30 days). Up to 100 rows. Costs 6 credits: an agent or key sends max_credits. Nothing is charged when the list is empty.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Optional. Send the same value to repeat this paid call without paying twice; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused). The CLI sends one made from the request.",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "target": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 300
                  },
                  "scope": {
                    "default": "domain",
                    "type": "string",
                    "enum": [
                      "page",
                      "folder",
                      "domain",
                      "subdomains"
                    ]
                  },
                  "max_credits": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000,
                    "description": "The most credits this call may spend. A call that costs more is refused and nothing is spent. estimate_spend gives the price."
                  },
                  "view": {
                    "type": "string",
                    "enum": [
                      "referring_domains",
                      "backlinks",
                      "top_pages",
                      "new",
                      "lost"
                    ]
                  },
                  "limit": {
                    "default": 25,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "description": "The most rows to return."
                  }
                },
                "required": [
                  "view"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "target": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string",
                      "enum": [
                        "page",
                        "folder",
                        "domain",
                        "subdomains"
                      ]
                    },
                    "view": {
                      "type": "string",
                      "enum": [
                        "referring_domains",
                        "backlinks",
                        "top_pages",
                        "new",
                        "lost"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "referring_domains": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "domain": {
                            "type": "string"
                          },
                          "authority": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "backlinks": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "first_seen": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "domain",
                          "authority",
                          "backlinks",
                          "first_seen"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "backlinks": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "from_domain": {
                            "type": "string"
                          },
                          "from_url": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "to_url": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "anchor": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "follow": {
                            "type": "boolean"
                          },
                          "authority": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "first_seen": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "last_seen": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "from_domain",
                          "from_url",
                          "to_url",
                          "anchor",
                          "follow",
                          "authority",
                          "first_seen",
                          "last_seen"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "top_pages": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "page": {
                            "type": "string"
                          },
                          "backlinks": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "referring_domains": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "authority": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "page",
                          "backlinks",
                          "referring_domains",
                          "authority"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "credits": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "balance": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "target",
                    "scope",
                    "view",
                    "total",
                    "referring_domains",
                    "backlinks",
                    "top_pages",
                    "credits",
                    "balance"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "The credit cap or balance is short (G-COST), or the organization has no paid plan (G-ENTITLEMENT). missing and next_action say what to do.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/research/branch-candidates": {
      "post": {
        "operationId": "list_branch_candidates",
        "summary": "Finds the places of this business on Google Maps in its country (or in `country`) by its name: up to 20 listings with name, address, rating, category, point on the map, Google listing id and `likely_yours` (the listing's name starts with the business's name). `saved` says which are already branches. Pick the ones that are yours and send each to save_branch. Phone numbers, owners and review texts are not returned or kept. Costs 1 credit: an agent or key sends max_credits. Nothing is charged when nothing is found.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Optional. Send the same value to repeat this paid call without paying twice; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused). The CLI sends one made from the request.",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "country": {
                    "type": "string",
                    "pattern": "^[A-Za-z]{2}$"
                  },
                  "max_credits": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000,
                    "description": "The most credits this call may spend. A call that costs more is refused and nothing is spent. estimate_spend gives the price."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "country": {
                      "type": "string"
                    },
                    "candidates": {
                      "maxItems": 20,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "address": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "rating": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "votes": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "category": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "lat": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "lng": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "cid": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "place_id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "likely_yours": {
                            "type": "boolean"
                          },
                          "saved": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "name",
                          "address",
                          "rating",
                          "votes",
                          "category",
                          "lat",
                          "lng",
                          "cid",
                          "place_id",
                          "likely_yours",
                          "saved"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "credits": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "balance": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "country",
                    "candidates",
                    "credits",
                    "balance"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "The credit cap or balance is short (G-COST), or the organization has no paid plan (G-ENTITLEMENT). missing and next_action say what to do.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/chats": {
      "get": {
        "operationId": "list_chats",
        "summary": "Lists your chats for one business, newest first, and how many chat answers are left this month: `remaining`, the monthly `limit` and `answer_credits`, what one answer costs.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "chats": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "title": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "updated": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "title",
                          "updated"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "remaining": {
                      "type": "number"
                    },
                    "limit": {
                      "type": "number"
                    },
                    "answer_credits": {
                      "type": "number"
                    },
                    "credit_threshold": {
                      "type": "number"
                    },
                    "trial_ask": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "questions": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "remaining": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "until": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "questions",
                            "remaining",
                            "until"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "chats",
                    "remaining",
                    "limit",
                    "answer_credits",
                    "credit_threshold",
                    "trial_ask"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients": {
      "get": {
        "operationId": "list_clients",
        "summary": "Lists the businesses this credential reaches, with the id every other tool asks for.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "clients": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "name": {
                            "type": "string"
                          },
                          "mode": {
                            "type": "string",
                            "enum": [
                              "guide",
                              "autopilot"
                            ]
                          },
                          "country": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "language": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "mode",
                          "country",
                          "language"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "clients"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/connections": {
      "get": {
        "operationId": "list_connections",
        "summary": "List the platform connections of the organization.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "connections": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "platform": {
                            "type": "string",
                            "enum": [
                              "google_ads",
                              "meta_ads",
                              "gsc",
                              "ga4",
                              "merchant",
                              "linkedin_ads",
                              "shopify",
                              "hubspot",
                              "pipedrive"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "oauth_received",
                              "active",
                              "error",
                              "revoked"
                            ]
                          },
                          "auth_kind": {
                            "type": "string",
                            "enum": [
                              "oauth",
                              "owner_env",
                              "service_account"
                            ]
                          },
                          "granted_scopes": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "connected_at": {
                            "type": "string"
                          },
                          "last_ok_at": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "error_since": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "last_error_code": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "account_count": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "id",
                          "platform",
                          "status",
                          "auth_kind",
                          "granted_scopes",
                          "connected_at",
                          "last_ok_at",
                          "error_since",
                          "last_error_code",
                          "account_count"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "connectable": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "google_ads",
                          "meta_ads",
                          "gsc",
                          "ga4",
                          "merchant",
                          "linkedin_ads",
                          "shopify",
                          "hubspot",
                          "pipedrive"
                        ]
                      }
                    }
                  },
                  "required": [
                    "connections",
                    "connectable"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/findings": {
      "get": {
        "operationId": "list_findings",
        "summary": "Lists the current findings of one business, most important first: what the analysis saw, with the numbers behind it.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "channel",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "google_ads",
                "meta_ads",
                "openai_ads",
                "linkedin_ads",
                "seo",
                "geo",
                "site",
                "tracking",
                "cross"
              ]
            }
          },
          {
            "name": "lifecycle",
            "in": "query",
            "required": false,
            "schema": {
              "default": "open",
              "type": "string",
              "enum": [
                "open",
                "dismissed",
                "resolved"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 20,
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "description": "The most rows to return."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "finding_ref": {
                            "type": "string"
                          },
                          "client_id": {
                            "type": "string"
                          },
                          "channel": {
                            "type": "string",
                            "enum": [
                              "google_ads",
                              "meta_ads",
                              "openai_ads",
                              "linkedin_ads",
                              "seo",
                              "geo",
                              "site",
                              "tracking",
                              "cross"
                            ]
                          },
                          "area": {
                            "type": "string",
                            "enum": [
                              "preflight",
                              "tracking",
                              "waste",
                              "search_terms",
                              "bidding",
                              "budget",
                              "placement",
                              "targeting",
                              "lead_quality",
                              "landing_page",
                              "structure",
                              "creative",
                              "platform_change",
                              "seo",
                              "geo",
                              "competitor"
                            ]
                          },
                          "severity": {
                            "type": "number"
                          },
                          "safety": {
                            "type": "boolean"
                          },
                          "priority": {
                            "type": "number"
                          },
                          "entity": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "level": {
                                    "type": "string"
                                  },
                                  "id": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "level",
                                  "id",
                                  "label"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "lifecycle": {
                            "type": "string"
                          },
                          "certainty": {
                            "type": "string",
                            "enum": [
                              "established",
                              "likely",
                              "hypothesis",
                              "unknown"
                            ]
                          },
                          "window": {
                            "type": "object",
                            "properties": {
                              "start": {
                                "type": "string"
                              },
                              "end": {
                                "type": "string"
                              },
                              "timezone": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "start",
                              "end",
                              "timezone"
                            ],
                            "additionalProperties": false
                          },
                          "lang": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "summary": {
                            "type": "string"
                          },
                          "claims": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "claim_id": {
                                  "type": "string"
                                },
                                "kind": {
                                  "type": "string"
                                },
                                "text": {
                                  "type": "string"
                                },
                                "certainty": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "claim_id",
                                "kind",
                                "text",
                                "certainty"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "facts": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "fact_id": {
                                  "type": "string"
                                },
                                "label": {
                                  "type": "string"
                                },
                                "value": {
                                  "type": [
                                    "number",
                                    "string",
                                    "null"
                                  ]
                                },
                                "unit": {
                                  "type": "string"
                                },
                                "window": {
                                  "type": "object",
                                  "properties": {
                                    "from": {
                                      "type": "string"
                                    },
                                    "to": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "from",
                                    "to"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "required": [
                                "fact_id",
                                "label",
                                "value",
                                "unit"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "counter_facts": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "fact_id": {
                                  "type": "string"
                                },
                                "label": {
                                  "type": "string"
                                },
                                "value": {
                                  "type": [
                                    "number",
                                    "string",
                                    "null"
                                  ]
                                },
                                "unit": {
                                  "type": "string"
                                },
                                "window": {
                                  "type": "object",
                                  "properties": {
                                    "from": {
                                      "type": "string"
                                    },
                                    "to": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "from",
                                    "to"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "required": [
                                "fact_id",
                                "label",
                                "value",
                                "unit"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "limits": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "money": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string"
                                  },
                                  "fact_id": {
                                    "type": "string"
                                  },
                                  "currency": {
                                    "type": "string"
                                  },
                                  "basis": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "fact_id",
                                  "currency",
                                  "basis"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "alternatives": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "text": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "text"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "questions": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "question_key": {
                                  "type": "string"
                                },
                                "text": {
                                  "type": "string"
                                },
                                "why": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "question_key",
                                "text",
                                "why"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "do_not": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "key": {
                                  "type": "string"
                                },
                                "text": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "key",
                                "text"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "suggested": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "type"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "data_as_of": {
                            "type": "string"
                          },
                          "stale_after": {
                            "type": "string"
                          },
                          "first_seen_at": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "finding_ref",
                          "client_id",
                          "channel",
                          "area",
                          "severity",
                          "safety",
                          "priority",
                          "entity",
                          "lifecycle",
                          "certainty",
                          "window",
                          "lang",
                          "title",
                          "summary",
                          "claims",
                          "facts",
                          "counter_facts",
                          "limits",
                          "money",
                          "alternatives",
                          "questions",
                          "do_not",
                          "suggested",
                          "data_as_of",
                          "stale_after",
                          "first_seen_at"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/locations": {
      "get": {
        "operationId": "list_locations",
        "summary": "Searches the Google locations (cities, regions) of a country by name, for the place field of a search. Free. ready: false means the country's list is not fetched yet: call fetch_locations once, then ask again in a few seconds.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "country",
            "in": "query",
            "required": true,
            "schema": {
              "description": "Two-letter country code, for example CH. Required.",
              "type": "string",
              "maxLength": 8
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 80
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 20,
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "description": "The most rows to return."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ready": {
                      "type": "boolean"
                    },
                    "country": {
                      "type": "string"
                    },
                    "locations": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "code": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "name": {
                            "type": "string"
                          },
                          "region": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "country",
                              "region",
                              "city",
                              "other"
                            ]
                          }
                        },
                        "required": [
                          "code",
                          "name",
                          "region",
                          "kind"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "ready",
                    "country",
                    "locations"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/notifications": {
      "get": {
        "operationId": "list_notifications",
        "summary": "Lists your notifications, newest first, and how many are unread (`unread`, all of them, not only the ones listed). An agent reads the notifications of the person who connected it.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "unread",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 30,
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "description": "The most rows to return."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string"
                          },
                          "client_id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "body": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {}
                          },
                          "read_at": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "created_at": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "kind",
                          "client_id",
                          "body",
                          "read_at",
                          "created_at"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "unread": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "items",
                    "unread"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/prices": {
      "get": {
        "operationId": "list_prices",
        "summary": "The prices on sale now: plans, extra domains, the trial fee and top-ups, with the length of the trial.",
        "x-stability": "stable",
        "security": [
          {},
          {
            "bearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "prices": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "price_key": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string"
                          },
                          "interval": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "usd_cents": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "credits": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "price_key",
                          "kind",
                          "interval",
                          "usd_cents",
                          "credits"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "currency": {
                      "type": "string",
                      "const": "USD"
                    },
                    "exponent": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "trial_days": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "trial_ask_questions": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "self_serve": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "prices",
                    "currency",
                    "exponent",
                    "trial_days",
                    "trial_ask_questions",
                    "self_serve"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/recommendations": {
      "get": {
        "operationId": "list_recommendations",
        "summary": "Lists the recommendation cards of one business in screen order. Filter by kind (approval, human_task, hold), slot or state. Done cards come newest first.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "auto_apply",
                "approval",
                "human_task",
                "hold"
              ]
            }
          },
          {
            "name": "slot",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "safety",
                "top",
                "queue",
                "hold"
              ]
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "default": "active",
              "type": "string",
              "enum": [
                "open",
                "in_progress",
                "snoozed",
                "done",
                "dismissed",
                "expired",
                "superseded",
                "active"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "description": "The most rows to return."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "client_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "asset_id": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "uuid"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "channel": {
                            "type": "string",
                            "enum": [
                              "google_ads",
                              "meta_ads",
                              "openai_ads",
                              "linkedin_ads",
                              "seo",
                              "geo",
                              "site",
                              "tracking",
                              "cross"
                            ]
                          },
                          "area": {
                            "type": "string",
                            "enum": [
                              "preflight",
                              "tracking",
                              "waste",
                              "search_terms",
                              "bidding",
                              "budget",
                              "placement",
                              "targeting",
                              "lead_quality",
                              "landing_page",
                              "structure",
                              "creative",
                              "platform_change",
                              "seo",
                              "geo",
                              "competitor"
                            ]
                          },
                          "title": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 90
                          },
                          "why_now": {
                            "type": "object",
                            "properties": {
                              "trigger": {
                                "type": "string",
                                "enum": [
                                  "new",
                                  "threshold_crossed",
                                  "window_matured",
                                  "season",
                                  "platform_change",
                                  "user_ask"
                                ]
                              },
                              "since": {
                                "type": "string",
                                "format": "date"
                              },
                              "text": {
                                "type": "string",
                                "minLength": 1
                              },
                              "delay_cost": {
                                "type": "object",
                                "properties": {
                                  "amount_minor": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "currency": {
                                    "type": "string",
                                    "pattern": "^[A-Z]{3}$"
                                  },
                                  "per": {
                                    "type": "string",
                                    "enum": [
                                      "day",
                                      "week",
                                      "month"
                                    ]
                                  },
                                  "is_estimate": {
                                    "type": "boolean"
                                  }
                                },
                                "required": [
                                  "amount_minor",
                                  "currency",
                                  "per",
                                  "is_estimate"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "required": [
                              "trigger",
                              "since",
                              "text"
                            ],
                            "additionalProperties": false
                          },
                          "evidence": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "fact_id": {
                                  "type": "string",
                                  "pattern": "^[0-9a-f]{16}$"
                                },
                                "label": {
                                  "type": "string"
                                },
                                "value": {
                                  "type": [
                                    "number",
                                    "string",
                                    "null"
                                  ]
                                },
                                "unit": {
                                  "type": "string"
                                },
                                "window": {
                                  "type": "object",
                                  "properties": {
                                    "from": {
                                      "type": "string",
                                      "format": "date"
                                    },
                                    "to": {
                                      "type": "string",
                                      "format": "date"
                                    }
                                  },
                                  "required": [
                                    "from",
                                    "to"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "required": [
                                "fact_id",
                                "label",
                                "value",
                                "unit"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "counter_evidence": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "fact_id": {
                                  "type": "string",
                                  "pattern": "^[0-9a-f]{16}$"
                                },
                                "label": {
                                  "type": "string"
                                },
                                "value": {
                                  "type": [
                                    "number",
                                    "string",
                                    "null"
                                  ]
                                },
                                "unit": {
                                  "type": "string"
                                },
                                "window": {
                                  "type": "object",
                                  "properties": {
                                    "from": {
                                      "type": "string",
                                      "format": "date"
                                    },
                                    "to": {
                                      "type": "string",
                                      "format": "date"
                                    }
                                  },
                                  "required": [
                                    "from",
                                    "to"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "required": [
                                "fact_id",
                                "label",
                                "value",
                                "unit"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "limits": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "impact": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "metric": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "low": {
                                    "type": [
                                      "number",
                                      "null"
                                    ]
                                  },
                                  "high": {
                                    "type": [
                                      "number",
                                      "null"
                                    ]
                                  },
                                  "unit": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "horizon_days": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "basis": {
                                    "type": "string",
                                    "enum": [
                                      "estimate",
                                      "bound",
                                      "not_estimable"
                                    ]
                                  },
                                  "fact_ids": {
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "pattern": "^[0-9a-f]{16}$"
                                    }
                                  },
                                  "assumptions": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  }
                                },
                                "required": [
                                  "metric",
                                  "low",
                                  "high",
                                  "unit",
                                  "horizon_days",
                                  "basis",
                                  "fact_ids",
                                  "assumptions"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "confidence": {
                            "type": "string",
                            "enum": [
                              "established",
                              "likely",
                              "hypothesis",
                              "unknown"
                            ]
                          },
                          "confidence_reason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "risk": {
                            "type": "object",
                            "properties": {
                              "level": {
                                "type": "string",
                                "enum": [
                                  "low",
                                  "medium",
                                  "high"
                                ]
                              },
                              "worst_case": {
                                "type": "string"
                              },
                              "exposure_minor": {
                                "anyOf": [
                                  {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "currency": {
                                "type": "string",
                                "pattern": "^[A-Z]{3}$"
                              }
                            },
                            "required": [
                              "level",
                              "worst_case",
                              "exposure_minor",
                              "currency"
                            ],
                            "additionalProperties": false
                          },
                          "effort": {
                            "type": "object",
                            "properties": {
                              "level": {
                                "type": "string",
                                "enum": [
                                  "none",
                                  "minutes",
                                  "hours",
                                  "days"
                                ]
                              },
                              "who": {
                                "type": "string",
                                "minLength": 1
                              },
                              "minutes": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              }
                            },
                            "required": [
                              "level",
                              "who"
                            ],
                            "additionalProperties": false
                          },
                          "reversibility": {
                            "type": "object",
                            "properties": {
                              "level": {
                                "type": "string",
                                "enum": [
                                  "one_click",
                                  "manual",
                                  "none"
                                ]
                              },
                              "window_days": {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 9007199254740991
                              },
                              "how": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "level",
                              "how"
                            ],
                            "additionalProperties": false
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "auto_apply",
                              "approval",
                              "human_task",
                              "hold"
                            ]
                          },
                          "state": {
                            "type": "string",
                            "enum": [
                              "open",
                              "in_progress",
                              "snoozed",
                              "done",
                              "dismissed",
                              "expired",
                              "superseded"
                            ]
                          },
                          "slot": {
                            "type": "string",
                            "enum": [
                              "safety",
                              "top",
                              "queue",
                              "hold"
                            ]
                          },
                          "position": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "severity": {
                            "anyOf": [
                              {
                                "type": "number",
                                "const": 1
                              },
                              {
                                "type": "number",
                                "const": 2
                              },
                              {
                                "type": "number",
                                "const": 3
                              }
                            ]
                          },
                          "prerequisites": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "code": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "state": {
                                  "type": "string",
                                  "enum": [
                                    "met",
                                    "unmet",
                                    "unknown"
                                  ]
                                }
                              },
                              "required": [
                                "code",
                                "state"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "success": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "hypothesis": {
                                    "type": "string"
                                  },
                                  "metric": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "baseline": {
                                    "type": [
                                      "number",
                                      "null"
                                    ]
                                  },
                                  "guardrail": {
                                    "type": "object",
                                    "properties": {
                                      "metric": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "worse_than_pct": {
                                        "type": "number",
                                        "exclusiveMinimum": 0
                                      }
                                    },
                                    "required": [
                                      "metric",
                                      "worse_than_pct"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "review_after_days": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "hypothesis",
                                  "metric",
                                  "baseline",
                                  "guardrail",
                                  "review_after_days"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "action": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "blocked",
                                  "pending",
                                  "approved",
                                  "auto_queued",
                                  "executing",
                                  "done",
                                  "failed",
                                  "unknown",
                                  "rejected",
                                  "expired",
                                  "withdrawn",
                                  "superseded"
                                ]
                              },
                              "requires": {
                                "type": "string",
                                "enum": [
                                  "operator",
                                  "client"
                                ]
                              },
                              "expires_at": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "format": "date-time"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "id",
                              "status",
                              "requires",
                              "expires_at"
                            ],
                            "additionalProperties": false
                          },
                          "finding_ref": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 1
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "before_after": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "before": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "after": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                },
                                "required": [
                                  "before",
                                  "after"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "impact_null_reason": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 1
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "buttons": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "code": {
                                  "type": "string",
                                  "enum": [
                                    "approve",
                                    "not_now",
                                    "ask",
                                    "done",
                                    "snooze",
                                    "too_early",
                                    "undo"
                                  ]
                                },
                                "primary": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "code",
                                "primary"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "next_action": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "identity",
                                      "payment",
                                      "oauth",
                                      "approval",
                                      "wait"
                                    ]
                                  },
                                  "url": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "why": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "resume": {
                                    "type": "string"
                                  },
                                  "poll_after_s": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "kind",
                                  "url",
                                  "why"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "change": {
                            "type": "object",
                            "properties": {
                              "platform": {
                                "type": "string",
                                "enum": [
                                  "google_ads",
                                  "meta_ads"
                                ]
                              },
                              "type": {
                                "type": "string",
                                "enum": [
                                  "ADD_NEGATIVE",
                                  "PAUSE_KEYWORD",
                                  "PAUSE_AD",
                                  "PAUSE_ADSET",
                                  "PAUSE_CAMPAIGN",
                                  "SET_BUDGET",
                                  "SET_MAX_CPC",
                                  "ENABLE_ENTITY",
                                  "SET_NETWORKS",
                                  "SET_GEO_PRESENCE",
                                  "ADD_KEYWORD",
                                  "SET_BID_STRATEGY",
                                  "SET_PLACEMENTS",
                                  "SET_AUDIENCE_OPTION",
                                  "SET_CREATIVE_FEATURES",
                                  "CREATE_CAMPAIGN_DRAFT",
                                  "CREATE_AD_DRAFT",
                                  "LAUNCH_CAMPAIGN"
                                ]
                              },
                              "entity_ref": {
                                "type": "string",
                                "minLength": 1
                              },
                              "direction": {
                                "type": "string",
                                "enum": [
                                  "increase",
                                  "decrease",
                                  "neutral"
                                ]
                              },
                              "from": {},
                              "to": {},
                              "month_projection_minor": {
                                "anyOf": [
                                  {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "monthly_cap_minor": {
                                "anyOf": [
                                  {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "platform",
                              "type",
                              "entity_ref",
                              "direction",
                              "from",
                              "to"
                            ],
                            "additionalProperties": false
                          },
                          "task": {
                            "type": "object",
                            "properties": {
                              "steps": {
                                "type": "array",
                                "items": {}
                              },
                              "draft": {},
                              "target": {},
                              "items": {
                                "type": "array",
                                "items": {}
                              },
                              "measure": {
                                "type": "object",
                                "properties": {
                                  "verdict": {
                                    "type": "string",
                                    "enum": [
                                      "pending",
                                      "counted",
                                      "mixed",
                                      "not_counted"
                                    ]
                                  },
                                  "reason": {
                                    "type": "string",
                                    "enum": [
                                      "no_search_console",
                                      "no_page_to_compare",
                                      "no_ai_tracking"
                                    ]
                                  },
                                  "window_days": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "clicks_before": {
                                    "type": "number",
                                    "minimum": 0
                                  },
                                  "clicks_after": {
                                    "type": "number",
                                    "minimum": 0
                                  }
                                },
                                "required": [
                                  "verdict"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "required": [
                              "steps"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "id",
                          "client_id",
                          "asset_id",
                          "channel",
                          "area",
                          "title",
                          "why_now",
                          "evidence",
                          "counter_evidence",
                          "limits",
                          "impact",
                          "confidence",
                          "confidence_reason",
                          "risk",
                          "effort",
                          "reversibility",
                          "kind",
                          "state",
                          "slot",
                          "position",
                          "prerequisites",
                          "success",
                          "finding_ref",
                          "created_at",
                          "before_after",
                          "impact_null_reason",
                          "buttons",
                          "next_action"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/saved-keywords": {
      "get": {
        "operationId": "list_saved_keywords",
        "summary": "The keywords a business saved (a free list apart from tracking), with the numbers saved with them (intent_source says where the intent came from: market_data is measured search data, estimate is an AI estimate for a keyword that data had none for) and their tags, plus every tag with its count. Filter by tag, by \"no tag\" or by a word; sort by date, keyword, searches, cost per click or difficulty.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "tag",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 40,
              "pattern": "^[^\\p{Cc}]*$"
            }
          },
          {
            "name": "untagged",
            "in": "query",
            "required": false,
            "schema": {
              "type": [
                "boolean",
                "string"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "default": "saved_at",
              "type": "string",
              "enum": [
                "saved_at",
                "keyword",
                "volume",
                "cpc",
                "difficulty"
              ]
            }
          },
          {
            "name": "dir",
            "in": "query",
            "required": false,
            "schema": {
              "default": "desc",
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 100,
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "description": "The most rows to return."
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "default": 0,
              "type": "integer",
              "minimum": 0,
              "maximum": 10000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "total": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "untagged": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "matched": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "tags": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "count": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "name",
                          "count"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "keywords": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "keyword": {
                            "type": "string"
                          },
                          "volume": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "cpc_usd": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "competition": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "difficulty": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "intent": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "intent_source": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "market_data",
                                  "estimate"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "saved_at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "numbers_at": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "tags": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "keyword",
                          "volume",
                          "cpc_usd",
                          "competition",
                          "difficulty",
                          "intent",
                          "intent_source",
                          "saved_at",
                          "numbers_at",
                          "tags"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "total",
                    "untagged",
                    "matched",
                    "tags",
                    "keywords"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "save_keywords",
        "summary": "Saves keywords to the business's free list, with the numbers the caller already has (searches a month, cost per click, competition, difficulty, intent), and an optional tag. Costs nothing and starts no tracking check. A keyword already saved keeps its date and takes the tag.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "keywords": {
                    "minItems": 1,
                    "maxItems": 500,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "keyword": {
                          "type": "string",
                          "maxLength": 800
                        },
                        "volume": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 1000000000
                        },
                        "cpc_usd": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1000000000
                        },
                        "competition": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1
                        },
                        "difficulty": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 100
                        },
                        "intent": {
                          "type": "string",
                          "maxLength": 40
                        }
                      },
                      "required": [
                        "keyword"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "tag": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40,
                    "pattern": "^[^\\p{Cc}]*$"
                  }
                },
                "required": [
                  "keywords"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "added": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "already_saved": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "too_long": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "refused": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "tagged": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "added",
                    "already_saved",
                    "too_long",
                    "refused",
                    "tagged"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "tag_saved_keywords",
        "summary": "Adds a tag to saved keywords, or takes one off them (send add or remove, not both). A tag is a list; it exists while a keyword carries it. Keywords that are not saved are ignored.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "keywords": {
                    "minItems": 1,
                    "maxItems": 500,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 800
                    }
                  },
                  "add": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40,
                    "pattern": "^[^\\p{Cc}]*$"
                  },
                  "remove": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40,
                    "pattern": "^[^\\p{Cc}]*$"
                  }
                },
                "required": [
                  "keywords"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "changed": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "changed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/tasks": {
      "get": {
        "operationId": "list_tasks",
        "summary": "Lists the tasks of one business: fixes to apply, pages to write and to-dos, open ones first.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "open",
                "done",
                "postponed",
                "rejected"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 100,
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "description": "The most rows to return."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string"
                          },
                          "text": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "open",
                              "done",
                              "postponed",
                              "rejected"
                            ]
                          },
                          "evidence": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "due_at": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "done_at": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "created_at": {
                            "type": "string"
                          },
                          "key": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "recommendation_id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "detail": {
                            "anyOf": [
                              {
                                "type": "object",
                                "propertyNames": {
                                  "type": "string"
                                },
                                "additionalProperties": {}
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "changed_by": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "person",
                                  "agent",
                                  "key",
                                  "system"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "source": {
                            "type": "string"
                          },
                          "snoozed_until": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "reject_code": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "kind",
                          "text",
                          "status",
                          "evidence",
                          "due_at",
                          "done_at",
                          "created_at",
                          "key",
                          "recommendation_id",
                          "detail",
                          "changed_by",
                          "source",
                          "snoozed_until",
                          "reject_code"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/tracking": {
      "get": {
        "operationId": "list_tracking",
        "summary": "Lists the searches (each with the search engines it is read on: google, bing, yahoo, and the place and device it is read for), the AI-assistant questions (each with the assistants it is asked on) and the rivals this business follows every week, with the checks one round of its plan covers and how many are used (`limits.keyword_every_days` and `prompt_every_days` say how many days a round lasts). A check is one search on one engine, or one question on one assistant. A rival is suggested until the business confirms it.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "keywords": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "text": {
                            "type": "string"
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "scan",
                              "customer"
                            ]
                          },
                          "added_at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "engines": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "location_code": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "device": {
                            "type": "string",
                            "enum": [
                              "desktop",
                              "mobile",
                              "both"
                            ]
                          },
                          "first_read": {
                            "type": "string",
                            "enum": [
                              "done",
                              "soon",
                              "monday"
                            ]
                          }
                        },
                        "required": [
                          "text",
                          "source",
                          "added_at",
                          "engines",
                          "location_code",
                          "device",
                          "first_read"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "prompts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "text": {
                            "type": "string"
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "scan",
                              "customer"
                            ]
                          },
                          "added_at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "engines": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "topic": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "paused": {
                            "type": "boolean"
                          },
                          "branded": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "text",
                          "source",
                          "added_at",
                          "engines",
                          "topic",
                          "paused",
                          "branded"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "limits": {
                      "type": "object",
                      "properties": {
                        "keywords": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "prompts": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "engines": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "competitors": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "keyword_every_days": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        "prompt_every_days": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        "keyword_checks": {
                          "type": "object",
                          "properties": {
                            "used": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "max": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "used",
                            "max"
                          ],
                          "additionalProperties": false
                        },
                        "prompt_checks": {
                          "type": "object",
                          "properties": {
                            "used": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "max": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "used",
                            "max"
                          ],
                          "additionalProperties": false
                        },
                        "keyword_engines": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "prompt_engines": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "addons": {
                          "type": "object",
                          "properties": {
                            "active": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "keyword_checks",
                                      "grid_checks"
                                    ]
                                  },
                                  "checks": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "expires_at": {
                                    "type": "string",
                                    "format": "date-time"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "checks",
                                  "expires_at"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "offers": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "keyword_checks",
                                      "grid_checks"
                                    ]
                                  },
                                  "checks": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "credits": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "days": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "kind",
                                  "checks",
                                  "credits",
                                  "days"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "active",
                            "offers"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "keywords",
                        "prompts",
                        "engines",
                        "competitors",
                        "keyword_every_days",
                        "prompt_every_days",
                        "keyword_checks",
                        "prompt_checks",
                        "keyword_engines",
                        "prompt_engines",
                        "addons"
                      ],
                      "additionalProperties": false
                    },
                    "competitors": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "domain": {
                                "type": "string"
                              },
                              "name": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "source": {
                                "type": "string",
                                "enum": [
                                  "scan",
                                  "customer"
                                ]
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "suggested",
                                  "tracked"
                                ]
                              }
                            },
                            "required": [
                              "domain",
                              "name",
                              "source",
                              "status"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "limit": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "edited": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "items",
                        "limit",
                        "edited"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "keywords",
                    "prompts",
                    "limits",
                    "competitors"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/decisions/{decision_id}/action": {
      "post": {
        "operationId": "log_action",
        "summary": "Records whether a logged decision was applied, skipped, failed or rolled back.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "decision_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "applied",
                      "not_applied",
                      "failed",
                      "rolled_back"
                    ]
                  },
                  "before": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "after": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  }
                },
                "required": [
                  "status"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "decision_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "status": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "decision_id",
                    "status"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/decisions": {
      "post": {
        "operationId": "log_decision",
        "summary": "Records a decision made outside the action flow. A repeat with the same external_ref returns the first.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "channel": {
                    "type": "string",
                    "enum": [
                      "google_ads",
                      "meta_ads",
                      "openai_ads",
                      "linkedin_ads",
                      "seo",
                      "geo",
                      "site",
                      "tracking",
                      "cross"
                    ]
                  },
                  "change_type": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 60
                  },
                  "campaign_id": {
                    "type": "string",
                    "maxLength": 40
                  },
                  "external_ref": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "verdict": {
                    "type": "string",
                    "enum": [
                      "approved",
                      "rejected",
                      "modified",
                      "not_asked"
                    ]
                  }
                },
                "required": [
                  "channel",
                  "change_type",
                  "external_ref"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "decision_id": {
                      "type": "string",
                      "format": "uuid"
                    }
                  },
                  "required": [
                    "decision_id"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/decisions/{decision_id}/outcome": {
      "post": {
        "operationId": "log_outcome",
        "summary": "Records the metrics of the window before and after an applied decision.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "decision_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "window_days": {
                    "type": "integer",
                    "minimum": 7,
                    "maximum": 30
                  },
                  "baseline": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "after": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  }
                },
                "required": [
                  "window_days",
                  "baseline",
                  "after"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "decision_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "window_days": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "decision_id",
                    "window_days"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/tracking/questions/pause": {
      "post": {
        "operationId": "pause_tracked_question",
        "summary": "Pauses one tracked question: it stays on the list with its answers so far, is not asked from the next round and costs no check. Resume it with resume_tracked_question.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 400
                  }
                },
                "required": [
                  "text"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "keywords": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "text": {
                            "type": "string"
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "scan",
                              "customer"
                            ]
                          },
                          "added_at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "engines": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "location_code": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "device": {
                            "type": "string",
                            "enum": [
                              "desktop",
                              "mobile",
                              "both"
                            ]
                          },
                          "first_read": {
                            "type": "string",
                            "enum": [
                              "done",
                              "soon",
                              "monday"
                            ]
                          }
                        },
                        "required": [
                          "text",
                          "source",
                          "added_at",
                          "engines",
                          "location_code",
                          "device",
                          "first_read"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "prompts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "text": {
                            "type": "string"
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "scan",
                              "customer"
                            ]
                          },
                          "added_at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "engines": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "topic": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "paused": {
                            "type": "boolean"
                          },
                          "branded": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "text",
                          "source",
                          "added_at",
                          "engines",
                          "topic",
                          "paused",
                          "branded"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "limits": {
                      "type": "object",
                      "properties": {
                        "keywords": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "prompts": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "engines": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "competitors": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "keyword_every_days": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        "prompt_every_days": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        "keyword_checks": {
                          "type": "object",
                          "properties": {
                            "used": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "max": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "used",
                            "max"
                          ],
                          "additionalProperties": false
                        },
                        "prompt_checks": {
                          "type": "object",
                          "properties": {
                            "used": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "max": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "used",
                            "max"
                          ],
                          "additionalProperties": false
                        },
                        "keyword_engines": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "prompt_engines": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "addons": {
                          "type": "object",
                          "properties": {
                            "active": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "keyword_checks",
                                      "grid_checks"
                                    ]
                                  },
                                  "checks": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "expires_at": {
                                    "type": "string",
                                    "format": "date-time"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "checks",
                                  "expires_at"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "offers": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "keyword_checks",
                                      "grid_checks"
                                    ]
                                  },
                                  "checks": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "credits": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "days": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "kind",
                                  "checks",
                                  "credits",
                                  "days"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "active",
                            "offers"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "keywords",
                        "prompts",
                        "engines",
                        "competitors",
                        "keyword_every_days",
                        "prompt_every_days",
                        "keyword_checks",
                        "prompt_checks",
                        "keyword_engines",
                        "prompt_engines",
                        "addons"
                      ],
                      "additionalProperties": false
                    },
                    "competitors": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "domain": {
                                "type": "string"
                              },
                              "name": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "source": {
                                "type": "string",
                                "enum": [
                                  "scan",
                                  "customer"
                                ]
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "suggested",
                                  "tracked"
                                ]
                              }
                            },
                            "required": [
                              "domain",
                              "name",
                              "source",
                              "status"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "limit": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "edited": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "items",
                        "limit",
                        "edited"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "keywords",
                    "prompts",
                    "limits",
                    "competitors"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/campaign-drafts/{draft_id}/preflight": {
      "post": {
        "operationId": "preflight_campaign",
        "summary": "Runs the 13 free checks before a campaign is made. A failed check says why it failed and how to fix it. Nothing is changed in the ad account.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "draft_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "draft_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "client_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "asset_id": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "platform": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "plan": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "creatives": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "creative_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "status": {
                            "type": "string"
                          },
                          "angle": {
                            "type": "string"
                          },
                          "headlines": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "descriptions": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "brief": {}
                        },
                        "required": [
                          "creative_id",
                          "status",
                          "angle",
                          "headlines",
                          "descriptions",
                          "brief"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "preflight": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "ok": {
                              "type": "boolean"
                            },
                            "checked_at": {
                              "type": "string"
                            },
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "n": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "group": {
                                    "type": "string"
                                  },
                                  "ok": {
                                    "type": "boolean"
                                  },
                                  "why": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "fix": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "n",
                                  "group",
                                  "ok",
                                  "why",
                                  "fix"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "ok",
                            "checked_at",
                            "items"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "delivery": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "looks": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "hours": {
                                    "type": "number"
                                  },
                                  "at": {
                                    "type": "string"
                                  },
                                  "status": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "issues": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  },
                                  "impressions": {
                                    "type": [
                                      "number",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "hours",
                                  "at",
                                  "status",
                                  "issues",
                                  "impressions"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "warnings": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "code": {
                                    "type": "string"
                                  },
                                  "at": {
                                    "type": "string"
                                  },
                                  "message": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "code",
                                  "at",
                                  "message"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "looks",
                            "warnings"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "create_action_id": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "launch_action_id": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "next_step": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "draft_id",
                    "client_id",
                    "asset_id",
                    "platform",
                    "status",
                    "plan",
                    "creatives",
                    "preflight",
                    "delivery",
                    "create_action_id",
                    "launch_action_id",
                    "next_step"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/preview": {
      "post": {
        "operationId": "preview",
        "summary": "Starts the free scan of a website for someone who has no account yet. The answer has claim_url: the address where a person signs in and takes the scan. Give that address to the person.",
        "x-stability": "stable",
        "security": [
          {},
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "domain": {
                    "type": "string",
                    "maxLength": 253
                  }
                },
                "required": [
                  "domain"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "scan_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "ready": {
                      "type": "boolean"
                    },
                    "claim_url": {
                      "type": "string"
                    },
                    "next_action": {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "identity",
                            "payment",
                            "oauth",
                            "approval",
                            "wait"
                          ]
                        },
                        "url": {
                          "type": "string",
                          "minLength": 1
                        },
                        "why": {
                          "type": "string",
                          "minLength": 1
                        },
                        "resume": {
                          "type": "string"
                        },
                        "poll_after_s": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "kind",
                        "url",
                        "why"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "scan_id",
                    "ready",
                    "claim_url",
                    "next_action"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/scans/preview": {
      "get": {
        "operationId": "preview_domain",
        "summary": "Checks that a website address is valid and tells whether a recent scan of it exists.",
        "x-stability": "stable",
        "security": [
          {},
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "domain",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 253
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "domain": {
                      "type": "string"
                    },
                    "cached": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "domain",
                    "cached"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/actions": {
      "post": {
        "operationId": "propose_change",
        "summary": "Proposes one change to a connected ad account. Returns the action, its status and, when it cannot go ahead, the reason codes.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "asset_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "ADD_NEGATIVE",
                      "PAUSE_KEYWORD",
                      "PAUSE_AD",
                      "PAUSE_ADSET",
                      "PAUSE_CAMPAIGN",
                      "SET_BUDGET",
                      "SET_MAX_CPC",
                      "ENABLE_ENTITY",
                      "SET_NETWORKS",
                      "SET_GEO_PRESENCE",
                      "ADD_KEYWORD",
                      "SET_BID_STRATEGY",
                      "SET_PLACEMENTS",
                      "SET_AUDIENCE_OPTION",
                      "SET_CREATIVE_FEATURES",
                      "CREATE_CAMPAIGN_DRAFT",
                      "CREATE_AD_DRAFT",
                      "LAUNCH_CAMPAIGN"
                    ]
                  },
                  "params": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "expected_current": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "recommendation_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "supersedes": {
                    "type": "string",
                    "format": "uuid"
                  }
                },
                "required": [
                  "client_id",
                  "asset_id",
                  "type",
                  "params"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "action_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "client_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "asset_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "platform": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "ADD_NEGATIVE",
                        "PAUSE_KEYWORD",
                        "PAUSE_AD",
                        "PAUSE_ADSET",
                        "PAUSE_CAMPAIGN",
                        "SET_BUDGET",
                        "SET_MAX_CPC",
                        "ENABLE_ENTITY",
                        "SET_NETWORKS",
                        "SET_GEO_PRESENCE",
                        "ADD_KEYWORD",
                        "SET_BID_STRATEGY",
                        "SET_PLACEMENTS",
                        "SET_AUDIENCE_OPTION",
                        "SET_CREATIVE_FEATURES",
                        "CREATE_CAMPAIGN_DRAFT",
                        "CREATE_AD_DRAFT",
                        "LAUNCH_CAMPAIGN"
                      ]
                    },
                    "direction": {
                      "type": "string",
                      "enum": [
                        "increase",
                        "decrease",
                        "neutral"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "blocked",
                        "pending",
                        "approved",
                        "auto_queued",
                        "executing",
                        "done",
                        "failed",
                        "unknown",
                        "rejected",
                        "expired",
                        "withdrawn",
                        "superseded"
                      ]
                    },
                    "reason_codes": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "not_enough_data",
                          "too_soon_after_last_change",
                          "over_limit",
                          "cap_required",
                          "cap_would_be_exceeded",
                          "account_paused",
                          "tracking_unhealthy",
                          "stale_data",
                          "conflicts_open_change",
                          "unit_or_scale_suspect",
                          "shared_budget",
                          "drift",
                          "platform_refused",
                          "account_not_enabled",
                          "object_missing",
                          "already_undone",
                          "write_gate_closed",
                          "asset_not_linked",
                          "one_click_required",
                          "autopilot_stopped",
                          "hands_off",
                          "shift_waiting",
                          "area_not_approved"
                        ]
                      }
                    },
                    "approval_level": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "operator",
                            "owner_admin"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "before": {
                      "anyOf": [
                        {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "after": {
                      "anyOf": [
                        {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "params": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "card_body": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "card_sha256": {
                      "type": "string"
                    },
                    "undo_of": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "undone_by": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "retry_of": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "supersedes": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "is_noop": {
                      "type": "boolean"
                    },
                    "emergency": {
                      "type": "boolean"
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "applied_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "expected_current": {
                      "anyOf": [
                        {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "before_after": {
                      "type": "object",
                      "properties": {
                        "before": {
                          "type": "string",
                          "minLength": 1
                        },
                        "after": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "required": [
                        "before",
                        "after"
                      ],
                      "additionalProperties": false
                    },
                    "undo": {
                      "type": "object",
                      "properties": {
                        "possible": {
                          "type": "boolean"
                        },
                        "until": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "note": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "required": [
                        "possible",
                        "until",
                        "note"
                      ],
                      "additionalProperties": false
                    },
                    "note": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "approved_by": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "approved_via": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "panel",
                            "email_link"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "approved_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "currency": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "action_id",
                    "client_id",
                    "asset_id",
                    "platform",
                    "type",
                    "direction",
                    "status",
                    "reason_codes",
                    "approval_level",
                    "before",
                    "after",
                    "params",
                    "card_body",
                    "card_sha256",
                    "undo_of",
                    "undone_by",
                    "retry_of",
                    "supersedes",
                    "is_noop",
                    "emergency",
                    "created_at",
                    "applied_at",
                    "expected_current",
                    "before_after",
                    "undo",
                    "note",
                    "approved_by",
                    "approved_via",
                    "approved_at",
                    "currency"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/shifts": {
      "post": {
        "operationId": "propose_shift",
        "summary": "Proposes moving daily budget from one campaign to another. Within the weekly limit, and when the customer allows Autopilot to apply by itself, it runs on its own; over the limit, or otherwise, a person approves each step. The money is taken away before it is added.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "from": {
                    "type": "object",
                    "properties": {
                      "asset_id": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "campaign_id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 40
                      },
                      "amount_minor": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "asset_id",
                      "campaign_id",
                      "amount_minor"
                    ]
                  },
                  "to": {
                    "type": "object",
                    "properties": {
                      "asset_id": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "campaign_id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 40
                      },
                      "amount_minor": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "asset_id",
                      "campaign_id",
                      "amount_minor"
                    ]
                  }
                },
                "required": [
                  "from",
                  "to"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "group_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "reduce": {
                      "type": "object",
                      "properties": {
                        "action_id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "client_id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "asset_id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "platform": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "ADD_NEGATIVE",
                            "PAUSE_KEYWORD",
                            "PAUSE_AD",
                            "PAUSE_ADSET",
                            "PAUSE_CAMPAIGN",
                            "SET_BUDGET",
                            "SET_MAX_CPC",
                            "ENABLE_ENTITY",
                            "SET_NETWORKS",
                            "SET_GEO_PRESENCE",
                            "ADD_KEYWORD",
                            "SET_BID_STRATEGY",
                            "SET_PLACEMENTS",
                            "SET_AUDIENCE_OPTION",
                            "SET_CREATIVE_FEATURES",
                            "CREATE_CAMPAIGN_DRAFT",
                            "CREATE_AD_DRAFT",
                            "LAUNCH_CAMPAIGN"
                          ]
                        },
                        "direction": {
                          "type": "string",
                          "enum": [
                            "increase",
                            "decrease",
                            "neutral"
                          ]
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "blocked",
                            "pending",
                            "approved",
                            "auto_queued",
                            "executing",
                            "done",
                            "failed",
                            "unknown",
                            "rejected",
                            "expired",
                            "withdrawn",
                            "superseded"
                          ]
                        },
                        "reason_codes": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "not_enough_data",
                              "too_soon_after_last_change",
                              "over_limit",
                              "cap_required",
                              "cap_would_be_exceeded",
                              "account_paused",
                              "tracking_unhealthy",
                              "stale_data",
                              "conflicts_open_change",
                              "unit_or_scale_suspect",
                              "shared_budget",
                              "drift",
                              "platform_refused",
                              "account_not_enabled",
                              "object_missing",
                              "already_undone",
                              "write_gate_closed",
                              "asset_not_linked",
                              "one_click_required",
                              "autopilot_stopped",
                              "hands_off",
                              "shift_waiting",
                              "area_not_approved"
                            ]
                          }
                        },
                        "approval_level": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "operator",
                                "owner_admin"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "before": {
                          "anyOf": [
                            {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {}
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "after": {
                          "anyOf": [
                            {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {}
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "params": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        },
                        "card_body": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        },
                        "card_sha256": {
                          "type": "string"
                        },
                        "undo_of": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "uuid"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "undone_by": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "uuid"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "retry_of": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "uuid"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "supersedes": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "uuid"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "is_noop": {
                          "type": "boolean"
                        },
                        "emergency": {
                          "type": "boolean"
                        },
                        "created_at": {
                          "type": "string"
                        },
                        "applied_at": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "expected_current": {
                          "anyOf": [
                            {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {}
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "before_after": {
                          "type": "object",
                          "properties": {
                            "before": {
                              "type": "string",
                              "minLength": 1
                            },
                            "after": {
                              "type": "string",
                              "minLength": 1
                            }
                          },
                          "required": [
                            "before",
                            "after"
                          ],
                          "additionalProperties": false
                        },
                        "undo": {
                          "type": "object",
                          "properties": {
                            "possible": {
                              "type": "boolean"
                            },
                            "until": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "note": {
                              "type": "string",
                              "minLength": 1
                            }
                          },
                          "required": [
                            "possible",
                            "until",
                            "note"
                          ],
                          "additionalProperties": false
                        },
                        "note": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "approved_by": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "uuid"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "approved_via": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "panel",
                                "email_link"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "approved_at": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "currency": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^[A-Z]{3}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "action_id",
                        "client_id",
                        "asset_id",
                        "platform",
                        "type",
                        "direction",
                        "status",
                        "reason_codes",
                        "approval_level",
                        "before",
                        "after",
                        "params",
                        "card_body",
                        "card_sha256",
                        "undo_of",
                        "undone_by",
                        "retry_of",
                        "supersedes",
                        "is_noop",
                        "emergency",
                        "created_at",
                        "applied_at",
                        "expected_current",
                        "before_after",
                        "undo",
                        "note",
                        "approved_by",
                        "approved_via",
                        "approved_at",
                        "currency"
                      ],
                      "additionalProperties": false
                    },
                    "raise": {
                      "type": "object",
                      "properties": {
                        "action_id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "client_id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "asset_id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "platform": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "ADD_NEGATIVE",
                            "PAUSE_KEYWORD",
                            "PAUSE_AD",
                            "PAUSE_ADSET",
                            "PAUSE_CAMPAIGN",
                            "SET_BUDGET",
                            "SET_MAX_CPC",
                            "ENABLE_ENTITY",
                            "SET_NETWORKS",
                            "SET_GEO_PRESENCE",
                            "ADD_KEYWORD",
                            "SET_BID_STRATEGY",
                            "SET_PLACEMENTS",
                            "SET_AUDIENCE_OPTION",
                            "SET_CREATIVE_FEATURES",
                            "CREATE_CAMPAIGN_DRAFT",
                            "CREATE_AD_DRAFT",
                            "LAUNCH_CAMPAIGN"
                          ]
                        },
                        "direction": {
                          "type": "string",
                          "enum": [
                            "increase",
                            "decrease",
                            "neutral"
                          ]
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "blocked",
                            "pending",
                            "approved",
                            "auto_queued",
                            "executing",
                            "done",
                            "failed",
                            "unknown",
                            "rejected",
                            "expired",
                            "withdrawn",
                            "superseded"
                          ]
                        },
                        "reason_codes": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "not_enough_data",
                              "too_soon_after_last_change",
                              "over_limit",
                              "cap_required",
                              "cap_would_be_exceeded",
                              "account_paused",
                              "tracking_unhealthy",
                              "stale_data",
                              "conflicts_open_change",
                              "unit_or_scale_suspect",
                              "shared_budget",
                              "drift",
                              "platform_refused",
                              "account_not_enabled",
                              "object_missing",
                              "already_undone",
                              "write_gate_closed",
                              "asset_not_linked",
                              "one_click_required",
                              "autopilot_stopped",
                              "hands_off",
                              "shift_waiting",
                              "area_not_approved"
                            ]
                          }
                        },
                        "approval_level": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "operator",
                                "owner_admin"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "before": {
                          "anyOf": [
                            {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {}
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "after": {
                          "anyOf": [
                            {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {}
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "params": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        },
                        "card_body": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        },
                        "card_sha256": {
                          "type": "string"
                        },
                        "undo_of": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "uuid"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "undone_by": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "uuid"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "retry_of": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "uuid"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "supersedes": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "uuid"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "is_noop": {
                          "type": "boolean"
                        },
                        "emergency": {
                          "type": "boolean"
                        },
                        "created_at": {
                          "type": "string"
                        },
                        "applied_at": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "expected_current": {
                          "anyOf": [
                            {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {}
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "before_after": {
                          "type": "object",
                          "properties": {
                            "before": {
                              "type": "string",
                              "minLength": 1
                            },
                            "after": {
                              "type": "string",
                              "minLength": 1
                            }
                          },
                          "required": [
                            "before",
                            "after"
                          ],
                          "additionalProperties": false
                        },
                        "undo": {
                          "type": "object",
                          "properties": {
                            "possible": {
                              "type": "boolean"
                            },
                            "until": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "note": {
                              "type": "string",
                              "minLength": 1
                            }
                          },
                          "required": [
                            "possible",
                            "until",
                            "note"
                          ],
                          "additionalProperties": false
                        },
                        "note": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "approved_by": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "uuid"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "approved_via": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "panel",
                                "email_link"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "approved_at": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "currency": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^[A-Z]{3}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "action_id",
                        "client_id",
                        "asset_id",
                        "platform",
                        "type",
                        "direction",
                        "status",
                        "reason_codes",
                        "approval_level",
                        "before",
                        "after",
                        "params",
                        "card_body",
                        "card_sha256",
                        "undo_of",
                        "undone_by",
                        "retry_of",
                        "supersedes",
                        "is_noop",
                        "emergency",
                        "created_at",
                        "applied_at",
                        "expected_current",
                        "before_after",
                        "undo",
                        "note",
                        "approved_by",
                        "approved_via",
                        "approved_at",
                        "currency"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "group_id",
                    "reduce",
                    "raise"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/keyword-recheck": {
      "post": {
        "operationId": "recheck_keywords",
        "summary": "Reads some of the searches the business follows again now, outside the schedule: send the followed searches as `keywords` (1 to 100, spelled as in the list). Costs 3 credits a search: an agent or key sends max_credits, or nothing is sent. The new places are ready in about 45 minutes to an hour and appear in the rank history; nothing shows progress. Nothing is charged when no search could be read.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "keywords": {
                    "minItems": 1,
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    }
                  },
                  "max_credits": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100000,
                    "description": "The most credits this call may spend. A call that costs more is refused and nothing is spent. estimate_spend gives the price."
                  }
                },
                "required": [
                  "keywords"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "run_id": {
                      "description": "The run behind this call. GET /v1/runs/{run_id}/events streams its progress (server-sent events: run.progress, run.partial, run.deferred, run.done, run.failed). null when no run started.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "credits": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "keywords": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "ready_in_minutes": {
                      "type": "object",
                      "properties": {
                        "from": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "to": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "from",
                        "to"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "run_id",
                    "credits",
                    "keywords",
                    "ready_in_minutes"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "The credit cap or balance is short (G-COST), or the organization has no paid plan (G-ENTITLEMENT). missing and next_action say what to do.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/facts/remove": {
      "post": {
        "operationId": "remove_business_fact",
        "summary": "Takes one line about the business out of use. It stays in the history, and undo_business_fact brings it back.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "summary",
                      "service"
                    ]
                  },
                  "value": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 600
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "fact": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "kind": {
                          "type": "string"
                        },
                        "value": {
                          "type": "string"
                        },
                        "meta": {
                          "anyOf": [
                            {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {}
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "by": {
                          "type": "string",
                          "enum": [
                            "owner",
                            "upnatus",
                            "agent"
                          ]
                        },
                        "at": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "kind",
                        "value",
                        "meta",
                        "by",
                        "at"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "fact"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/saved-keyword-tags": {
      "patch": {
        "operationId": "rename_saved_tag",
        "summary": "Renames a tag (a list) of the saved keywords. Renaming onto a tag that exists merges the two.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40,
                    "pattern": "^[^\\p{Cc}]*$"
                  },
                  "new_name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40,
                    "pattern": "^[^\\p{Cc}]*$"
                  }
                },
                "required": [
                  "name",
                  "new_name"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "renamed": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "renamed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/tracking/questions/resume": {
      "post": {
        "operationId": "resume_tracked_question",
        "summary": "Resumes a paused question: it is asked again from the next round and costs its checks again, so the plan needs room for them (a full list refuses and nothing changes).",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 400
                  }
                },
                "required": [
                  "text"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "keywords": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "text": {
                            "type": "string"
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "scan",
                              "customer"
                            ]
                          },
                          "added_at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "engines": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "location_code": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "device": {
                            "type": "string",
                            "enum": [
                              "desktop",
                              "mobile",
                              "both"
                            ]
                          },
                          "first_read": {
                            "type": "string",
                            "enum": [
                              "done",
                              "soon",
                              "monday"
                            ]
                          }
                        },
                        "required": [
                          "text",
                          "source",
                          "added_at",
                          "engines",
                          "location_code",
                          "device",
                          "first_read"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "prompts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "text": {
                            "type": "string"
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "scan",
                              "customer"
                            ]
                          },
                          "added_at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "engines": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "topic": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "paused": {
                            "type": "boolean"
                          },
                          "branded": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "text",
                          "source",
                          "added_at",
                          "engines",
                          "topic",
                          "paused",
                          "branded"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "limits": {
                      "type": "object",
                      "properties": {
                        "keywords": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "prompts": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "engines": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "competitors": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "keyword_every_days": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        "prompt_every_days": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        "keyword_checks": {
                          "type": "object",
                          "properties": {
                            "used": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "max": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "used",
                            "max"
                          ],
                          "additionalProperties": false
                        },
                        "prompt_checks": {
                          "type": "object",
                          "properties": {
                            "used": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "max": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "used",
                            "max"
                          ],
                          "additionalProperties": false
                        },
                        "keyword_engines": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "prompt_engines": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "addons": {
                          "type": "object",
                          "properties": {
                            "active": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "keyword_checks",
                                      "grid_checks"
                                    ]
                                  },
                                  "checks": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "expires_at": {
                                    "type": "string",
                                    "format": "date-time"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "checks",
                                  "expires_at"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "offers": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "keyword_checks",
                                      "grid_checks"
                                    ]
                                  },
                                  "checks": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "credits": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "days": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "kind",
                                  "checks",
                                  "credits",
                                  "days"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "active",
                            "offers"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "keywords",
                        "prompts",
                        "engines",
                        "competitors",
                        "keyword_every_days",
                        "prompt_every_days",
                        "keyword_checks",
                        "prompt_checks",
                        "keyword_engines",
                        "prompt_engines",
                        "addons"
                      ],
                      "additionalProperties": false
                    },
                    "competitors": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "domain": {
                                "type": "string"
                              },
                              "name": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "source": {
                                "type": "string",
                                "enum": [
                                  "scan",
                                  "customer"
                                ]
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "suggested",
                                  "tracked"
                                ]
                              }
                            },
                            "required": [
                              "domain",
                              "name",
                              "source",
                              "status"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "limit": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "edited": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "items",
                        "limit",
                        "edited"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "keywords",
                    "prompts",
                    "limits",
                    "competitors"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/keyword-ideas/seed": {
      "post": {
        "operationId": "seed_keyword_ideas",
        "summary": "Asks for search ideas close to 1 to 5 phrases (a service, a product, a question), one list of up to 200 ideas for each phrase, placed in a market: the business's own country and language, or the `country`, `language` and `location_code` (a Google city from the locations search) you send. Costs 12 credits for each phrase, and 18 more with a city (that pays for the city's own volume and cost per click): an agent or key sends max_credits (estimate_spend gives the price), or nothing is sent. The ideas arrive in a few seconds; read them with get_keyword_research (the newest search is the one asked). Nothing is charged when no ideas come back, or when the country or city is not one Google lists. The same phrases in the same market asked in the last 30 days are not paid again; send ask_again: true for a fresh pull.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "seeds": {
                    "minItems": 1,
                    "maxItems": 5,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 2,
                      "maxLength": 80,
                      "pattern": "^[^\\p{Cc}]*$"
                    }
                  },
                  "country": {
                    "type": "string",
                    "pattern": "^[A-Za-z]{2}$"
                  },
                  "location_code": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "language": {
                    "type": "string",
                    "pattern": "^[a-z]{2,3}(-[A-Za-z]{2,4})?$"
                  },
                  "max_credits": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000,
                    "description": "The most credits this call may spend. A call that costs more is refused and nothing is spent. estimate_spend gives the price."
                  },
                  "ask_again": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "seeds"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "run_id": {
                      "description": "The run behind this call. GET /v1/runs/{run_id}/events streams its progress (server-sent events: run.progress, run.partial, run.deferred, run.done, run.failed). null when no run started.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "credits": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "market": {
                      "type": "object",
                      "properties": {
                        "country": {
                          "type": "string"
                        },
                        "location_code": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "language": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "country",
                        "location_code",
                        "language"
                      ],
                      "additionalProperties": false
                    },
                    "reused": {
                      "type": "object",
                      "properties": {
                        "asked_on": {
                          "type": "string"
                        },
                        "note": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "asked_on",
                        "note"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "run_id",
                    "credits",
                    "market"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "The credit cap or balance is short (G-COST), or the organization has no paid plan (G-ENTITLEMENT). missing and next_action say what to do.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/chats/messages": {
      "post": {
        "operationId": "send_chat_message",
        "summary": "Asks the advisor a question in a chat (or starts one). Costs credits: an agent or key sends max_credits, the most it accepts (estimate_spend gives the price), or nothing is sent. Returns chat_id and run_id; call get_chat with id=chat_id and client_id until busy is false to read the answer. The same question asked in the last 30 days is not paid again: its chat comes back with run_id null and a note; send ask_again: true for a fresh answer.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "chat": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "text": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 4000
                  },
                  "max_credits": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000,
                    "description": "The most credits this call may spend. A call that costs more is refused and nothing is spent. estimate_spend gives the price."
                  },
                  "ask_again": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "client_id",
                  "text"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "chat_id": {
                      "type": "string"
                    },
                    "run_id": {
                      "description": "The run behind this call. GET /v1/runs/{run_id}/events streams its progress (server-sent events: run.progress, run.partial, run.deferred, run.done, run.failed). null when no run started.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "reused": {
                      "type": "object",
                      "properties": {
                        "asked_on": {
                          "type": "string"
                        },
                        "note": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "asked_on",
                        "note"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "chat_id",
                    "run_id"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "The credit cap or balance is short (G-COST), or the organization has no paid plan (G-ENTITLEMENT). missing and next_action say what to do.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/assets/{asset_id}/auto-apply": {
      "put": {
        "operationId": "set_auto_apply",
        "summary": "An owner or admin turns on, or off, Upnatus applying its own changes by itself on one ad account. It starts off.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "asset_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "on": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "on"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "asset_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "auto_apply": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "asset_id",
                    "auto_apply"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/facts": {
      "put": {
        "operationId": "set_business_fact",
        "summary": "Writes one line about the business: the summary, the target customers, the brand voice, the service area, a service or a word to avoid. With an id it changes that line; without one a one-value kind replaces its value and a list adds a line. The line keeps who wrote it and when.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "summary",
                      "target_customers",
                      "brand_voice",
                      "service_area",
                      "service",
                      "never_say"
                    ]
                  },
                  "value": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 600,
                    "pattern": "^[^\\p{Cc}]*$|^[^\\p{Cc}\\n]*$"
                  },
                  "id": {
                    "type": "string",
                    "format": "uuid"
                  }
                },
                "required": [
                  "kind",
                  "value"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "fact": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "kind": {
                          "type": "string"
                        },
                        "value": {
                          "type": "string"
                        },
                        "meta": {
                          "anyOf": [
                            {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {}
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "by": {
                          "type": "string",
                          "enum": [
                            "owner",
                            "upnatus",
                            "agent"
                          ]
                        },
                        "at": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "kind",
                        "value",
                        "meta",
                        "by",
                        "at"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "fact"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/business-info/market": {
      "patch": {
        "operationId": "set_business_market",
        "summary": "Sets the country, the city or the language the business is read in. `city: null` clears the saved city, and a different country sent without a city clears it too (a city belongs to one country). A country sent here counts as chosen by the owner (country_by \"you\") and wins over what the site or Search Console says. The answer says if the place list of that country is ready (see list_locations).",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "country": {
                    "type": "string",
                    "pattern": "^[A-Za-z]{2}$"
                  },
                  "city": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 60
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "language": {
                    "type": "string",
                    "pattern": "^[A-Za-z]{2}$"
                  },
                  "scope": {
                    "type": "string",
                    "enum": [
                      "country",
                      "worldwide"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "market": {
                      "type": "object",
                      "properties": {
                        "country": {
                          "type": "string"
                        },
                        "country_name": {
                          "type": "string"
                        },
                        "country_by": {
                          "type": "string",
                          "enum": [
                            "you",
                            "search_console",
                            "site",
                            "default"
                          ]
                        },
                        "caption": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "city": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "language": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "scope": {
                          "type": "string",
                          "enum": [
                            "country",
                            "worldwide"
                          ]
                        },
                        "stamp": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "by": {
                                  "type": "string",
                                  "enum": [
                                    "owner",
                                    "upnatus",
                                    "agent"
                                  ]
                                },
                                "at": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "by",
                                "at"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "country",
                        "country_name",
                        "country_by",
                        "caption",
                        "city",
                        "language",
                        "scope",
                        "stamp"
                      ],
                      "additionalProperties": false
                    },
                    "locations_ready": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "market",
                    "locations_ready"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/assets/{asset_id}/cap": {
      "put": {
        "operationId": "set_cap",
        "summary": "Sets the monthly spending cap of one ad account. Raising it needs an owner or admin who confirmed it is them; anyone who can operate can lower it.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "asset_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "amount_minor": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "amount_minor"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "asset_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "amount_minor": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "currency": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "asset_id",
                    "amount_minor",
                    "currency"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/mode": {
      "put": {
        "operationId": "set_mode",
        "summary": "Puts a business back in Guide mode. Only a signed-in owner or admin can turn Autopilot on.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "mode": {
                    "type": "string",
                    "enum": [
                      "autopilot",
                      "guide"
                    ]
                  }
                },
                "required": [
                  "mode"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "client_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "paused": {
                      "type": "boolean"
                    },
                    "mode": {
                      "type": "string",
                      "enum": [
                        "autopilot",
                        "guide"
                      ]
                    }
                  },
                  "required": [
                    "client_id",
                    "paused",
                    "mode"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/profile": {
      "put": {
        "operationId": "set_profile",
        "summary": "Sets the facts the advisor needs about a business: country, service area, business model, monthly budget (with its currency), how leads are answered. Send only what is known; the rest stays as it is.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "country": {
                    "type": "string",
                    "pattern": "^[A-Za-z]{2}$"
                  },
                  "service_area": {
                    "type": "object",
                    "properties": {
                      "also_serves": {
                        "maxItems": 5,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 2,
                          "maxLength": 2
                        }
                      },
                      "radius": {
                        "type": "object",
                        "properties": {
                          "lat": {
                            "type": "number",
                            "minimum": -90,
                            "maximum": 90
                          },
                          "lng": {
                            "type": "number",
                            "minimum": -180,
                            "maximum": 180
                          },
                          "km": {
                            "type": "number",
                            "exclusiveMinimum": 0,
                            "maximum": 500
                          }
                        },
                        "required": [
                          "lat",
                          "lng",
                          "km"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "business_model": {
                    "type": "string",
                    "enum": [
                      "local_service_lead",
                      "appointment_local",
                      "walk_in_local",
                      "high_ticket_service",
                      "consumer_lead_gen",
                      "b2b_lead_gen",
                      "b2b_saas",
                      "ecommerce"
                    ]
                  },
                  "monthly_budget": {
                    "type": "number",
                    "exclusiveMinimum": 0,
                    "maximum": 1000000000
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Za-z]{3}$"
                  },
                  "lead_response_channel": {
                    "type": "string",
                    "enum": [
                      "phone",
                      "email",
                      "message",
                      "form"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "client_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "missing_profile": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "country",
                          "service_area",
                          "business_model",
                          "monthly_budget",
                          "lead_response_channel"
                        ]
                      }
                    }
                  },
                  "required": [
                    "client_id",
                    "missing_profile"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/tracking/questions/topic": {
      "post": {
        "operationId": "set_question_topic",
        "summary": "Puts one tracked question under a topic (the shared name of a few questions, 1 to 40 characters), or clears it with null. A topic is not a record of its own: it exists while a question carries it.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 400
                  },
                  "topic": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "text",
                  "topic"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "keywords": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "text": {
                            "type": "string"
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "scan",
                              "customer"
                            ]
                          },
                          "added_at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "engines": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "location_code": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "device": {
                            "type": "string",
                            "enum": [
                              "desktop",
                              "mobile",
                              "both"
                            ]
                          },
                          "first_read": {
                            "type": "string",
                            "enum": [
                              "done",
                              "soon",
                              "monday"
                            ]
                          }
                        },
                        "required": [
                          "text",
                          "source",
                          "added_at",
                          "engines",
                          "location_code",
                          "device",
                          "first_read"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "prompts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "text": {
                            "type": "string"
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "scan",
                              "customer"
                            ]
                          },
                          "added_at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "engines": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "topic": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "paused": {
                            "type": "boolean"
                          },
                          "branded": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "text",
                          "source",
                          "added_at",
                          "engines",
                          "topic",
                          "paused",
                          "branded"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "limits": {
                      "type": "object",
                      "properties": {
                        "keywords": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "prompts": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "engines": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "competitors": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "keyword_every_days": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        "prompt_every_days": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        "keyword_checks": {
                          "type": "object",
                          "properties": {
                            "used": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "max": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "used",
                            "max"
                          ],
                          "additionalProperties": false
                        },
                        "prompt_checks": {
                          "type": "object",
                          "properties": {
                            "used": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "max": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "used",
                            "max"
                          ],
                          "additionalProperties": false
                        },
                        "keyword_engines": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "prompt_engines": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "addons": {
                          "type": "object",
                          "properties": {
                            "active": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "keyword_checks",
                                      "grid_checks"
                                    ]
                                  },
                                  "checks": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "expires_at": {
                                    "type": "string",
                                    "format": "date-time"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "checks",
                                  "expires_at"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "offers": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "keyword_checks",
                                      "grid_checks"
                                    ]
                                  },
                                  "checks": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "credits": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "days": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "kind",
                                  "checks",
                                  "credits",
                                  "days"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "active",
                            "offers"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "keywords",
                        "prompts",
                        "engines",
                        "competitors",
                        "keyword_every_days",
                        "prompt_every_days",
                        "keyword_checks",
                        "prompt_checks",
                        "keyword_engines",
                        "prompt_engines",
                        "addons"
                      ],
                      "additionalProperties": false
                    },
                    "competitors": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "domain": {
                                "type": "string"
                              },
                              "name": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "source": {
                                "type": "string",
                                "enum": [
                                  "scan",
                                  "customer"
                                ]
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "suggested",
                                  "tracked"
                                ]
                              }
                            },
                            "required": [
                              "domain",
                              "name",
                              "source",
                              "status"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "limit": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "edited": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "items",
                        "limit",
                        "edited"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "keywords",
                    "prompts",
                    "limits",
                    "competitors"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/scans/{id}/settings": {
      "patch": {
        "operationId": "set_scan_settings",
        "summary": "Changes the business name, city, services or the weekly e-mail of a paid scan.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 120,
                    "pattern": "^[^\\p{Cc}]*$"
                  },
                  "city": {
                    "type": "string",
                    "maxLength": 80,
                    "pattern": "^[^\\p{Cc}]*$"
                  },
                  "services": {
                    "maxItems": 10,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 80,
                      "pattern": "^[^\\p{Cc}]*$"
                    }
                  },
                  "weekly_mail": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "business": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "domain": {
                              "type": "string"
                            },
                            "name": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "summary": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "country": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "language": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "services": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "city": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "domain",
                            "name",
                            "summary",
                            "country",
                            "language",
                            "services",
                            "city"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "weekly_mail": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "business",
                    "weekly_mail"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/tracking/competitors": {
      "put": {
        "operationId": "set_tracked_competitors",
        "summary": "Sets the rivals this business follows on every round of the plan (every 3 days on current plans; `limits.keyword_every_days` of list_tracking says) (a site such as example.com, with an optional name). Send the whole list; a rival left out stops being followed. Once the list is sent, only these rivals are followed and a new suggestion is never followed on its own. The change counts from the next round.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "competitors": {
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "domain": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "domain"
                      ]
                    }
                  }
                },
                "required": [
                  "competitors"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "keywords": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "text": {
                            "type": "string"
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "scan",
                              "customer"
                            ]
                          },
                          "added_at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "engines": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "location_code": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "device": {
                            "type": "string",
                            "enum": [
                              "desktop",
                              "mobile",
                              "both"
                            ]
                          },
                          "first_read": {
                            "type": "string",
                            "enum": [
                              "done",
                              "soon",
                              "monday"
                            ]
                          }
                        },
                        "required": [
                          "text",
                          "source",
                          "added_at",
                          "engines",
                          "location_code",
                          "device",
                          "first_read"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "prompts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "text": {
                            "type": "string"
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "scan",
                              "customer"
                            ]
                          },
                          "added_at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "engines": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "topic": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "paused": {
                            "type": "boolean"
                          },
                          "branded": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "text",
                          "source",
                          "added_at",
                          "engines",
                          "topic",
                          "paused",
                          "branded"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "limits": {
                      "type": "object",
                      "properties": {
                        "keywords": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "prompts": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "engines": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "competitors": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "keyword_every_days": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        "prompt_every_days": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        "keyword_checks": {
                          "type": "object",
                          "properties": {
                            "used": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "max": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "used",
                            "max"
                          ],
                          "additionalProperties": false
                        },
                        "prompt_checks": {
                          "type": "object",
                          "properties": {
                            "used": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "max": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "used",
                            "max"
                          ],
                          "additionalProperties": false
                        },
                        "keyword_engines": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "prompt_engines": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "addons": {
                          "type": "object",
                          "properties": {
                            "active": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "keyword_checks",
                                      "grid_checks"
                                    ]
                                  },
                                  "checks": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "expires_at": {
                                    "type": "string",
                                    "format": "date-time"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "checks",
                                  "expires_at"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "offers": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "keyword_checks",
                                      "grid_checks"
                                    ]
                                  },
                                  "checks": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "credits": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "days": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "kind",
                                  "checks",
                                  "credits",
                                  "days"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "active",
                            "offers"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "keywords",
                        "prompts",
                        "engines",
                        "competitors",
                        "keyword_every_days",
                        "prompt_every_days",
                        "keyword_checks",
                        "prompt_checks",
                        "keyword_engines",
                        "prompt_engines",
                        "addons"
                      ],
                      "additionalProperties": false
                    },
                    "competitors": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "domain": {
                                "type": "string"
                              },
                              "name": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "source": {
                                "type": "string",
                                "enum": [
                                  "scan",
                                  "customer"
                                ]
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "suggested",
                                  "tracked"
                                ]
                              }
                            },
                            "required": [
                              "domain",
                              "name",
                              "source",
                              "status"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "limit": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "edited": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "items",
                        "limit",
                        "edited"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "keywords",
                    "prompts",
                    "limits",
                    "competitors"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/tracking/keywords": {
      "put": {
        "operationId": "set_tracked_keywords",
        "summary": "Sets the searches this business follows; each is read on every round of the plan (every 3 days on current plans; `limits.keyword_every_days` of list_tracking says). Send the whole list; a search left out stops being followed. A search is a text, or {text, engines, location_code, device} with engines from google, bing, yahoo (a text alone keeps its engines, a new one is read on google), a location code from list_locations (null: where the business is) and a device, desktop, mobile or both. Each engine of each search is one of the checks of a round (list_tracking says how many), and a search on both devices is two checks an engine. The list may add up to 200 new searches in one call (the answer says per search whether it has a reading, `first_read`: `done`, `soon` for the next live run, or `monday`, which means the next scheduled round; get_tracking_status says when). The change counts from the next round.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "keywords": {
                    "maxItems": 1000,
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "text": {
                              "type": "string"
                            },
                            "engines": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "location_code": {
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 2147483647
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "device": {
                              "type": "string",
                              "enum": [
                                "desktop",
                                "mobile",
                                "both"
                              ]
                            }
                          },
                          "required": [
                            "text"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  }
                },
                "required": [
                  "keywords"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "keywords": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "text": {
                            "type": "string"
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "scan",
                              "customer"
                            ]
                          },
                          "added_at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "engines": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "location_code": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "device": {
                            "type": "string",
                            "enum": [
                              "desktop",
                              "mobile",
                              "both"
                            ]
                          },
                          "first_read": {
                            "type": "string",
                            "enum": [
                              "done",
                              "soon",
                              "monday"
                            ]
                          }
                        },
                        "required": [
                          "text",
                          "source",
                          "added_at",
                          "engines",
                          "location_code",
                          "device",
                          "first_read"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "prompts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "text": {
                            "type": "string"
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "scan",
                              "customer"
                            ]
                          },
                          "added_at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "engines": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "topic": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "paused": {
                            "type": "boolean"
                          },
                          "branded": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "text",
                          "source",
                          "added_at",
                          "engines",
                          "topic",
                          "paused",
                          "branded"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "limits": {
                      "type": "object",
                      "properties": {
                        "keywords": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "prompts": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "engines": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "competitors": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "keyword_every_days": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        "prompt_every_days": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        "keyword_checks": {
                          "type": "object",
                          "properties": {
                            "used": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "max": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "used",
                            "max"
                          ],
                          "additionalProperties": false
                        },
                        "prompt_checks": {
                          "type": "object",
                          "properties": {
                            "used": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "max": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "used",
                            "max"
                          ],
                          "additionalProperties": false
                        },
                        "keyword_engines": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "prompt_engines": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "addons": {
                          "type": "object",
                          "properties": {
                            "active": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "keyword_checks",
                                      "grid_checks"
                                    ]
                                  },
                                  "checks": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "expires_at": {
                                    "type": "string",
                                    "format": "date-time"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "checks",
                                  "expires_at"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "offers": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "keyword_checks",
                                      "grid_checks"
                                    ]
                                  },
                                  "checks": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "credits": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "days": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "kind",
                                  "checks",
                                  "credits",
                                  "days"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "active",
                            "offers"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "keywords",
                        "prompts",
                        "engines",
                        "competitors",
                        "keyword_every_days",
                        "prompt_every_days",
                        "keyword_checks",
                        "prompt_checks",
                        "keyword_engines",
                        "prompt_engines",
                        "addons"
                      ],
                      "additionalProperties": false
                    },
                    "competitors": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "domain": {
                                "type": "string"
                              },
                              "name": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "source": {
                                "type": "string",
                                "enum": [
                                  "scan",
                                  "customer"
                                ]
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "suggested",
                                  "tracked"
                                ]
                              }
                            },
                            "required": [
                              "domain",
                              "name",
                              "source",
                              "status"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "limit": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "edited": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "items",
                        "limit",
                        "edited"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "keywords",
                    "prompts",
                    "limits",
                    "competitors"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/tracking/prompts": {
      "put": {
        "operationId": "set_tracked_prompts",
        "summary": "Sets the questions the AI assistants are asked about this business on every round of the plan (every 3 days on current plans; `limits.prompt_every_days` of list_tracking says). Send the whole list; a question left out stops being asked. A question is a text, or {text, engines} with engines from `limits.prompt_engines` of list_tracking (a text alone keeps its engines, a new one is asked on every assistant while the plan's checks allow, then on as many as fit). Each engine of each question is one of the checks of a round, so the whole pool can go to one assistant. The change counts from the next round.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "prompts": {
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "text": {
                              "type": "string"
                            },
                            "engines": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          },
                          "required": [
                            "text"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  }
                },
                "required": [
                  "prompts"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "keywords": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "text": {
                            "type": "string"
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "scan",
                              "customer"
                            ]
                          },
                          "added_at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "engines": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "location_code": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "device": {
                            "type": "string",
                            "enum": [
                              "desktop",
                              "mobile",
                              "both"
                            ]
                          },
                          "first_read": {
                            "type": "string",
                            "enum": [
                              "done",
                              "soon",
                              "monday"
                            ]
                          }
                        },
                        "required": [
                          "text",
                          "source",
                          "added_at",
                          "engines",
                          "location_code",
                          "device",
                          "first_read"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "prompts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "text": {
                            "type": "string"
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "scan",
                              "customer"
                            ]
                          },
                          "added_at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "engines": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "topic": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "paused": {
                            "type": "boolean"
                          },
                          "branded": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "text",
                          "source",
                          "added_at",
                          "engines",
                          "topic",
                          "paused",
                          "branded"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "limits": {
                      "type": "object",
                      "properties": {
                        "keywords": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "prompts": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "engines": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "competitors": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "keyword_every_days": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        "prompt_every_days": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        "keyword_checks": {
                          "type": "object",
                          "properties": {
                            "used": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "max": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "used",
                            "max"
                          ],
                          "additionalProperties": false
                        },
                        "prompt_checks": {
                          "type": "object",
                          "properties": {
                            "used": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "max": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "used",
                            "max"
                          ],
                          "additionalProperties": false
                        },
                        "keyword_engines": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "prompt_engines": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "addons": {
                          "type": "object",
                          "properties": {
                            "active": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "keyword_checks",
                                      "grid_checks"
                                    ]
                                  },
                                  "checks": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "expires_at": {
                                    "type": "string",
                                    "format": "date-time"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "checks",
                                  "expires_at"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "offers": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "keyword_checks",
                                      "grid_checks"
                                    ]
                                  },
                                  "checks": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "credits": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "days": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "kind",
                                  "checks",
                                  "credits",
                                  "days"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "active",
                            "offers"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "keywords",
                        "prompts",
                        "engines",
                        "competitors",
                        "keyword_every_days",
                        "prompt_every_days",
                        "keyword_checks",
                        "prompt_checks",
                        "keyword_engines",
                        "prompt_engines",
                        "addons"
                      ],
                      "additionalProperties": false
                    },
                    "competitors": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "domain": {
                                "type": "string"
                              },
                              "name": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "source": {
                                "type": "string",
                                "enum": [
                                  "scan",
                                  "customer"
                                ]
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "suggested",
                                  "tracked"
                                ]
                              }
                            },
                            "required": [
                              "domain",
                              "name",
                              "source",
                              "status"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "limit": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "edited": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "items",
                        "limit",
                        "edited"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "keywords",
                    "prompts",
                    "limits",
                    "competitors"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/scans/{id}/start": {
      "post": {
        "operationId": "start_scan",
        "summary": "Confirms the business (with any changes) and starts measuring the website. A second start adds nothing.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 120,
                    "pattern": "^[^\\p{Cc}]*$"
                  },
                  "services": {
                    "maxItems": 10,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 80,
                      "pattern": "^[^\\p{Cc}]*$"
                    }
                  },
                  "city": {
                    "type": "string",
                    "maxLength": 80,
                    "pattern": "^[^\\p{Cc}]*$"
                  },
                  "country": {
                    "type": "string",
                    "pattern": "^([A-Za-z]{2})?$"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "started": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": [
                    "id",
                    "started"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/research/rivals": {
      "get": {
        "operationId": "suggest_rivals",
        "summary": "Rivals the business may want to follow, from two labelled sources: the businesses the AI assistants named in their answers, and the sites that rank for the business's own searches. Each row says how often (named in N of the answers asked, ranks for N of the searches). Directories, social sites and general sites (Reddit, YouTube, Wikipedia and the like) are left out. It reads the last scan: free, no new calls.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "answers_asked": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "searches_asked": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "rows": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "domain": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "named_in_answers": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "ranks_for_searches": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "sources": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "enum": [
                                "ai_answers",
                                "search_results"
                              ]
                            }
                          },
                          "following": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "name",
                          "domain",
                          "named_in_answers",
                          "ranks_for_searches",
                          "sources",
                          "following"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "gap": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "not_collected_yet",
                            "nothing_found"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "answers_asked",
                    "searches_asked",
                    "rows",
                    "gap"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/facts/undo": {
      "post": {
        "operationId": "undo_business_fact",
        "summary": "Brings back a line that was removed, when nothing newer took its place.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid"
                  }
                },
                "required": [
                  "id"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "fact": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "kind": {
                          "type": "string"
                        },
                        "value": {
                          "type": "string"
                        },
                        "meta": {
                          "anyOf": [
                            {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {}
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "by": {
                          "type": "string",
                          "enum": [
                            "owner",
                            "upnatus",
                            "agent"
                          ]
                        },
                        "at": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "kind",
                        "value",
                        "meta",
                        "by",
                        "at"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "fact"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/scans/{id}/unlock": {
      "post": {
        "operationId": "unlock_scan",
        "summary": "Mails a 6-digit code to the e-mail address of the visitor (a personal address too; the scan is flagged). The report opens when verify_scan_email gets the code.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "maxLength": 254,
                    "format": "email"
                  }
                },
                "required": [
                  "email"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "sent": {
                      "type": "boolean",
                      "const": true
                    },
                    "personal": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "id",
                    "sent",
                    "personal"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients/{client_id}/saved-keywords/remove": {
      "post": {
        "operationId": "unsave_keywords",
        "summary": "Removes keywords from the saved list for good. A keyword that is tracked keeps being tracked; this only forgets the saved copy.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "keywords": {
                    "minItems": 1,
                    "maxItems": 500,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 800
                    }
                  }
                },
                "required": [
                  "keywords"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "removed": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "removed"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/tasks/{id}": {
      "patch": {
        "operationId": "update_task",
        "summary": "Marks a task done, postponed, rejected or open again. It changes the checklist in Upnatus only, never a website or an ad account.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "open",
                      "done",
                      "postponed",
                      "rejected"
                    ]
                  },
                  "evidence": {
                    "type": "string",
                    "maxLength": 500,
                    "pattern": "^[^\\p{Cc}]*$"
                  },
                  "due_at": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "snooze_until": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "reason_code": {
                    "type": "string",
                    "enum": [
                      "not_relevant",
                      "already_done",
                      "wrong_data",
                      "too_risky",
                      "too_soon",
                      "no_budget",
                      "client_preference",
                      "other"
                    ]
                  }
                },
                "required": [
                  "client_id",
                  "status"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "open",
                        "done",
                        "postponed",
                        "rejected"
                      ]
                    },
                    "done_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "status",
                    "done_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/scans/{id}/verify": {
      "post": {
        "operationId": "verify_scan_email",
        "summary": "Checks the code that unlock_scan mailed. Only a right code stores the address and opens the worst problem in full.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required: a write without it is refused with 422 idempotency_key_required. Send the same value to repeat the call safely; the stored answer comes back. The same value with another body is refused (422 idempotency_key_reused).",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "maxLength": 254,
                    "format": "email"
                  },
                  "code": {
                    "type": "string",
                    "pattern": "^\\d{6}$"
                  }
                },
                "required": [
                  "email",
                  "code"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "report": {
                      "type": "object",
                      "properties": {
                        "business": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "domain": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "summary": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "country": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "language": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "services": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                "city": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                }
                              },
                              "required": [
                                "domain",
                                "name",
                                "summary",
                                "country",
                                "language",
                                "services",
                                "city"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "result": {
                          "anyOf": [
                            {},
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "data": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        },
                        "paid": {
                          "type": "boolean"
                        },
                        "locked": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "area": {
                                "type": "string"
                              },
                              "severity": {
                                "type": "number"
                              }
                            },
                            "required": [
                              "id",
                              "area",
                              "severity"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "fixes": {
                          "type": "object",
                          "properties": {
                            "status": {
                              "type": "string"
                            },
                            "items": {
                              "type": "array",
                              "items": {}
                            }
                          },
                          "required": [
                            "status",
                            "items"
                          ],
                          "additionalProperties": false
                        },
                        "weekly": {
                          "anyOf": [
                            {},
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "history": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "at": {
                                "type": "string"
                              },
                              "score": {
                                "type": [
                                  "number",
                                  "null"
                                ]
                              },
                              "problemCount": {
                                "type": "number"
                              }
                            },
                            "required": [
                              "at",
                              "score",
                              "problemCount"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "next_scan_at": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "weekly_mail": {
                          "type": "boolean"
                        },
                        "offer": {
                          "type": "object",
                          "properties": {
                            "primary": {
                              "type": "string",
                              "enum": [
                                "ads",
                                "seo"
                              ]
                            },
                            "reason": {
                              "type": "string",
                              "enum": [
                                "ads_tag_found",
                                "shop_without_ads_tag",
                                "no_ads_tag",
                                "tags_unread"
                              ]
                            },
                            "signals": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "ads_open": {
                              "type": "boolean"
                            },
                            "seo_open": {
                              "type": "boolean"
                            },
                            "agency_link": {
                              "type": "boolean"
                            },
                            "free_open": {
                              "type": "boolean"
                            },
                            "ads_closed_reason": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "enum": [
                                    "beta"
                                  ]
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "capabilities": {
                              "type": "object",
                              "properties": {
                                "google_write": {
                                  "type": "boolean"
                                },
                                "meta_write": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "google_write",
                                "meta_write"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "primary",
                            "reason",
                            "signals",
                            "ads_open",
                            "seo_open",
                            "agency_link",
                            "free_open",
                            "ads_closed_reason",
                            "capabilities"
                          ],
                          "additionalProperties": false
                        },
                        "kept": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "scans": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                "fixes": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                }
                              },
                              "required": [
                                "scans",
                                "fixes"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "can_start": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "business",
                        "result",
                        "data",
                        "paid",
                        "locked",
                        "fixes",
                        "weekly",
                        "history",
                        "next_scan_at",
                        "weekly_mail",
                        "offer",
                        "kept",
                        "can_start"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "id",
                    "report"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A guard refused it: sign-in type, role, scope, step-up or plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "409": {
            "description": "A guard refused it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guard"
                }
              }
            }
          },
          "422": {
            "description": "The input is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry-After says when to try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/runs/{run_id}/events": {
      "get": {
        "summary": "Follows a run as server-sent events. The run_id comes from a call that starts work (send_chat_message, seed_keyword_ideas, ask_keyword_top10, recheck_keywords and the like).",
        "description": "Events: run.progress, run.partial, run.deferred, run.done, run.failed. Each frame has `id` (its sequence number) and a JSON `data`. After a drop, send the last id as the Last-Event-ID header (or ?lastEventId=) to resume. The stream ends after run.done or run.failed.",
        "x-stability": "stable",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "run_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Last-Event-ID",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A text/event-stream.",
            "content": {
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in or key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found: no such run in this organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "request_id": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message",
              "request_id"
            ]
          },
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "missing": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "next_action": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "enum": [
                      "identity",
                      "payment",
                      "oauth",
                      "approval",
                      "wait"
                    ]
                  },
                  "url": {
                    "type": "string"
                  },
                  "why": {
                    "type": "string"
                  },
                  "resume": {
                    "type": "string"
                  },
                  "poll_after_s": {
                    "type": "integer"
                  }
                },
                "required": [
                  "kind",
                  "url",
                  "why"
                ]
              }
            ]
          }
        },
        "required": [
          "error",
          "code",
          "message",
          "missing",
          "next_action"
        ]
      },
      "Guard": {
        "type": "object",
        "properties": {
          "guard": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "missing": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "next_action": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "enum": [
                      "identity",
                      "payment",
                      "oauth",
                      "approval",
                      "wait"
                    ]
                  },
                  "url": {
                    "type": "string"
                  },
                  "why": {
                    "type": "string"
                  },
                  "resume": {
                    "type": "string"
                  },
                  "poll_after_s": {
                    "type": "integer"
                  }
                },
                "required": [
                  "kind",
                  "url",
                  "why"
                ]
              }
            ]
          },
          "who_can": {
            "type": "array",
            "items": {
              "enum": [
                "viewer",
                "operator",
                "admin",
                "owner"
              ]
            }
          }
        },
        "required": [
          "guard",
          "code",
          "message",
          "missing",
          "next_action"
        ]
      }
    }
  }
}
