{
  "openapi": "3.1.0",
  "info": {
    "title": "Replipost API",
    "version": "1.0.0",
    "description": "Schedule posts to every channel and answer the comments that come back. Send an API key (Settings → Developers) or an OAuth access token as `Authorization: Bearer ...`. Limits: 60 requests a minute per API key, 120 per connected app. Over that you get 429 with Retry-After.",
    "contact": {
      "name": "Replipost",
      "url": "https://app.replipost.com/developers"
    }
  },
  "servers": [
    {
      "url": "https://app.replipost.com/api/v1"
    }
  ],
  "externalDocs": {
    "description": "Guide, MCP setup and a try-it explorer",
    "url": "https://app.replipost.com/developers"
  },
  "tags": [
    {
      "name": "Account"
    },
    {
      "name": "Channels"
    },
    {
      "name": "Posts"
    },
    {
      "name": "Metrics"
    },
    {
      "name": "Comments"
    },
    {
      "name": "Answers"
    },
    {
      "name": "Tags"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    },
    {
      "oauth2": [
        "read"
      ]
    }
  ],
  "paths": {
    "/account": {
      "get": {
        "operationId": "getAccount",
        "summary": "Your workspace and access",
        "tags": [
          "Account"
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": [
              "read"
            ]
          }
        ],
        "description": "The workspace the key or token acts in, who it acts as (and their role), its scopes, and quick counts.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Account"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/channels": {
      "get": {
        "operationId": "listChannels",
        "summary": "List channels",
        "tags": [
          "Channels"
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": [
              "read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Channel"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/channels/{id}": {
      "get": {
        "operationId": "getChannel",
        "summary": "Get a channel",
        "tags": [
          "Channels"
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": [
              "read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The channel id.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ChannelDetail"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/posts": {
      "get": {
        "operationId": "listPosts",
        "summary": "List posts",
        "tags": [
          "Posts"
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": [
              "read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "state",
            "in": "query",
            "required": false,
            "description": "Only posts in this state. Cancelled posts are hidden unless you ask for them.",
            "schema": {
              "type": "string",
              "enum": [
                "draft",
                "scheduled",
                "publishing",
                "published",
                "failed",
                "cancelled"
              ]
            }
          },
          {
            "name": "channel_id",
            "in": "query",
            "required": false,
            "description": "Only posts to this channel.",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "Posts scheduled or published at or after this time (ISO 8601).",
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "Posts scheduled or published before this time (ISO 8601).",
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "How many to return, 1-100. Default 50.",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "next_cursor from the previous page.",
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          }
        ],
        "description": "Newest first, one row per channel. Cancelled posts are hidden unless state=cancelled.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Post"
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Pass as cursor for the next page; null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      },
      "post": {
        "operationId": "createPost",
        "summary": "Create a draft or schedule a post",
        "tags": [
          "Posts"
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": [
              "write"
            ]
          }
        ],
        "description": "Scheduled posts get the same checks as the composer; problems come back as 422 with a list of issues. The REST API never posts right away.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "description": "Internal title. Not posted.",
                    "type": "string",
                    "maxLength": 200
                  },
                  "content": {
                    "type": "string",
                    "maxLength": 10000,
                    "description": "The post text, used on every channel unless a channel has its own."
                  },
                  "channels": {
                    "minItems": 1,
                    "maxItems": 30,
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                            },
                            "content": {
                              "description": "Different text for this channel only.",
                              "type": "string",
                              "maxLength": 10000
                            },
                            "settings": {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {}
                            }
                          },
                          "required": [
                            "id"
                          ]
                        }
                      ]
                    },
                    "description": "Channel ids, or { id, content } to change the text for one channel."
                  },
                  "media": {
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "description": "A file already in your media library.",
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                        },
                        "url": {
                          "description": "A public image or video URL; we copy it into your media library.",
                          "type": "string",
                          "maxLength": 2000,
                          "format": "uri"
                        },
                        "alt": {
                          "description": "Alt text describing the image.",
                          "type": "string",
                          "maxLength": 2000
                        }
                      }
                    }
                  },
                  "tag_id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "publish_at": {
                    "description": "When to post (ISO 8601 with a time zone). Needed for mode schedule.",
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                  },
                  "mode": {
                    "default": "draft",
                    "description": "draft = save only; schedule = post at publish_at.",
                    "type": "string",
                    "enum": [
                      "draft",
                      "schedule"
                    ]
                  }
                },
                "required": [
                  "content",
                  "channels"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/PostSaved"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "422": {
            "$ref": "#/components/responses/E422"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/posts/{id}": {
      "get": {
        "operationId": "getPost",
        "summary": "Get a post",
        "tags": [
          "Posts"
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": [
              "read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The post id.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/PostDetail"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      },
      "patch": {
        "operationId": "editPost",
        "summary": "Edit a post group",
        "tags": [
          "Posts"
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": [
              "write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The post id.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "description": "Changes the whole post group the post belongs to. Leave a field out to keep it. Posts already live are left as they are.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "content": {
                    "description": "New text for every channel that doesn't have its own.",
                    "type": "string",
                    "maxLength": 10000
                  },
                  "channels": {
                    "description": "Replace the channel list. Leave out to keep it.",
                    "minItems": 1,
                    "maxItems": 30,
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                            },
                            "content": {
                              "description": "Different text for this channel only.",
                              "type": "string",
                              "maxLength": 10000
                            },
                            "settings": {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {}
                            }
                          },
                          "required": [
                            "id"
                          ]
                        }
                      ]
                    }
                  },
                  "media": {
                    "description": "Replace the files. Leave out to keep them; [] removes them.",
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "description": "A file already in your media library.",
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                        },
                        "url": {
                          "description": "A public image or video URL; we copy it into your media library.",
                          "type": "string",
                          "maxLength": 2000,
                          "format": "uri"
                        },
                        "alt": {
                          "description": "Alt text describing the image.",
                          "type": "string",
                          "maxLength": 2000
                        }
                      }
                    }
                  },
                  "tag_id": {
                    "description": "null removes the tag.",
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "publish_at": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                  },
                  "mode": {
                    "description": "draft unschedules; schedule needs a time (the current one is kept if you leave publish_at out).",
                    "type": "string",
                    "enum": [
                      "draft",
                      "schedule"
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/PostSaved"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "409": {
            "$ref": "#/components/responses/E409"
          },
          "422": {
            "$ref": "#/components/responses/E422"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      },
      "delete": {
        "operationId": "deletePost",
        "summary": "Delete a post",
        "tags": [
          "Posts"
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": [
              "write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The post id.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "scope",
            "in": "query",
            "required": false,
            "description": "channel = this post only; group = every channel in the group.",
            "schema": {
              "type": "string",
              "enum": [
                "channel",
                "group"
              ],
              "default": "channel"
            }
          },
          {
            "name": "from_platform",
            "in": "query",
            "required": false,
            "description": "Also delete posts that already went out from the platform.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Deleted"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "422": {
            "$ref": "#/components/responses/E422"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/posts/{id}/metrics": {
      "get": {
        "operationId": "getPostMetrics",
        "summary": "Stats for one post",
        "tags": [
          "Metrics"
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": [
              "read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The post id.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "days",
            "in": "query",
            "required": false,
            "description": "Period in days: 7, 30 or 90.",
            "schema": {
              "default": 30,
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/PostMetrics"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/metrics": {
      "get": {
        "operationId": "getAggregatedMetrics",
        "summary": "Totals per channel and top posts",
        "tags": [
          "Metrics"
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": [
              "read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "days",
            "in": "query",
            "required": false,
            "description": "Period in days: 7, 30 or 90.",
            "schema": {
              "default": 30,
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            }
          },
          {
            "name": "channel_id",
            "in": "query",
            "required": false,
            "description": "Only this channel.",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/AggregatedMetrics"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/comments": {
      "get": {
        "operationId": "listComments",
        "summary": "List comments (the inbox)",
        "tags": [
          "Comments"
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": [
              "read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "needs_you = waiting for a person; auto_replied = answered automatically; all = every comment.",
            "schema": {
              "default": "all",
              "type": "string",
              "enum": [
                "new",
                "auto_replied",
                "needs_you",
                "replied",
                "ignored",
                "all"
              ]
            }
          },
          {
            "name": "channel_id",
            "in": "query",
            "required": false,
            "description": "Only comments on this channel.",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            }
          },
          {
            "name": "post_id",
            "in": "query",
            "required": false,
            "description": "Only comments on this post.",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "description": "Only comments sorted as this kind.",
            "schema": {
              "type": "string",
              "enum": [
                "question",
                "praise",
                "complaint",
                "lead",
                "spam",
                "other"
              ]
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "Comments made at or after this time.",
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "Comments made before this time.",
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Only comments containing this text.",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "How many to return, 1-100. Default 50.",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "next_cursor from the previous page.",
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Comment"
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Pass as cursor for the next page; null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/comments/{id}": {
      "get": {
        "operationId": "getComment",
        "summary": "Get a comment",
        "tags": [
          "Comments"
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": [
              "read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The comment id.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/CommentDetail"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      },
      "patch": {
        "operationId": "setCommentStatus",
        "summary": "Set a comment's status",
        "tags": [
          "Comments"
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": [
              "write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The comment id.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "new",
                      "needs_you",
                      "replied",
                      "ignored"
                    ],
                    "description": "ignored hides it; needs_you flags it for a person."
                  }
                },
                "required": [
                  "status"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/CommentStatusChanged"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/comments/{id}/draft": {
      "post": {
        "operationId": "draftReply",
        "summary": "Draft a reply (not sent)",
        "tags": [
          "Comments"
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": [
              "write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The comment id.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "description": "Writes a suggested reply from your answer bank and the post. Nothing is posted.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "instruction": {
                    "description": "What to say, e.g. 'offer a 10% code'.",
                    "type": "string",
                    "maxLength": 1000
                  },
                  "tone": {
                    "default": "friendly",
                    "type": "string",
                    "enum": [
                      "friendly",
                      "brief",
                      "formal"
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ReplyDraft"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "422": {
            "$ref": "#/components/responses/E422"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/comments/{id}/reply": {
      "post": {
        "operationId": "replyToComment",
        "summary": "Reply to a comment",
        "tags": [
          "Comments"
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": [
              "write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The comment id.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "description": "Posts a public reply on the platform and marks the comment replied.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "body": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 10000,
                    "description": "The reply text. It is posted publicly on the platform."
                  },
                  "from_draft": {
                    "description": "true if the text came from draft_reply (for your stats).",
                    "type": "boolean"
                  },
                  "save_to_bank": {
                    "description": "Also save this reply as an answer to this question.",
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "required": [
                  "body"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Reply"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "422": {
            "$ref": "#/components/responses/E422"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/answers": {
      "get": {
        "operationId": "listAnswers",
        "summary": "List saved answers",
        "tags": [
          "Answers"
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": [
              "read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Answer"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      },
      "post": {
        "operationId": "addAnswer",
        "summary": "Save an answer",
        "tags": [
          "Answers"
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": [
              "write"
            ]
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "question": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 500,
                    "description": "The question the way people ask it (for a fact: a short name, like Pricing)."
                  },
                  "answer": {
                    "type": "string",
                    "minLength": 5,
                    "maxLength": 5000,
                    "description": "The answer to send (or the fact the AI may use)."
                  },
                  "kind": {
                    "default": "faq",
                    "description": "faq = a ready answer; fact = background the AI can use when drafting.",
                    "type": "string",
                    "enum": [
                      "faq",
                      "fact"
                    ]
                  },
                  "allow_auto": {
                    "description": "Ignored: answers added through the API or an AI app are saved with automatic sending off. Turn it on in Replipost (Inbox → Answers).",
                    "type": "boolean"
                  }
                },
                "required": [
                  "question",
                  "answer"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Answer"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "422": {
            "$ref": "#/components/responses/E422"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/answers/{id}": {
      "delete": {
        "operationId": "archiveAnswer",
        "summary": "Archive a saved answer",
        "tags": [
          "Answers"
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": [
              "write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The answer id.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Archived"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/tags": {
      "get": {
        "operationId": "listTags",
        "summary": "List tags",
        "tags": [
          "Tags"
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": [
              "read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Tag"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "An API key from Settings → Developers (rp_live_...). Read-only keys get 403 on changes."
      },
      "oauth2": {
        "type": "oauth2",
        "description": "Authorization code with PKCE (S256). Apps can register themselves at the registration endpoint (RFC 7591).",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://app.replipost.com/oauth/authorize",
            "tokenUrl": "https://app.replipost.com/api/oauth/token",
            "refreshUrl": "https://app.replipost.com/api/oauth/token",
            "scopes": {
              "read": "See your workspace: channels, posts, comments, saved answers, tags and stats.",
              "write": "Make changes: create, edit, schedule and delete posts, reply to comments, and add saved answers."
            }
          }
        }
      }
    },
    "responses": {
      "E400": {
        "description": "The request body or query is wrong. issues lists each field.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "E401": {
        "description": "No key, or the key or token isn't valid, expired or was revoked.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "E403": {
        "description": "The key or token is read-only (scope write is needed).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "E404": {
        "description": "Not found in this workspace.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "E409": {
        "description": "The post already went out, so it can't be edited.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "E422": {
        "description": "Saved checks failed (for example the text is too long for a channel). issues lists each problem.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "E429": {
        "description": "Too many requests. Wait Retry-After seconds.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string"
          },
          "issues": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "field": {
                  "type": "string"
                },
                "channel_id": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "Account": {
        "type": "object",
        "properties": {
          "workspace": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "name": {
                "type": "string"
              },
              "timezone": {
                "type": "string"
              },
              "plan": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name",
              "timezone",
              "plan"
            ]
          },
          "acting_as": {
            "type": "object",
            "properties": {
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "email": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "role": {
                "type": "string",
                "enum": [
                  "owner",
                  "admin",
                  "member"
                ]
              }
            },
            "required": [
              "name",
              "email",
              "role"
            ]
          },
          "access": {
            "type": "object",
            "properties": {
              "via": {
                "type": "string",
                "enum": [
                  "key",
                  "oauth"
                ]
              },
              "scopes": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "read",
                    "write"
                  ]
                }
              }
            },
            "required": [
              "via",
              "scopes"
            ]
          },
          "counts": {
            "type": "object",
            "properties": {
              "channels": {
                "type": "integer"
              },
              "scheduled_posts": {
                "type": "integer"
              },
              "comments_needing_you": {
                "type": "integer"
              }
            },
            "required": [
              "channels",
              "scheduled_posts",
              "comments_needing_you"
            ]
          }
        },
        "required": [
          "workspace",
          "acting_as",
          "access",
          "counts"
        ]
      },
      "Channel": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "provider": {
            "type": "string"
          },
          "provider_name": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "handle": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "needs_reconnect",
              "disabled"
            ]
          },
          "status_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "can_publish": {
            "type": "boolean"
          },
          "can_read_comments": {
            "type": "boolean"
          },
          "can_read_metrics": {
            "type": "boolean"
          },
          "auto_reply": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "provider",
          "provider_name",
          "name",
          "handle",
          "status",
          "status_reason",
          "can_publish",
          "can_read_comments",
          "can_read_metrics",
          "auto_reply",
          "created_at"
        ]
      },
      "ChannelDetail": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "provider": {
            "type": "string"
          },
          "provider_name": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "handle": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "needs_reconnect",
              "disabled"
            ]
          },
          "status_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "can_publish": {
            "type": "boolean"
          },
          "can_read_comments": {
            "type": "boolean"
          },
          "can_read_metrics": {
            "type": "boolean"
          },
          "auto_reply": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "posts": {
            "type": "object",
            "properties": {
              "scheduled": {
                "type": "integer"
              },
              "drafts": {
                "type": "integer"
              },
              "published": {
                "type": "integer"
              }
            },
            "required": [
              "scheduled",
              "drafts",
              "published"
            ]
          }
        },
        "required": [
          "id",
          "provider",
          "provider_name",
          "name",
          "handle",
          "status",
          "status_reason",
          "can_publish",
          "can_read_comments",
          "can_read_metrics",
          "auto_reply",
          "created_at",
          "posts"
        ]
      },
      "Post": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "group_id": {
            "type": "string",
            "format": "uuid"
          },
          "channel_id": {
            "type": "string",
            "format": "uuid"
          },
          "channel_name": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "content": {
            "type": "string"
          },
          "is_customised": {
            "type": "boolean"
          },
          "state": {
            "type": "string",
            "enum": [
              "draft",
              "scheduled",
              "publishing",
              "published",
              "failed",
              "cancelled"
            ]
          },
          "publish_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "published_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "url": {
            "type": [
              "string",
              "null"
            ]
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "group_id",
          "channel_id",
          "content",
          "state"
        ]
      },
      "PostDetail": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "group_id": {
            "type": "string",
            "format": "uuid"
          },
          "channel_id": {
            "type": "string",
            "format": "uuid"
          },
          "channel_name": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "content": {
            "type": "string"
          },
          "is_customised": {
            "type": "boolean"
          },
          "state": {
            "type": "string",
            "enum": [
              "draft",
              "scheduled",
              "publishing",
              "published",
              "failed",
              "cancelled"
            ]
          },
          "publish_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "published_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "url": {
            "type": [
              "string",
              "null"
            ]
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "tag_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "media": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "name": {
                  "type": "string"
                },
                "mime": {
                  "type": "string"
                },
                "alt": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "name",
                "mime",
                "alt"
              ]
            }
          },
          "group": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "title": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "content": {
                "type": "string"
              },
              "channels": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "post_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "channel_id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "channel_name": {
                      "type": "string"
                    },
                    "state": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "post_id",
                    "channel_id",
                    "channel_name",
                    "state"
                  ]
                }
              }
            },
            "required": [
              "id",
              "title",
              "content",
              "channels"
            ]
          }
        },
        "required": [
          "id",
          "group_id",
          "channel_id",
          "content",
          "state",
          "group"
        ]
      },
      "PostSaved": {
        "type": "object",
        "properties": {
          "group_id": {
            "type": "string",
            "format": "uuid"
          },
          "state": {
            "type": "string",
            "enum": [
              "draft",
              "scheduled"
            ]
          }
        },
        "required": [
          "group_id",
          "state"
        ]
      },
      "Deleted": {
        "type": "object",
        "properties": {
          "removed": {
            "type": "integer"
          },
          "problems": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "removed",
          "problems"
        ]
      },
      "PostMetrics": {
        "type": "object",
        "properties": {
          "post_id": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "channel": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "name": {
                "type": "string"
              },
              "provider": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name",
              "provider"
            ]
          },
          "state": {
            "type": "string"
          },
          "published_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "url": {
            "type": [
              "string",
              "null"
            ]
          },
          "days": {
            "type": "integer"
          },
          "latest": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "views": {
                    "type": "integer"
                  },
                  "likes": {
                    "type": "integer"
                  },
                  "comments": {
                    "type": "integer"
                  },
                  "shares": {
                    "type": "integer"
                  },
                  "saves": {
                    "type": "integer"
                  },
                  "clicks": {
                    "type": "integer"
                  },
                  "captured_at": {
                    "type": "string",
                    "format": "date-time"
                  }
                },
                "description": "A metric is missing when the platform doesn't share it."
              },
              {
                "type": "null"
              }
            ]
          },
          "available": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "unavailable": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "series": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "views": {
                  "type": "integer"
                },
                "likes": {
                  "type": "integer"
                },
                "comments": {
                  "type": "integer"
                },
                "shares": {
                  "type": "integer"
                },
                "saves": {
                  "type": "integer"
                },
                "clicks": {
                  "type": "integer"
                },
                "day": {
                  "type": "string"
                }
              },
              "description": "A metric is missing when the platform doesn't share it."
            }
          }
        },
        "required": [
          "post_id",
          "title",
          "channel",
          "state",
          "published_at",
          "url",
          "days",
          "latest",
          "available",
          "unavailable",
          "series"
        ]
      },
      "AggregatedMetrics": {
        "type": "object",
        "properties": {
          "days": {
            "type": "integer"
          },
          "has_published": {
            "type": "boolean"
          },
          "channels": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "channel": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "name": {
                      "type": "string"
                    },
                    "provider": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "provider"
                  ]
                },
                "posts": {
                  "type": "integer"
                },
                "totals": {
                  "type": "object",
                  "properties": {
                    "views": {
                      "type": "integer"
                    },
                    "likes": {
                      "type": "integer"
                    },
                    "comments": {
                      "type": "integer"
                    },
                    "shares": {
                      "type": "integer"
                    },
                    "saves": {
                      "type": "integer"
                    },
                    "clicks": {
                      "type": "integer"
                    }
                  },
                  "description": "A metric is missing when the platform doesn't share it."
                },
                "previous_period": {
                  "type": "object",
                  "properties": {
                    "views": {
                      "type": "integer"
                    },
                    "likes": {
                      "type": "integer"
                    },
                    "comments": {
                      "type": "integer"
                    },
                    "shares": {
                      "type": "integer"
                    },
                    "saves": {
                      "type": "integer"
                    },
                    "clicks": {
                      "type": "integer"
                    }
                  },
                  "description": "A metric is missing when the platform doesn't share it."
                },
                "change_percent": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "number"
                  }
                },
                "available": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              },
              "required": [
                "channel",
                "posts",
                "totals",
                "previous_period",
                "change_percent",
                "available"
              ]
            }
          },
          "top_posts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "post_id": {
                  "type": "string",
                  "format": "uuid"
                },
                "title": {
                  "type": "string"
                },
                "channel_name": {
                  "type": "string"
                },
                "provider": {
                  "type": "string"
                },
                "published_at": {
                  "type": "string",
                  "format": "date-time"
                },
                "totals": {
                  "type": "object",
                  "properties": {
                    "views": {
                      "type": "integer"
                    },
                    "likes": {
                      "type": "integer"
                    },
                    "comments": {
                      "type": "integer"
                    },
                    "shares": {
                      "type": "integer"
                    },
                    "saves": {
                      "type": "integer"
                    },
                    "clicks": {
                      "type": "integer"
                    }
                  },
                  "description": "A metric is missing when the platform doesn't share it."
                },
                "engagement": {
                  "type": "integer"
                }
              },
              "required": [
                "post_id",
                "title",
                "channel_name",
                "provider",
                "published_at",
                "totals",
                "engagement"
              ]
            }
          },
          "ai_report": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "generated_at": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "summary": {
                    "type": "string"
                  },
                  "worked": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "suggestions": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "title": {
                          "type": "string"
                        },
                        "why": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "title",
                        "why"
                      ]
                    }
                  }
                },
                "required": [
                  "generated_at",
                  "summary",
                  "worked",
                  "suggestions"
                ]
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "days",
          "has_published",
          "channels",
          "top_posts",
          "ai_report"
        ]
      },
      "Comment": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "channel_id": {
            "type": "string",
            "format": "uuid"
          },
          "channel_name": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "post_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "group_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "author_name": {
            "type": "string"
          },
          "author_handle": {
            "type": "string"
          },
          "body": {
            "type": "string"
          },
          "commented_at": {
            "type": "string",
            "format": "date-time"
          },
          "kind": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "question",
              "praise",
              "complaint",
              "lead",
              "spam",
              "other",
              null
            ]
          },
          "sentiment": {
            "type": [
              "number",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "new",
              "auto_replied",
              "needs_you",
              "replied",
              "ignored"
            ]
          },
          "matched_answer_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "match_confidence": {
            "type": [
              "number",
              "null"
            ]
          },
          "replies_sent": {
            "type": "integer"
          }
        },
        "required": [
          "id",
          "channel_id",
          "body",
          "status",
          "commented_at"
        ]
      },
      "CommentDetail": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "channel": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "name": {
                "type": "string"
              },
              "provider": {
                "type": "string"
              },
              "can_reply": {
                "type": "boolean"
              }
            },
            "required": [
              "id",
              "name",
              "provider",
              "can_reply"
            ]
          },
          "post": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "content": {
                    "type": "string"
                  },
                  "url": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "id",
                  "content",
                  "url"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "author_name": {
            "type": "string"
          },
          "author_handle": {
            "type": "string"
          },
          "body": {
            "type": "string"
          },
          "commented_at": {
            "type": "string",
            "format": "date-time"
          },
          "kind": {
            "type": [
              "string",
              "null"
            ]
          },
          "sentiment": {
            "type": [
              "number",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "matched_answer": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Answer"
              },
              {
                "type": "null"
              }
            ]
          },
          "match_confidence": {
            "type": [
              "number",
              "null"
            ]
          },
          "replies": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "origin": {
                  "type": "string",
                  "enum": [
                    "auto",
                    "ai_draft",
                    "manual"
                  ]
                },
                "body": {
                  "type": "string"
                },
                "state": {
                  "type": "string"
                },
                "sent_at": {
                  "type": "string",
                  "format": "date-time"
                }
              },
              "required": [
                "id",
                "origin",
                "body",
                "state",
                "sent_at"
              ]
            }
          }
        },
        "required": [
          "id",
          "body",
          "status",
          "replies"
        ]
      },
      "CommentStatusChanged": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "status"
        ]
      },
      "ReplyDraft": {
        "type": "object",
        "properties": {
          "comment_id": {
            "type": "string",
            "format": "uuid"
          },
          "draft": {
            "type": "string"
          },
          "note": {
            "type": "string"
          }
        },
        "required": [
          "comment_id",
          "draft",
          "note"
        ]
      },
      "Reply": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "comment_id": {
            "type": "string",
            "format": "uuid"
          },
          "body": {
            "type": "string"
          },
          "state": {
            "type": "string"
          },
          "sent_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "comment_id",
          "body",
          "state",
          "sent_at"
        ]
      },
      "Answer": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "question": {
            "type": "string"
          },
          "answer": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "faq",
              "fact"
            ]
          },
          "allow_auto": {
            "type": "boolean"
          },
          "times_used": {
            "type": "integer"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "question",
          "answer",
          "kind",
          "allow_auto",
          "times_used",
          "created_at"
        ]
      },
      "Archived": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "archived": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "archived"
        ]
      },
      "Tag": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "color": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "color"
        ]
      }
    }
  }
}