{
  "openapi": "3.1.2",
  "info": {
    "title": "RightMessage API",
    "version": "1.0.0",
    "description": "Manage a RightMessage project programmatically: segment groups, questions, flows, widgets, offers, forms and campaigns, plus publishing, analytics and CSV exports.\n\n**Authentication.** Send an API token as `Authorization: Bearer <token>`. Create tokens in the dashboard under Your account \u203a API & AI access \u203a API tokens, or with `POST /tokens`. API access is included on the Scale plan and above. Each operation lists the token abilities it accepts in `x-rightmessage-abilities` (`read`, `write` or `publish`); a token created without abilities has `*`, which grants all of them. Hosted OAuth tokens work only with the MCP server at https://api.rightmessage.com/mcp/rightmessage and are rejected here.\n\n**Drafts.** Write operations change the project's draft. Call `POST /{teamPid}/publish` to make the draft live.\n\n**Errors.** Errors are JSON objects with a `message`; validation errors add an `errors` object keyed by field. Unknown paths return 404 JSON.\n\n**Rate limits.** 120 requests per minute for project endpoints and 60 per minute for token and connection endpoints, per account. A 429 response carries `Retry-After`.",
    "contact": {
      "name": "RightMessage support",
      "url": "https://rightmessage.com/developers",
      "email": "support@rightmessage.com"
    }
  },
  "servers": [
    {
      "url": "https://api.rightmessage.com/v1",
      "description": "Production"
    }
  ],
  "security": [
    {
      "apiToken": []
    }
  ],
  "paths": {
    "/tokens": {
      "get": {
        "operationId": "apiToken.index",
        "description": "Returns the authenticated user's API tokens. Token values are never returned after creation.\n\nAccepts any API token for the account; no token ability is required.",
        "summary": "List API tokens",
        "tags": ["API tokens"],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "integer"
                          },
                          "name": {
                            "type": "string"
                          },
                          "abilities": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "last_used_at": {
                            "type": ["string", "null"]
                          },
                          "created_at": {
                            "type": "string"
                          }
                        },
                        "required": ["id", "name", "abilities", "last_used_at", "created_at"]
                      }
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": []
      },
      "post": {
        "operationId": "apiToken.store",
        "description": "Creates an API token for the authenticated user. `abilities` may contain `read`, `write`, `publish` or `*`; omit it to grant `*` (every ability). The `plainTextToken` is returned only in this response. Requires a plan with API access.\n\nAccepts any API token for the account; no token ability is required.",
        "summary": "Create an API token",
        "tags": ["API tokens"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 255
                  },
                  "abilities": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": ["name"]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "abilities": {
                          "type": "string"
                        },
                        "plainTextToken": {
                          "type": "string"
                        }
                      },
                      "required": ["id", "name", "abilities", "plainTextToken"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "403": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/ValidationException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": []
      }
    },
    "/tokens/{tokenId}": {
      "delete": {
        "operationId": "apiToken.destroy",
        "description": "Revokes one of the authenticated user's API tokens.\n\nAccepts any API token for the account; no token ability is required.",
        "summary": "Delete an API token",
        "tags": ["API tokens"],
        "parameters": [
          {
            "name": "tokenId",
            "in": "path",
            "required": true,
            "description": "API token ID from the token list.",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": []
      }
    },
    "/{teamPid}/analytics/overview": {
      "get": {
        "operationId": "reporting.overview",
        "description": "Requires an API token with the `read` or `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Dashboard core metrics (visitors, personalizations, conversions) for a date range",
        "tags": ["Analytics"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "start",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "end",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "timezone",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "interval": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "string",
                              "enum": ["day"]
                            }
                          ]
                        },
                        "conversions": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "minItems": 0,
                          "maxItems": 0
                        },
                        "exposures": {
                          "type": "string"
                        },
                        "totalAnswers": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "integer",
                              "enum": [0]
                            }
                          ]
                        },
                        "answersData": {
                          "type": "object",
                          "additionalProperties": {
                            "type": "object",
                            "properties": {
                              "x": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "string",
                                    "enum": [""]
                                  }
                                ]
                              },
                              "y": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "integer",
                                    "enum": [0]
                                  }
                                ]
                              }
                            },
                            "required": ["x", "y"]
                          }
                        },
                        "totalRespondents": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "integer",
                              "enum": [0]
                            }
                          ]
                        },
                        "respondentsData": {
                          "type": "object",
                          "additionalProperties": {
                            "type": "object",
                            "properties": {
                              "x": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "string",
                                    "enum": [""]
                                  }
                                ]
                              },
                              "y": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "integer",
                                    "enum": [0]
                                  }
                                ]
                              }
                            },
                            "required": ["x", "y"]
                          }
                        },
                        "oldAnswersData": {
                          "type": "object",
                          "additionalProperties": {
                            "type": "object",
                            "properties": {
                              "x": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "string",
                                    "enum": [""]
                                  }
                                ]
                              },
                              "y": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "integer",
                                    "enum": [0]
                                  }
                                ]
                              }
                            },
                            "required": ["x", "y"]
                          }
                        },
                        "totalNewEnrichedPoints": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "integer",
                              "enum": [0]
                            }
                          ]
                        },
                        "newEnrichedPointsData": {
                          "type": "object",
                          "additionalProperties": {
                            "type": "object",
                            "properties": {
                              "x": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "string",
                                    "enum": [""]
                                  }
                                ]
                              },
                              "y": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "integer",
                                    "enum": [0]
                                  }
                                ]
                              }
                            },
                            "required": ["x", "y"]
                          }
                        },
                        "totalNewEnriches": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "integer",
                              "enum": [0]
                            }
                          ]
                        },
                        "newEnrichesData": {
                          "type": "object",
                          "additionalProperties": {
                            "type": "object",
                            "properties": {
                              "x": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "string",
                                    "enum": [""]
                                  }
                                ]
                              },
                              "y": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "integer",
                                    "enum": [0]
                                  }
                                ]
                              }
                            },
                            "required": ["x", "y"]
                          }
                        },
                        "toBeUsedForNewEnrichesData": {
                          "type": "object",
                          "properties": {
                            "syncUpsData": {
                              "type": "object",
                              "properties": {
                                "subscribersEnriched": {
                                  "type": "object",
                                  "properties": {
                                    "value": {
                                      "anyOf": [
                                        {
                                          "type": "string"
                                        },
                                        {
                                          "type": "integer",
                                          "enum": [0]
                                        }
                                      ]
                                    }
                                  },
                                  "required": ["value"]
                                },
                                "dataPointsEnriched": {
                                  "type": "object",
                                  "properties": {
                                    "value": {
                                      "type": "string"
                                    }
                                  },
                                  "required": ["value"]
                                },
                                "timeSeries": {
                                  "type": "object",
                                  "additionalProperties": {
                                    "type": "object",
                                    "properties": {
                                      "key": {
                                        "anyOf": [
                                          {
                                            "type": "string"
                                          },
                                          {
                                            "type": "string",
                                            "enum": [""]
                                          }
                                        ]
                                      },
                                      "subscribersEnriched": {
                                        "anyOf": [
                                          {
                                            "type": "string"
                                          },
                                          {
                                            "type": "integer",
                                            "enum": [0]
                                          }
                                        ]
                                      },
                                      "dataPointsEnriched": {
                                        "anyOf": [
                                          {
                                            "type": "string"
                                          },
                                          {
                                            "type": "integer",
                                            "enum": [0]
                                          }
                                        ]
                                      }
                                    },
                                    "required": ["key", "subscribersEnriched", "dataPointsEnriched"]
                                  }
                                }
                              },
                              "required": ["subscribersEnriched", "dataPointsEnriched", "timeSeries"]
                            }
                          },
                          "required": ["syncUpsData"]
                        },
                        "totalVisitorOffersConverted": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "integer",
                              "enum": [0]
                            }
                          ]
                        },
                        "offersData": {
                          "type": "object",
                          "properties": {
                            "visitorsExposed": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "integer",
                                  "enum": [0]
                                }
                              ]
                            },
                            "visitorsConverted": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "integer",
                                  "enum": [0]
                                }
                              ]
                            },
                            "timeSeries": {
                              "type": "object",
                              "additionalProperties": {
                                "type": "object",
                                "properties": {
                                  "x": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "string",
                                        "enum": [""]
                                      }
                                    ]
                                  },
                                  "visitorsExposed": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "integer",
                                        "enum": [0]
                                      }
                                    ]
                                  },
                                  "visitorsConverted": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "integer",
                                        "enum": [0]
                                      }
                                    ]
                                  }
                                },
                                "required": ["x", "visitorsExposed", "visitorsConverted"]
                              }
                            },
                            "offerBreakdowns": {
                              "type": "object",
                              "additionalProperties": {
                                "type": "object",
                                "properties": {
                                  "offerId": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "string",
                                        "enum": [""]
                                      }
                                    ]
                                  },
                                  "visitorsExposed": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "integer",
                                        "enum": [0]
                                      }
                                    ]
                                  },
                                  "visitorsConverted": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "integer",
                                        "enum": [0]
                                      }
                                    ]
                                  },
                                  "timeSeries": {
                                    "type": "object",
                                    "additionalProperties": {
                                      "type": "object",
                                      "properties": {
                                        "x": {
                                          "anyOf": [
                                            {
                                              "type": "string"
                                            },
                                            {
                                              "type": "string",
                                              "enum": [""]
                                            }
                                          ]
                                        },
                                        "visitorsExposed": {
                                          "anyOf": [
                                            {
                                              "type": "string"
                                            },
                                            {
                                              "type": "integer",
                                              "enum": [0]
                                            }
                                          ]
                                        },
                                        "visitorsConverted": {
                                          "anyOf": [
                                            {
                                              "type": "string"
                                            },
                                            {
                                              "type": "integer",
                                              "enum": [0]
                                            }
                                          ]
                                        }
                                      },
                                      "required": ["x", "visitorsExposed", "visitorsConverted"]
                                    }
                                  }
                                },
                                "required": ["offerId", "visitorsExposed", "visitorsConverted", "timeSeries"]
                              }
                            }
                          },
                          "required": ["visitorsExposed", "visitorsConverted", "timeSeries", "offerBreakdowns"]
                        },
                        "totalVisitorQuestionsConverted": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "integer",
                              "enum": [0]
                            }
                          ]
                        },
                        "questionsData": {
                          "type": "object",
                          "properties": {
                            "visitorsExposed": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "integer",
                                  "enum": [0]
                                }
                              ]
                            },
                            "visitorsConverted": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "integer",
                                  "enum": [0]
                                }
                              ]
                            },
                            "timeSeries": {
                              "type": "object",
                              "additionalProperties": {
                                "type": "object",
                                "properties": {
                                  "x": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "string",
                                        "enum": [""]
                                      }
                                    ]
                                  },
                                  "visitorsExposed": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "integer",
                                        "enum": [0]
                                      }
                                    ]
                                  },
                                  "visitorsConverted": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "integer",
                                        "enum": [0]
                                      }
                                    ]
                                  }
                                },
                                "required": ["x", "visitorsExposed", "visitorsConverted"]
                              }
                            },
                            "questionBreakdowns": {
                              "type": "object",
                              "additionalProperties": {
                                "type": "object",
                                "properties": {
                                  "questionId": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "string",
                                        "enum": [""]
                                      }
                                    ]
                                  },
                                  "visitorsExposed": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "integer",
                                        "enum": [0]
                                      }
                                    ]
                                  },
                                  "visitorsConverted": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "integer",
                                        "enum": [0]
                                      }
                                    ]
                                  },
                                  "timeSeries": {
                                    "type": "object",
                                    "additionalProperties": {
                                      "type": "object",
                                      "properties": {
                                        "x": {
                                          "anyOf": [
                                            {
                                              "type": "string"
                                            },
                                            {
                                              "type": "string",
                                              "enum": [""]
                                            }
                                          ]
                                        },
                                        "visitorsExposed": {
                                          "anyOf": [
                                            {
                                              "type": "string"
                                            },
                                            {
                                              "type": "integer",
                                              "enum": [0]
                                            }
                                          ]
                                        },
                                        "visitorsConverted": {
                                          "anyOf": [
                                            {
                                              "type": "string"
                                            },
                                            {
                                              "type": "integer",
                                              "enum": [0]
                                            }
                                          ]
                                        }
                                      },
                                      "required": ["x", "visitorsExposed", "visitorsConverted"]
                                    }
                                  }
                                },
                                "required": ["questionId", "visitorsExposed", "visitorsConverted", "timeSeries"]
                              }
                            }
                          },
                          "required": ["visitorsExposed", "visitorsConverted", "timeSeries", "questionBreakdowns"]
                        }
                      },
                      "required": [
                        "interval",
                        "conversions",
                        "exposures",
                        "totalAnswers",
                        "answersData",
                        "totalRespondents",
                        "respondentsData",
                        "oldAnswersData",
                        "totalNewEnrichedPoints",
                        "newEnrichedPointsData",
                        "totalNewEnriches",
                        "newEnrichesData",
                        "toBeUsedForNewEnrichesData",
                        "totalVisitorOffersConverted",
                        "offersData",
                        "totalVisitorQuestionsConverted",
                        "questionsData"
                      ]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/ValidationException"
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["read", "write"]
      }
    },
    "/{teamPid}/analytics/audience": {
      "get": {
        "operationId": "reporting.audience",
        "description": "Requires an API token with the `read` or `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Segment distribution across all dimensions",
        "tags": ["Analytics"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "start",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "end",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "timezone",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "segmentCounts": {
                              "type": "string"
                            }
                          },
                          "required": ["segmentCounts"]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "segmentCounts": {
                              "type": "array",
                              "items": {}
                            }
                          },
                          "required": ["segmentCounts"]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "segmentCounts": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              },
                              "minItems": 0,
                              "maxItems": 0
                            },
                            "goalTracking": {
                              "type": "object",
                              "properties": {
                                "status": {
                                  "type": "string",
                                  "const": "not_recorded"
                                },
                                "reason": {
                                  "type": "string",
                                  "const": "goal_not_attached_to_campaign_or_rightbar"
                                }
                              },
                              "required": ["status", "reason"]
                            }
                          },
                          "required": ["segmentCounts", "goalTracking"]
                        }
                      ]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/ValidationException"
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["read", "write"]
      }
    },
    "/{teamPid}/analytics/campaigns": {
      "get": {
        "operationId": "reporting.campaigns",
        "description": "Requires an API token with the `read` or `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Legacy per-campaign range figures plus the independent experiment decision",
        "tags": ["Analytics"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "start",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "end",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "timezone",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "campaign_id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "string"
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "Failed to fetch campaign performance."
                    }
                  },
                  "required": ["error"]
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/ValidationException"
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["read", "write"]
      }
    },
    "/{teamPid}/analytics/offers": {
      "get": {
        "operationId": "reporting.offers",
        "description": "Requires an API token with the `read` or `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Per-offer views, conversions, rates",
        "tags": ["Analytics"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "start",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "end",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "timezone",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "offer_ids[]",
            "in": "query",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {}
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/ValidationException"
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["read", "write"]
      }
    },
    "/{teamPid}/analytics/flows": {
      "get": {
        "operationId": "reporting.flows",
        "description": "Requires an API token with the `read` or `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Per-flow execution metrics (starts, completions, drop-off)",
        "tags": ["Analytics"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "start",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "end",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "timezone",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "flow_id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "flow_ids[]",
            "in": "query",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        ],
        "responses": {
          "503": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "const": "unavailable"
                    }
                  },
                  "required": ["status"]
                }
              }
            }
          },
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {}
                        }
                      },
                      "required": ["data"]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "flows": {
                              "type": "string"
                            }
                          },
                          "required": ["flows"]
                        }
                      },
                      "required": ["data"]
                    }
                  ]
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/ValidationException"
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["read", "write"]
      }
    },
    "/{teamPid}/campaigns": {
      "get": {
        "operationId": "campaign.index",
        "description": "Returns every personalization campaign in the project's current configuration, with its audiences and changes.\n\nRequires an API token with the `read` or `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "List campaigns",
        "tags": ["Campaigns"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/CampaignResource"
                      }
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["read", "write"]
      },
      "post": {
        "operationId": "campaign.store",
        "description": "Adds a campaign to the project's draft. Publish the draft to make it live.\n\nRequires an API token with the `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Create a campaign",
        "tags": ["Campaigns"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StoreCampaignRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "`CampaignResource`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/CampaignResource"
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "422": {
            "$ref": "#/components/responses/ValidationException"
          },
          "403": {
            "$ref": "#/components/responses/AuthorizationException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["write"]
      }
    },
    "/{teamPid}/campaigns/{campaign}": {
      "get": {
        "operationId": "campaign.show",
        "description": "Requires an API token with the `read` or `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Get a campaign",
        "tags": ["Campaigns"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "campaign",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "`CampaignResource`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/CampaignResource"
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["read", "write"]
      },
      "put": {
        "operationId": "campaign.update",
        "description": "Changes the draft only. Publish the draft to make it live.\n\nRequires an API token with the `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Update a campaign",
        "tags": ["Campaigns"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "campaign",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateCampaignRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "`CampaignResource`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/CampaignResource"
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "422": {
            "$ref": "#/components/responses/ValidationException"
          },
          "403": {
            "$ref": "#/components/responses/AuthorizationException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["write"]
      },
      "delete": {
        "operationId": "campaign.destroy",
        "description": "Removes the campaign from the draft. Publish the draft to make it live.\n\nRequires an API token with the `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Delete a campaign",
        "tags": ["Campaigns"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "campaign",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["write"]
      }
    },
    "/{teamPid}/campaigns/{campaign}/audiences/{audience}/test/start": {
      "post": {
        "operationId": "campaign.startAudienceTest",
        "description": "Starts a test on one campaign audience in the draft. The test begins splitting traffic after you publish.\n\nRequires an API token with the `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Start an audience A/B test",
        "tags": ["Campaigns"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "campaign",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "audience",
            "in": "path",
            "required": true,
            "description": "Audience ID, or `original` for the campaign's Original page test.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "campaign": {
                      "type": ["object", "null"]
                    },
                    "requires_publish": {
                      "type": "boolean"
                    }
                  },
                  "required": ["campaign", "requires_publish"]
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["write"]
      }
    },
    "/{teamPid}/campaigns/{campaign}/audiences/{audience}/test/restart": {
      "post": {
        "operationId": "campaign.restartAudienceTest",
        "description": "Restarts the audience's test with a fresh split in the draft. Takes effect after you publish.\n\nRequires an API token with the `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Restart an audience A/B test",
        "tags": ["Campaigns"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "campaign",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "audience",
            "in": "path",
            "required": true,
            "description": "Audience ID, or `original` for the campaign's Original page test.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "campaign": {
                      "type": ["object", "null"]
                    },
                    "requires_publish": {
                      "type": "boolean"
                    }
                  },
                  "required": ["campaign", "requires_publish"]
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["write"]
      }
    },
    "/{teamPid}/campaigns/{campaign}/audiences/{audience}/test/end": {
      "post": {
        "operationId": "campaign.endAudienceTest",
        "description": "Ends the audience's test in the draft and keeps the chosen version. For the Original page test, `deploy` shows the kept version to everyone. Takes effect after you publish.\n\nRequires an API token with the `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "End an audience A/B test",
        "tags": ["Campaigns"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "campaign",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "audience",
            "in": "path",
            "required": true,
            "description": "Audience ID, or `original` for the campaign's Original page test.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "keep_version": {
                    "type": "string",
                    "enum": ["A", "B", "C", "D"]
                  },
                  "deploy": {
                    "type": "boolean"
                  }
                },
                "required": ["keep_version"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "campaign": {
                      "type": ["object", "null"]
                    },
                    "requires_publish": {
                      "type": "boolean"
                    }
                  },
                  "required": ["campaign", "requires_publish"]
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/ValidationException"
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["write"]
      }
    },
    "/{teamPid}/campaigns/{campaign}/original/undeploy": {
      "post": {
        "operationId": "campaign.undeployOriginalWinner",
        "description": "Stops showing a deployed Original page winner in the draft. Takes effect after you publish.\n\nRequires an API token with the `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Undeploy an Original page winner",
        "tags": ["Campaigns"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "campaign",
            "in": "path",
            "required": true,
            "description": "Campaign ID.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "campaign": {
                      "type": ["object", "null"]
                    },
                    "requires_publish": {
                      "type": "boolean"
                    }
                  },
                  "required": ["campaign", "requires_publish"]
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["write"]
      }
    },
    "/{teamPid}/data/context": {
      "get": {
        "operationId": "data.context",
        "description": "Requires an API token with the `read` or `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Full AI-ready context (segments, answers, traffic, voice-of-customer)",
        "tags": ["Data"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "no_cache",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "ai_context": {
                              "type": ["object", "null"]
                            },
                            "segment_counts": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  },
                                  "question": {
                                    "type": ["string", "null"]
                                  },
                                  "segments": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string"
                                        },
                                        "name": {
                                          "type": "string"
                                        },
                                        "count": {
                                          "anyOf": [
                                            {
                                              "type": "string"
                                            },
                                            {
                                              "type": "integer",
                                              "enum": [0]
                                            }
                                          ]
                                        }
                                      },
                                      "required": ["id", "name", "count"]
                                    }
                                  }
                                },
                                "required": ["id", "name", "question", "segments"]
                              }
                            }
                          },
                          "required": ["ai_context", "segment_counts"]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "ai_output": {
                              "type": "string"
                            }
                          },
                          "required": ["ai_output"]
                        }
                      ]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["read", "write"]
      }
    },
    "/{teamPid}/data/dimension-sync": {
      "get": {
        "operationId": "data.dimensionSync",
        "description": "Requires an API token with the `read` or `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Dimension-to-ESP field mapping with Liquid template examples",
        "tags": ["Data"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "dimensionId": {
                            "type": "string"
                          },
                          "Name": {
                            "type": "string"
                          },
                          "fieldName": {
                            "type": "string"
                          },
                          "syncTo": {
                            "type": "string"
                          },
                          "questionText": {
                            "type": "string"
                          },
                          "segments": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "segmentId": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                },
                                "fieldValue": {
                                  "type": ["string", "null"]
                                }
                              },
                              "required": ["segmentId", "name", "fieldValue"]
                            }
                          },
                          "hasOtherOption": {
                            "type": "boolean"
                          },
                          "otherFieldName": {
                            "type": ["string", "null"]
                          }
                        },
                        "required": [
                          "dimensionId",
                          "Name",
                          "fieldName",
                          "syncTo",
                          "questionText",
                          "segments",
                          "hasOtherOption",
                          "otherFieldName"
                        ]
                      }
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["read", "write"]
      }
    },
    "/{teamPid}/data/flows/{flowId}": {
      "get": {
        "operationId": "data.flowSummary",
        "description": "Requires an API token with the `read` or `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Flow structure as YAML with execution path data",
        "tags": ["Data"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "flowId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "include_paths",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "flow_id": {
                          "type": "string"
                        },
                        "format": {
                          "type": "string",
                          "const": "yaml"
                        },
                        "content": {
                          "type": "string",
                          "description": "Convert flow to YAML format"
                        }
                      },
                      "required": ["flow_id", "format", "content"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["read", "write"]
      }
    },
    "/{teamPid}/data/status": {
      "get": {
        "operationId": "data.status",
        "description": "Requires an API token with the `read` or `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Whether tracking snippet is sending data",
        "tags": ["Data"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "last_update": {
                          "type": ["string", "null"]
                        },
                        "stale": {
                          "type": "string"
                        }
                      },
                      "required": ["last_update", "stale"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["read", "write"]
      }
    },
    "/{teamPid}/exports/{jobId}": {
      "get": {
        "operationId": "export.status",
        "description": "Poll until `status` is `completed`, then fetch the download URL. Jobs expire 24 hours after they start.\n\nRequires an API token with the `read` or `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Get export job status",
        "tags": ["Exports"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "description": "Job ID returned when the export started.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "created_at": {
                          "type": "string"
                        },
                        "total": {
                          "type": "integer"
                        },
                        "processed": {
                          "type": "integer"
                        },
                        "download_url": {
                          "type": "string"
                        },
                        "filename": {
                          "type": "string"
                        },
                        "expires_at": {
                          "type": "string"
                        }
                      },
                      "required": ["status", "message", "created_at", "total", "processed"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["read", "write"]
      }
    },
    "/{teamPid}/exports/{jobId}/download": {
      "get": {
        "operationId": "export.download",
        "description": "Returns a temporary download URL for a completed export. Returns 409 while the export is still running.\n\nRequires an API token with the `read` or `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Download completed export file",
        "tags": ["Exports"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "description": "Job ID returned when the export started.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "download_url": {
                          "type": ["string", "null"]
                        },
                        "filename": {
                          "type": ["string", "null"]
                        },
                        "expires_at": {
                          "type": ["string", "null"]
                        }
                      },
                      "required": ["download_url", "filename", "expires_at"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "Download URL not available."
                    }
                  },
                  "required": ["error"]
                }
              }
            }
          },
          "409": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "const": "Export is not yet complete."
                    },
                    "status": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "string",
                          "enum": ["unknown"]
                        }
                      ]
                    }
                  },
                  "required": ["error", "status"]
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["read", "write"]
      }
    },
    "/{teamPid}/exports/answers": {
      "post": {
        "operationId": "export.exportAnswers",
        "description": "Requires an API token with the `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Start async CSV export of survey responses (free-text \"other\" answers)",
        "tags": ["Exports"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "segment_id": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "job_id": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "const": "processing"
                        },
                        "message": {
                          "type": "string",
                          "const": "Export started."
                        }
                      },
                      "required": ["job_id", "status", "message"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/ValidationException"
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["write"]
      }
    },
    "/{teamPid}/exports/leads": {
      "post": {
        "operationId": "export.exportLeads",
        "description": "Requires an API token with the `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Start async CSV export of leads/subscribers feed",
        "tags": ["Exports"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "start": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "end": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "segment_id": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "job_id": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "const": "processing"
                        },
                        "message": {
                          "type": "string",
                          "const": "Export started."
                        }
                      },
                      "required": ["job_id", "status", "message"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/ValidationException"
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["write"]
      }
    },
    "/{teamPid}/flows": {
      "get": {
        "operationId": "flow.index",
        "description": "Returns every flow (survey, quiz or smart CTA sequence) in the project's current configuration.\n\nRequires an API token with the `read` or `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "List flows",
        "tags": ["Flows"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/FlowResource"
                      }
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["read", "write"]
      },
      "post": {
        "operationId": "flow.store",
        "description": "Adds a flow to the project's draft. Publish the draft to make it live.\n\nRequires an API token with the `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Create a flow",
        "tags": ["Flows"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StoreFlowRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "`FlowResource`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/FlowResource"
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "422": {
            "$ref": "#/components/responses/ValidationException"
          },
          "403": {
            "$ref": "#/components/responses/AuthorizationException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["write"]
      }
    },
    "/{teamPid}/flows/{flow}": {
      "get": {
        "operationId": "flow.show",
        "description": "Requires an API token with the `read` or `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Get a flow",
        "tags": ["Flows"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "flow",
            "in": "path",
            "required": true,
            "description": "Flow ID.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "`FlowResource`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/FlowResource"
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["read", "write"]
      },
      "put": {
        "operationId": "flow.update",
        "description": "Changes the draft only. Publish the draft to make it live.\n\nRequires an API token with the `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Update a flow",
        "tags": ["Flows"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "flow",
            "in": "path",
            "required": true,
            "description": "Flow ID.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateFlowRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "`FlowResource`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/FlowResource"
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "422": {
            "$ref": "#/components/responses/ValidationException"
          },
          "403": {
            "$ref": "#/components/responses/AuthorizationException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["write"]
      },
      "delete": {
        "operationId": "flow.destroy",
        "description": "Removes the flow from the draft. Publish the draft to make it live.\n\nRequires an API token with the `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Delete a flow",
        "tags": ["Flows"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "flow",
            "in": "path",
            "required": true,
            "description": "Flow ID.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["write"]
      }
    },
    "/{teamPid}/forms": {
      "get": {
        "operationId": "form.index",
        "description": "Returns every lead capture form in the project's current configuration.\n\nRequires an API token with the `read` or `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "List forms",
        "tags": ["Forms"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/FormResource"
                      }
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["read", "write"]
      },
      "post": {
        "operationId": "form.store",
        "description": "Adds a form to the project's draft. Publish the draft to make it live.\n\nRequires an API token with the `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Create a form",
        "tags": ["Forms"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StoreFormRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "`FormResource`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/FormResource"
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "422": {
            "$ref": "#/components/responses/ValidationException"
          },
          "403": {
            "$ref": "#/components/responses/AuthorizationException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["write"]
      }
    },
    "/{teamPid}/forms/{form}": {
      "get": {
        "operationId": "form.show",
        "description": "Requires an API token with the `read` or `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Get a form",
        "tags": ["Forms"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "form",
            "in": "path",
            "required": true,
            "description": "Form ID.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "`FormResource`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/FormResource"
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["read", "write"]
      },
      "put": {
        "operationId": "form.update",
        "description": "Changes the draft only. Publish the draft to make it live.\n\nRequires an API token with the `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Update a form",
        "tags": ["Forms"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "form",
            "in": "path",
            "required": true,
            "description": "Form ID.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateFormRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "`FormResource`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/FormResource"
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "422": {
            "$ref": "#/components/responses/ValidationException"
          },
          "403": {
            "$ref": "#/components/responses/AuthorizationException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["write"]
      },
      "delete": {
        "operationId": "form.destroy",
        "description": "Removes the form from the draft. Publish the draft to make it live.\n\nRequires an API token with the `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Delete a form",
        "tags": ["Forms"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "form",
            "in": "path",
            "required": true,
            "description": "Form ID.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["write"]
      }
    },
    "/oauth-connections": {
      "get": {
        "operationId": "oAuthConnection.index",
        "description": "Returns the MCP clients the authenticated user has connected through hosted OAuth, one entry per client.\n\nAccepts any API token for the account; no token ability is required.",
        "summary": "List OAuth connections",
        "tags": ["OAuth connections"],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "client_id": {
                            "type": "string"
                          },
                          "client_name": {
                            "type": "string"
                          },
                          "connected_at": {
                            "type": ["string", "null"]
                          },
                          "expires_at": {
                            "type": ["string", "null"]
                          }
                        },
                        "required": ["client_id", "client_name", "connected_at", "expires_at"]
                      }
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": []
      }
    },
    "/oauth-connections/{clientId}": {
      "delete": {
        "operationId": "oAuthConnection.destroy",
        "description": "Revokes every access and refresh token the authenticated user granted to this MCP client.\n\nAccepts any API token for the account; no token ability is required.",
        "summary": "Disconnect an OAuth client",
        "tags": ["OAuth connections"],
        "parameters": [
          {
            "name": "clientId",
            "in": "path",
            "required": true,
            "description": "OAuth client ID from the connection list.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "minItems": 0,
                  "maxItems": 0
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": []
      }
    },
    "/{teamPid}/offers": {
      "get": {
        "operationId": "offer.index",
        "description": "Returns every offer (call to action shown to visitors) in the project's current configuration.\n\nRequires an API token with the `read` or `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "List offers",
        "tags": ["Offers"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/OfferResource"
                      }
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["read", "write"]
      },
      "post": {
        "operationId": "offer.store",
        "description": "Adds an offer to the project's draft. Publish the draft to make it live.\n\nRequires an API token with the `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Create an offer",
        "tags": ["Offers"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StoreOfferRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "`OfferResource`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/OfferResource"
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "422": {
            "$ref": "#/components/responses/ValidationException"
          },
          "403": {
            "$ref": "#/components/responses/AuthorizationException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["write"]
      }
    },
    "/{teamPid}/offers/{offer}": {
      "get": {
        "operationId": "offer.show",
        "description": "Requires an API token with the `read` or `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Get an offer",
        "tags": ["Offers"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "offer",
            "in": "path",
            "required": true,
            "description": "Offer ID.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "`OfferResource`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/OfferResource"
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["read", "write"]
      },
      "put": {
        "operationId": "offer.update",
        "description": "Changes the draft only. Publish the draft to make it live.\n\nRequires an API token with the `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Update an offer",
        "tags": ["Offers"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "offer",
            "in": "path",
            "required": true,
            "description": "Offer ID.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateOfferRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "`OfferResource`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/OfferResource"
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "422": {
            "$ref": "#/components/responses/ValidationException"
          },
          "403": {
            "$ref": "#/components/responses/AuthorizationException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["write"]
      },
      "delete": {
        "operationId": "offer.destroy",
        "description": "Removes the offer from the draft. Publish the draft to make it live.\n\nRequires an API token with the `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Delete an offer",
        "tags": ["Offers"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "offer",
            "in": "path",
            "required": true,
            "description": "Offer ID.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["write"]
      }
    },
    "/{teamPid}/publish": {
      "post": {
        "operationId": "publish.publish",
        "description": "Publishes the project's draft configuration to the live site and rebuilds the tracking snippet. Returns 422 when there is nothing to publish or the draft fails validation, and 409 while experiment activation is busy.\n\nRequires an API token with the `publish` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Publish the draft",
        "tags": ["Publishing"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "tabId": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "published_at": {
                      "type": "string"
                    }
                  },
                  "required": ["message", "published_at"]
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["publish"]
      }
    },
    "/{teamPid}/questions": {
      "get": {
        "operationId": "question.index",
        "description": "Returns every survey question in the project's current configuration, with its answer options.\n\nRequires an API token with the `read` or `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "List questions",
        "tags": ["Questions"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/QuestionResource"
                      }
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["read", "write"]
      },
      "post": {
        "operationId": "question.store",
        "description": "Adds a question to the project's draft. Publish the draft to make it live.\n\nRequires an API token with the `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Create a question",
        "tags": ["Questions"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StoreQuestionRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "`QuestionResource`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/QuestionResource"
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "422": {
            "$ref": "#/components/responses/ValidationException"
          },
          "403": {
            "$ref": "#/components/responses/AuthorizationException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["write"]
      }
    },
    "/{teamPid}/questions/{question}": {
      "get": {
        "operationId": "question.show",
        "description": "Requires an API token with the `read` or `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Get a question",
        "tags": ["Questions"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "question",
            "in": "path",
            "required": true,
            "description": "Question ID.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "`QuestionResource`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/QuestionResource"
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["read", "write"]
      },
      "put": {
        "operationId": "question.update",
        "description": "Changes the draft only. Publish the draft to make it live.\n\nRequires an API token with the `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Update a question",
        "tags": ["Questions"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "question",
            "in": "path",
            "required": true,
            "description": "Question ID.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateQuestionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "`QuestionResource`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/QuestionResource"
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "422": {
            "$ref": "#/components/responses/ValidationException"
          },
          "403": {
            "$ref": "#/components/responses/AuthorizationException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["write"]
      },
      "delete": {
        "operationId": "question.destroy",
        "description": "Removes the question from the draft. Publish the draft to make it live.\n\nRequires an API token with the `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Delete a question",
        "tags": ["Questions"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "question",
            "in": "path",
            "required": true,
            "description": "Question ID.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["write"]
      }
    },
    "/{teamPid}/segment-groups": {
      "get": {
        "operationId": "segmentGroup.index",
        "description": "Returns every segment group (dimension) in the project's current configuration, with its segments and sync settings.\n\nRequires an API token with the `read` or `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "List segment groups",
        "tags": ["Segment groups"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/SegmentGroupResource"
                      }
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["read", "write"]
      },
      "post": {
        "operationId": "segmentGroup.store",
        "description": "Adds a segment group and its segments to the project's draft. Publish the draft to make it live.\n\nRequires an API token with the `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Create a segment group",
        "tags": ["Segment groups"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StoreSegmentGroupRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "`SegmentGroupResource`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/SegmentGroupResource"
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "422": {
            "$ref": "#/components/responses/ValidationException"
          },
          "403": {
            "$ref": "#/components/responses/AuthorizationException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["write"]
      }
    },
    "/{teamPid}/segment-groups/{segmentGroup}": {
      "get": {
        "operationId": "segmentGroup.show",
        "description": "Requires an API token with the `read` or `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Get a segment group",
        "tags": ["Segment groups"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "segmentGroup",
            "in": "path",
            "required": true,
            "description": "Segment group ID, e.g. `dim_abc123`.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "`SegmentGroupResource`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/SegmentGroupResource"
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["read", "write"]
      },
      "put": {
        "operationId": "segmentGroup.update",
        "description": "Changes the draft only. Publish the draft to make it live.\n\nRequires an API token with the `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Update a segment group",
        "tags": ["Segment groups"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "segmentGroup",
            "in": "path",
            "required": true,
            "description": "Segment group ID.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSegmentGroupRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "`SegmentGroupResource`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/SegmentGroupResource"
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "422": {
            "$ref": "#/components/responses/ValidationException"
          },
          "403": {
            "$ref": "#/components/responses/AuthorizationException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["write"]
      },
      "delete": {
        "operationId": "segmentGroup.destroy",
        "description": "Removes the segment group from the draft. Publish the draft to make it live.\n\nRequires an API token with the `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Delete a segment group",
        "tags": ["Segment groups"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "segmentGroup",
            "in": "path",
            "required": true,
            "description": "Segment group ID.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["write"]
      }
    },
    "/{teamPid}/widgets": {
      "get": {
        "operationId": "widget.index",
        "description": "Returns every widget (popup, bar, inline or other display surface) in the project's current configuration.\n\nRequires an API token with the `read` or `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "List widgets",
        "tags": ["Widgets"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WidgetResource"
                      }
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["read", "write"]
      },
      "post": {
        "operationId": "widget.store",
        "description": "Adds a widget to the project's draft. Publish the draft to make it live.\n\nRequires an API token with the `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Create a widget",
        "tags": ["Widgets"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StoreWidgetRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "`WidgetResource`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/WidgetResource"
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "422": {
            "$ref": "#/components/responses/ValidationException"
          },
          "403": {
            "$ref": "#/components/responses/AuthorizationException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["write"]
      }
    },
    "/{teamPid}/widgets/{widget}": {
      "get": {
        "operationId": "widget.show",
        "description": "Requires an API token with the `read` or `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Get a widget",
        "tags": ["Widgets"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "widget",
            "in": "path",
            "required": true,
            "description": "Widget ID.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "`WidgetResource`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/WidgetResource"
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["read", "write"]
      },
      "put": {
        "operationId": "widget.update",
        "description": "Changes the draft only. Publish the draft to make it live.\n\nRequires an API token with the `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Update a widget",
        "tags": ["Widgets"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "widget",
            "in": "path",
            "required": true,
            "description": "Widget ID.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateWidgetRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "`WidgetResource`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/WidgetResource"
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "422": {
            "$ref": "#/components/responses/ValidationException"
          },
          "403": {
            "$ref": "#/components/responses/AuthorizationException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["write"]
      },
      "delete": {
        "operationId": "widget.destroy",
        "description": "Removes the widget from the draft. Publish the draft to make it live.\n\nRequires an API token with the `write` ability. Tokens created without abilities have `*`, which grants every ability.",
        "summary": "Delete a widget",
        "tags": ["Widgets"],
        "parameters": [
          {
            "name": "teamPid",
            "in": "path",
            "required": true,
            "description": "Project ID: the public `pid` that appears in dashboard URLs (`app.rightmessage.com/{teamPid}/\u2026`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "widget",
            "in": "path",
            "required": true,
            "description": "Widget ID.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "404": {
            "$ref": "#/components/responses/ModelNotFoundException"
          },
          "401": {
            "description": "Missing, invalid or revoked API token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "`Bearer realm=\"rightmessage-api\"`, plus `error=\"invalid_token\"` when a token was sent but rejected.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute for project endpoints, 60 per minute for token and connection endpoints. Retry after the `Retry-After` seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error overview."
                    }
                  },
                  "required": ["message"]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "x-rightmessage-abilities": ["write"]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiToken": {
        "type": "http",
        "description": "RightMessage API token, sent as `Authorization: Bearer <token>`. Create one in the dashboard under Your account \u203a API & AI access \u203a API tokens, or with `POST /tokens`.",
        "scheme": "bearer"
      }
    },
    "schemas": {
      "CampaignResource": {
        "type": "object",
        "properties": {
          "id": {
            "type": ["string", "null"]
          },
          "name": {
            "type": ["string", "null"]
          },
          "is_active": {
            "type": ["string", "boolean"]
          },
          "base_url": {
            "type": ["string", "null"]
          },
          "testing": {
            "type": ["string", "null"]
          },
          "goal_ids": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "minItems": 0,
                "maxItems": 0
              }
            ]
          },
          "outcome": {
            "type": "string"
          },
          "changes": {
            "type": "array",
            "items": {}
          },
          "audience_tests": {
            "type": "string"
          },
          "original_deployment": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "is_active",
          "base_url",
          "testing",
          "goal_ids",
          "changes",
          "audience_tests",
          "original_deployment"
        ],
        "title": "CampaignResource"
      },
      "FlowResource": {
        "type": "object",
        "properties": {
          "id": {
            "type": ["string", "null"]
          },
          "name": {
            "type": ["string", "null"]
          },
          "definition": {
            "type": ["string", "null"]
          }
        },
        "required": ["id", "name", "definition"],
        "title": "FlowResource"
      },
      "FormResource": {
        "type": "object",
        "properties": {
          "id": {
            "type": ["string", "null"]
          },
          "name": {
            "type": ["string", "null"]
          },
          "is_enabled": {
            "type": ["string", "boolean"]
          },
          "parts": {
            "type": "object",
            "properties": {
              "title": {
                "type": ["string", "null"]
              },
              "description": {
                "type": ["string", "null"]
              },
              "button_text": {
                "type": ["string", "null"]
              },
              "image_url": {
                "type": ["string", "null"]
              }
            },
            "required": ["title", "description", "button_text", "image_url"]
          },
          "action": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "form"
              },
              "settings": {
                "type": "object",
                "properties": {
                  "platform": {
                    "type": ["string", "null"]
                  },
                  "form_ids": {
                    "type": ["string", "null"]
                  },
                  "thanks_message": {
                    "type": ["string", "null"]
                  },
                  "fields": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "string"
                        },
                        "minItems": 0,
                        "maxItems": 0
                      }
                    ]
                  },
                  "show_labels": {
                    "type": ["string", "boolean"]
                  }
                },
                "required": ["platform", "form_ids", "thanks_message", "fields", "show_labels"]
              }
            },
            "required": ["type", "settings"]
          }
        },
        "required": ["id", "name", "is_enabled", "parts", "action"],
        "title": "FormResource"
      },
      "OfferResource": {
        "type": "object",
        "properties": {
          "id": {
            "type": ["string", "null"]
          },
          "name": {
            "type": ["string", "null"]
          },
          "is_enabled": {
            "type": ["string", "boolean"]
          },
          "parts": {
            "type": "object",
            "properties": {
              "title": {
                "type": ["string", "null"]
              },
              "description": {
                "type": ["string", "null"]
              },
              "button_text": {
                "type": ["string", "null"]
              },
              "image_url": {
                "type": ["string", "null"]
              }
            },
            "required": ["title", "description", "button_text", "image_url"]
          },
          "action": {
            "type": "object",
            "properties": {
              "type": {
                "type": ["string", "null"]
              },
              "settings": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": ["string", "null"]
                  },
                  "thanks_message": {
                    "type": ["string", "null"]
                  },
                  "platform": {
                    "type": ["string", "null"]
                  },
                  "tag_ids": {
                    "type": ["string", "null"]
                  }
                },
                "required": ["url", "thanks_message", "platform", "tag_ids"]
              }
            },
            "required": ["type", "settings"]
          }
        },
        "required": ["id", "name", "is_enabled", "parts", "action"],
        "title": "OfferResource"
      },
      "QuestionResource": {
        "type": "object",
        "properties": {
          "id": {
            "type": ["string", "null"]
          },
          "text": {
            "type": ["string", "null"]
          },
          "sync_to": {
            "type": ["string", "null"]
          },
          "sync_to_field": {
            "type": ["string", "null"]
          },
          "display_options": {
            "type": "string"
          },
          "segment_group_id": {
            "type": ["string", "null"]
          },
          "display_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "string",
                "enum": ["buttons"]
              }
            ]
          },
          "input_type": {
            "type": ["string", "null"]
          },
          "input_settings": {
            "type": ["array", "null"],
            "items": {}
          },
          "randomize_options": {
            "type": ["string", "boolean"]
          },
          "options": {
            "type": "object",
            "additionalProperties": {
              "type": "object",
              "properties": {
                "id": {
                  "anyOf": [
                    {
                      "type": ["string", "null"]
                    },
                    {}
                  ]
                },
                "segment_id": {
                  "anyOf": [
                    {
                      "type": ["string", "null"]
                    },
                    {}
                  ]
                },
                "label": {
                  "anyOf": [
                    {
                      "type": ["string", "null"]
                    },
                    {}
                  ]
                },
                "conditions": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {}
                  ]
                },
                "scores": {
                  "anyOf": [
                    {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "minItems": 0,
                          "maxItems": 0
                        }
                      ]
                    },
                    {}
                  ]
                }
              },
              "required": ["id", "segment_id", "label", "conditions", "scores"],
              "additionalProperties": {}
            }
          },
          "other_option": {
            "type": ["array", "null"],
            "items": {}
          }
        },
        "required": [
          "id",
          "text",
          "sync_to",
          "sync_to_field",
          "display_options",
          "segment_group_id",
          "display_type",
          "input_type",
          "input_settings",
          "randomize_options",
          "options",
          "other_option"
        ],
        "additionalProperties": {},
        "title": "QuestionResource"
      },
      "SegmentGroupResource": {
        "type": "object",
        "properties": {
          "id": {
            "type": ["string", "null"]
          },
          "name": {
            "type": ["string", "null"]
          },
          "semantic_type": {
            "type": ["string", "null"]
          },
          "allow_multiple": {
            "type": ["string", "boolean"]
          },
          "segments": {
            "type": "object",
            "additionalProperties": {
              "type": "object",
              "properties": {
                "id": {
                  "type": ["string", "null"]
                },
                "name": {
                  "type": ["string", "null"]
                }
              },
              "required": ["id", "name"]
            }
          },
          "signals": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "minItems": 0,
                "maxItems": 0
              }
            ]
          },
          "sync_platform": {
            "type": ["string", "null"]
          },
          "sync_field": {
            "type": ["string", "null"]
          },
          "sync_mode": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "string",
                "enum": ["field"]
              }
            ]
          },
          "sync_mappings": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "semantic_type",
          "allow_multiple",
          "segments",
          "signals",
          "sync_platform",
          "sync_field",
          "sync_mode",
          "sync_mappings"
        ],
        "title": "SegmentGroupResource"
      },
      "StoreCampaignRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "is_active": {
            "type": "boolean"
          },
          "base_url": {
            "type": ["string", "null"],
            "maxLength": 500
          },
          "testing": {
            "type": "object",
            "properties": {
              "is_enabled": {
                "type": "boolean"
              },
              "withhold": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100
              }
            }
          },
          "goal_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "outcome": {
            "type": "string",
            "enum": ["any_goal", "primary_goal"]
          },
          "changes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": ["string", "null"]
                },
                "variant_id": {
                  "type": ["string", "null"]
                },
                "targeting": {
                  "type": ["array", "null"],
                  "items": {
                    "type": "string"
                  }
                },
                "selector": {
                  "type": ["string", "null"]
                },
                "segment_ids": {
                  "type": ["string", "null"]
                },
                "page": {
                  "type": ["string", "null"]
                },
                "content": {
                  "type": ["string", "null"]
                },
                "visibility": {
                  "type": ["string", "null"],
                  "enum": ["show", "hide", null]
                },
                "style": {
                  "type": ["array", "null"],
                  "items": {
                    "type": "string"
                  }
                },
                "attr": {
                  "type": ["array", "null"],
                  "items": {
                    "type": "string"
                  }
                },
                "add_classes": {
                  "type": ["string", "null"]
                },
                "remove_classes": {
                  "type": ["string", "null"]
                }
              }
            }
          }
        },
        "required": ["name"],
        "title": "StoreCampaignRequest"
      },
      "StoreFlowRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "definition": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": ["root"]
              },
              "child": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          }
        },
        "required": ["name"],
        "title": "StoreFlowRequest"
      },
      "StoreFormRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "is_enabled": {
            "type": "boolean"
          },
          "parts": {
            "type": "object",
            "properties": {
              "title": {
                "type": "string",
                "maxLength": 500
              },
              "description": {
                "type": ["string", "null"]
              },
              "button_text": {
                "type": ["string", "null"],
                "maxLength": 255
              }
            }
          },
          "action": {
            "type": "object",
            "properties": {
              "settings": {
                "type": "object",
                "properties": {
                  "platform": {
                    "type": "string"
                  },
                  "event_name": {
                    "type": "string"
                  },
                  "form_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "fields": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "display_type": {
                          "type": "string"
                        },
                        "label": {
                          "type": "string",
                          "maxLength": 255
                        },
                        "width": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 6
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "required": ["name"],
        "title": "StoreFormRequest"
      },
      "StoreOfferRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "is_enabled": {
            "type": "boolean"
          },
          "parts": {
            "type": "object",
            "properties": {
              "title": {
                "type": "string",
                "maxLength": 500
              },
              "description": {
                "type": ["string", "null"]
              },
              "button_text": {
                "type": ["string", "null"],
                "maxLength": 255
              },
              "image_url": {
                "type": ["string", "null"],
                "maxLength": 2000
              }
            }
          },
          "action": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": ["link", "tag", "event", "automation", "list", "contact"]
              },
              "settings": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": ["string", "null"],
                    "maxLength": 2000
                  },
                  "thanks_message": {
                    "type": ["string", "null"]
                  },
                  "platform": {
                    "type": "string"
                  },
                  "form_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "tag_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "list_id": {
                    "type": "string"
                  },
                  "automation_id": {
                    "type": "string"
                  },
                  "redirect_url": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "redirectFunnel": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "event_name": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "required": ["name"],
        "title": "StoreOfferRequest"
      },
      "StoreQuestionRequest": {
        "type": "object",
        "properties": {
          "text": {
            "type": "string",
            "maxLength": 500
          },
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "description": {
            "type": ["string", "null"]
          },
          "sync_to": {
            "type": ["string", "null"]
          },
          "sync_to_field": {
            "type": ["string", "null"]
          },
          "display_options": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "segment_group_id": {
            "type": ["string", "null"]
          },
          "display_type": {
            "type": "string",
            "enum": ["buttons", "image", "list", "radio", "input"]
          },
          "input_type": {
            "type": ["string", "null"],
            "enum": [
              "text",
              "textarea",
              "number",
              "email",
              "phone",
              "name",
              "address",
              "country",
              "url",
              "date",
              "rating",
              "nps",
              null
            ]
          },
          "input_settings": {
            "type": "object",
            "properties": {
              "placeholder": {
                "type": "string",
                "maxLength": 255
              },
              "validation": {
                "type": "string"
              },
              "required": {
                "type": "boolean"
              },
              "nextButtonLabel": {
                "type": ["string", "null"]
              },
              "skipButtonLabel": {
                "type": ["string", "null"]
              },
              "numberType": {
                "type": "string",
                "enum": ["plain", "currency", "percentage"]
              },
              "currency": {
                "type": "string"
              },
              "prefix": {
                "type": "string"
              },
              "suffix": {
                "type": "string"
              },
              "min": {
                "type": ["number", "null"]
              },
              "max": {
                "type": ["number", "null"]
              },
              "step": {
                "type": ["number", "null"]
              },
              "display": {
                "type": "string",
                "enum": ["field", "slider"]
              },
              "defaultValue": {
                "type": ["number", "null"]
              },
              "minLabel": {
                "type": "string"
              },
              "maxLabel": {
                "type": "string"
              },
              "ratingMax": {
                "type": "integer",
                "minimum": 3,
                "maximum": 10
              },
              "nameFormat": {
                "type": "string",
                "enum": ["first_last", "full"]
              },
              "defaultCountry": {
                "type": "string"
              },
              "partLabels": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "partPlaceholders": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "pinnedCountries": {
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^[A-Za-z]{2}$"
                }
              },
              "excludedCountries": {
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^[A-Za-z]{2}$"
                }
              },
              "detectCountry": {
                "type": "boolean"
              },
              "dateRange": {
                "type": "string",
                "enum": ["any", "past", "future"]
              },
              "dateRangeDays": {
                "type": "integer",
                "minimum": 1,
                "maximum": 36500
              },
              "mobileOnly": {
                "type": "boolean"
              },
              "suggestTypoFixes": {
                "type": "boolean"
              },
              "identify": {
                "type": "boolean"
              },
              "contactAction": {
                "type": ["object", "null"],
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": ["contact", "form", "list", "tag"]
                  },
                  "settings": {
                    "type": "object",
                    "properties": {
                      "partnerName": {
                        "type": "string"
                      },
                      "formIds": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "listIds": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "tagIds": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              "consent": {
                "type": "object",
                "properties": {
                  "disclosure": {
                    "type": "object",
                    "properties": {
                      "enabled": {
                        "type": "boolean"
                      },
                      "text": {
                        "type": "string"
                      }
                    }
                  },
                  "checkbox": {
                    "type": "object",
                    "properties": {
                      "enabled": {
                        "type": "boolean"
                      },
                      "label": {
                        "type": "string"
                      }
                    }
                  }
                }
              },
              "syncFieldMap": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "randomize_options": {
            "type": "boolean"
          },
          "options": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "label": {
                  "type": "string",
                  "maxLength": 255
                },
                "segment_id": {
                  "type": ["string", "null"]
                },
                "id": {
                  "type": "string"
                },
                "image_url": {
                  "type": "string"
                },
                "conditions": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "scores": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "other_option": {
            "type": "object",
            "properties": {
              "enabled": {
                "type": "boolean"
              },
              "label": {
                "type": "string",
                "maxLength": 255
              },
              "input_type": {
                "type": "string"
              },
              "prompt": {
                "type": "string",
                "maxLength": 500
              },
              "placeholder": {
                "type": ["string", "null"]
              },
              "sync_to_custom_field": {
                "type": ["string", "null"]
              }
            }
          }
        },
        "required": ["text"],
        "title": "StoreQuestionRequest"
      },
      "StoreSegmentGroupRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "semantic_type": {
            "type": ["string", "null"],
            "enum": ["INDUSTRY", "ROLE", "COMPANY_SIZE", "GOAL", "PROBLEM", "STAGE", "CUSTOM", null]
          },
          "allow_multiple": {
            "type": "boolean"
          },
          "segments": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "maxLength": 255
                }
              }
            }
          },
          "sync_platform": {
            "type": ["string", "null"]
          },
          "sync_field": {
            "type": ["string", "null"]
          },
          "sync_mode": {
            "type": "string",
            "enum": ["field", "tag"]
          },
          "sync_mappings": {
            "type": "array",
            "items": {
              "type": ["string", "null"]
            }
          }
        },
        "required": ["name"],
        "title": "StoreSegmentGroupRequest"
      },
      "StoreWidgetRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "type": {
            "type": "string",
            "enum": ["modal", "bar", "toaster", "inline", "takeover"]
          },
          "flow_id": {
            "type": ["string", "null"]
          },
          "is_enabled": {
            "type": "boolean"
          },
          "frequency": {
            "type": "string",
            "enum": ["startover", "immediately", "pageview", "session", "none"]
          },
          "visibility": {
            "type": "object",
            "properties": {
              "conditions": {
                "type": ["array", "null"],
                "items": {
                  "type": "string"
                }
              },
              "show_on_specific_pages": {
                "type": "string"
              },
              "show_pages": {
                "type": "string"
              },
              "hide_on_specific_pages": {
                "type": "string"
              },
              "hide_pages": {
                "type": "string"
              },
              "isWhitelistEnabled": {
                "type": "string"
              },
              "whitelist": {
                "type": "string"
              },
              "isBlacklistEnabled": {
                "type": "string"
              },
              "blacklist": {
                "type": "string"
              },
              "trigger": {
                "type": ["string", "null"]
              }
            }
          },
          "options": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": ["name"],
        "title": "StoreWidgetRequest"
      },
      "UpdateCampaignRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "is_active": {
            "type": "boolean"
          },
          "base_url": {
            "type": ["string", "null"],
            "maxLength": 500
          },
          "testing": {
            "type": "object",
            "properties": {
              "is_enabled": {
                "type": "boolean"
              },
              "withhold": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100
              }
            }
          },
          "goal_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "outcome": {
            "type": "string",
            "enum": ["any_goal", "primary_goal"]
          },
          "audience_tests": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "variant_id": {
                  "type": "string"
                },
                "test": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              },
              "required": ["variant_id", "test"]
            }
          },
          "changes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": ["string", "null"]
                },
                "variant_id": {
                  "type": ["string", "null"]
                },
                "version_id": {
                  "type": "string",
                  "enum": ["A", "B", "C", "D"]
                },
                "kind": {
                  "type": "string",
                  "enum": ["override"]
                },
                "action_id": {
                  "type": "string"
                },
                "skip": {
                  "type": "boolean"
                },
                "fields": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "targeting": {
                  "type": ["array", "null"],
                  "items": {
                    "type": "string"
                  }
                },
                "selector": {
                  "type": ["string", "null"]
                },
                "segment_ids": {
                  "type": ["string", "null"]
                },
                "page": {
                  "type": ["string", "null"]
                },
                "content": {
                  "type": ["string", "null"]
                },
                "visibility": {
                  "type": ["string", "null"],
                  "enum": ["show", "hide", null]
                },
                "style": {
                  "type": ["array", "null"],
                  "items": {
                    "type": "string"
                  }
                },
                "attr": {
                  "type": ["array", "null"],
                  "items": {
                    "type": "string"
                  }
                },
                "add_classes": {
                  "type": ["string", "null"]
                },
                "remove_classes": {
                  "type": ["string", "null"]
                }
              }
            }
          }
        },
        "title": "UpdateCampaignRequest"
      },
      "UpdateFlowRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "definition": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": ["root"]
              },
              "child": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          }
        },
        "title": "UpdateFlowRequest"
      },
      "UpdateFormRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "is_enabled": {
            "type": "boolean"
          },
          "parts": {
            "type": "object",
            "properties": {
              "title": {
                "type": "string",
                "maxLength": 500
              },
              "description": {
                "type": ["string", "null"]
              },
              "button_text": {
                "type": ["string", "null"],
                "maxLength": 255
              }
            }
          },
          "action": {
            "type": "object",
            "properties": {
              "settings": {
                "type": "object",
                "properties": {
                  "platform": {
                    "type": "string"
                  },
                  "event_name": {
                    "type": "string"
                  },
                  "form_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "fields": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "display_type": {
                          "type": "string"
                        },
                        "label": {
                          "type": "string",
                          "maxLength": 255
                        },
                        "width": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 6
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "title": "UpdateFormRequest"
      },
      "UpdateOfferRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "is_enabled": {
            "type": "boolean"
          },
          "parts": {
            "type": "object",
            "properties": {
              "title": {
                "type": "string",
                "maxLength": 500
              },
              "description": {
                "type": ["string", "null"]
              },
              "button_text": {
                "type": ["string", "null"],
                "maxLength": 255
              },
              "image_url": {
                "type": ["string", "null"],
                "maxLength": 2000
              }
            }
          },
          "action": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": ["link", "tag", "event", "automation", "list", "contact"]
              },
              "settings": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": ["string", "null"],
                    "maxLength": 2000
                  },
                  "thanks_message": {
                    "type": ["string", "null"]
                  },
                  "platform": {
                    "type": "string"
                  },
                  "form_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "tag_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "list_id": {
                    "type": "string"
                  },
                  "automation_id": {
                    "type": "string"
                  },
                  "redirect_url": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "redirectFunnel": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "event_name": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "title": "UpdateOfferRequest"
      },
      "UpdateQuestionRequest": {
        "type": "object",
        "properties": {
          "text": {
            "type": "string",
            "maxLength": 500
          },
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "description": {
            "type": ["string", "null"]
          },
          "sync_to": {
            "type": ["string", "null"]
          },
          "sync_to_field": {
            "type": ["string", "null"]
          },
          "display_options": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "segment_group_id": {
            "type": ["string", "null"]
          },
          "display_type": {
            "type": "string",
            "enum": ["buttons", "image", "list", "radio", "input"]
          },
          "input_type": {
            "type": ["string", "null"],
            "enum": [
              "text",
              "textarea",
              "number",
              "email",
              "phone",
              "name",
              "address",
              "country",
              "url",
              "date",
              "rating",
              "nps",
              null
            ]
          },
          "input_settings": {
            "type": "object",
            "properties": {
              "placeholder": {
                "type": "string",
                "maxLength": 255
              },
              "validation": {
                "type": "string"
              },
              "required": {
                "type": "boolean"
              },
              "nextButtonLabel": {
                "type": ["string", "null"]
              },
              "skipButtonLabel": {
                "type": ["string", "null"]
              },
              "numberType": {
                "type": "string",
                "enum": ["plain", "currency", "percentage"]
              },
              "currency": {
                "type": "string"
              },
              "prefix": {
                "type": "string"
              },
              "suffix": {
                "type": "string"
              },
              "min": {
                "type": ["number", "null"]
              },
              "max": {
                "type": ["number", "null"]
              },
              "step": {
                "type": ["number", "null"]
              },
              "display": {
                "type": "string",
                "enum": ["field", "slider"]
              },
              "defaultValue": {
                "type": ["number", "null"]
              },
              "minLabel": {
                "type": "string"
              },
              "maxLabel": {
                "type": "string"
              },
              "ratingMax": {
                "type": "integer",
                "minimum": 3,
                "maximum": 10
              },
              "nameFormat": {
                "type": "string",
                "enum": ["first_last", "full"]
              },
              "defaultCountry": {
                "type": "string"
              },
              "partLabels": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "partPlaceholders": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "pinnedCountries": {
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^[A-Za-z]{2}$"
                }
              },
              "excludedCountries": {
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^[A-Za-z]{2}$"
                }
              },
              "detectCountry": {
                "type": "boolean"
              },
              "dateRange": {
                "type": "string",
                "enum": ["any", "past", "future"]
              },
              "dateRangeDays": {
                "type": "integer",
                "minimum": 1,
                "maximum": 36500
              },
              "mobileOnly": {
                "type": "boolean"
              },
              "suggestTypoFixes": {
                "type": "boolean"
              },
              "identify": {
                "type": "boolean"
              },
              "contactAction": {
                "type": ["object", "null"],
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": ["contact", "form", "list", "tag"]
                  },
                  "settings": {
                    "type": "object",
                    "properties": {
                      "partnerName": {
                        "type": "string"
                      },
                      "formIds": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "listIds": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "tagIds": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              "consent": {
                "type": "object",
                "properties": {
                  "disclosure": {
                    "type": "object",
                    "properties": {
                      "enabled": {
                        "type": "boolean"
                      },
                      "text": {
                        "type": "string"
                      }
                    }
                  },
                  "checkbox": {
                    "type": "object",
                    "properties": {
                      "enabled": {
                        "type": "boolean"
                      },
                      "label": {
                        "type": "string"
                      }
                    }
                  }
                }
              },
              "syncFieldMap": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "randomize_options": {
            "type": "boolean"
          },
          "options": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "label": {
                  "type": "string",
                  "maxLength": 255
                },
                "segment_id": {
                  "type": ["string", "null"]
                },
                "id": {
                  "type": "string"
                },
                "image_url": {
                  "type": "string"
                },
                "conditions": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "scores": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "other_option": {
            "type": "object",
            "properties": {
              "enabled": {
                "type": "boolean"
              },
              "label": {
                "type": "string",
                "maxLength": 255
              },
              "input_type": {
                "type": "string"
              },
              "prompt": {
                "type": "string",
                "maxLength": 500
              },
              "placeholder": {
                "type": ["string", "null"]
              },
              "sync_to_custom_field": {
                "type": ["string", "null"]
              }
            }
          }
        },
        "title": "UpdateQuestionRequest"
      },
      "UpdateSegmentGroupRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "semantic_type": {
            "type": ["string", "null"],
            "enum": ["INDUSTRY", "ROLE", "COMPANY_SIZE", "GOAL", "PROBLEM", "STAGE", "CUSTOM", null]
          },
          "allow_multiple": {
            "type": "boolean"
          },
          "segments": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "maxLength": 255
                }
              }
            }
          },
          "sync_platform": {
            "type": ["string", "null"]
          },
          "sync_field": {
            "type": ["string", "null"]
          },
          "sync_mode": {
            "type": "string",
            "enum": ["field", "tag"]
          },
          "sync_mappings": {
            "type": "array",
            "items": {
              "type": ["string", "null"]
            }
          }
        },
        "title": "UpdateSegmentGroupRequest"
      },
      "UpdateWidgetRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "type": {
            "type": "string",
            "enum": ["modal", "bar", "toaster", "inline", "takeover"]
          },
          "flow_id": {
            "type": ["string", "null"]
          },
          "is_enabled": {
            "type": "boolean"
          },
          "frequency": {
            "type": "string",
            "enum": ["startover", "immediately", "pageview", "session", "none"]
          },
          "visibility": {
            "type": "object",
            "properties": {
              "conditions": {
                "type": ["array", "null"],
                "items": {
                  "type": "string"
                }
              },
              "show_on_specific_pages": {
                "type": "string"
              },
              "show_pages": {
                "type": "string"
              },
              "hide_on_specific_pages": {
                "type": "string"
              },
              "hide_pages": {
                "type": "string"
              },
              "isWhitelistEnabled": {
                "type": "string"
              },
              "whitelist": {
                "type": "string"
              },
              "isBlacklistEnabled": {
                "type": "string"
              },
              "blacklist": {
                "type": "string"
              },
              "trigger": {
                "type": ["string", "null"]
              }
            }
          },
          "options": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "title": "UpdateWidgetRequest"
      },
      "WidgetResource": {
        "type": "object",
        "properties": {
          "id": {
            "type": ["string", "null"]
          },
          "name": {
            "type": ["string", "null"]
          },
          "type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "string",
                "enum": ["modal"]
              }
            ]
          },
          "is_enabled": {
            "type": ["string", "boolean"]
          },
          "flow_id": {
            "type": ["string", "null"]
          },
          "frequency": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "string",
                "enum": ["session"]
              }
            ]
          },
          "visibility": {
            "type": "object",
            "properties": {
              "conditions": {
                "type": ["string", "null"]
              },
              "trigger": {
                "type": ["string", "null"]
              }
            },
            "required": ["conditions", "trigger"]
          },
          "options": {
            "type": ["string", "null"]
          }
        },
        "required": ["id", "name", "type", "is_enabled", "flow_id", "frequency", "visibility", "options"],
        "title": "WidgetResource"
      }
    },
    "responses": {
      "ValidationException": {
        "description": "Validation error",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "message": {
                  "type": "string",
                  "description": "Errors overview."
                },
                "errors": {
                  "type": "object",
                  "description": "A detailed description of each field that failed validation.",
                  "additionalProperties": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              },
              "required": ["message", "errors"]
            }
          }
        }
      },
      "ModelNotFoundException": {
        "description": "Not found",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "message": {
                  "type": "string",
                  "description": "Error overview."
                }
              },
              "required": ["message"]
            }
          }
        }
      },
      "AuthorizationException": {
        "description": "Authorization error",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "message": {
                  "type": "string",
                  "description": "Error overview."
                }
              },
              "required": ["message"]
            }
          }
        }
      }
    }
  }
}
