{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/reviewflowz-com/json-schema/reviewflowz-com-source-schema.json",
  "title": "Source",
  "x-generated": "2026-11-23",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/reviewflowz-com-openapi.json#/components/schemas/Source",
  "type": "object",
  "required": [
    "id",
    "url",
    "platform",
    "name",
    "status",
    "created_at"
  ],
  "properties": {
    "id": {
      "type": "string"
    },
    "url": {
      "type": "string",
      "format": "uri"
    },
    "platform": {
      "type": "string"
    },
    "name": {
      "type": [
        "string",
        "null"
      ]
    },
    "location": {
      "type": [
        "string",
        "null"
      ]
    },
    "domain": {
      "type": [
        "string",
        "null"
      ]
    },
    "external_id": {
      "type": [
        "string",
        "null"
      ],
      "description": "The page's id on the platform."
    },
    "product": {
      "type": [
        "object",
        "null"
      ],
      "description": "On accounts that group sources into products (a tour operator's tours). The name is null for a member who may not see the product.",
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "address": {
      "type": [
        "object",
        "null"
      ],
      "description": "Google listings only.",
      "properties": {
        "line1": {
          "type": [
            "string",
            "null"
          ]
        },
        "line2": {
          "type": [
            "string",
            "null"
          ]
        },
        "city": {
          "type": [
            "string",
            "null"
          ]
        },
        "postal_code": {
          "type": [
            "string",
            "null"
          ]
        },
        "country": {
          "type": [
            "string",
            "null"
          ],
          "description": "ISO 3166 code."
        }
      }
    },
    "status": {
      "type": "string",
      "enum": [
        "syncing",
        "synced",
        "failed",
        "paused"
      ],
      "description": "syncing: the first import or a refresh is running. failed: the platform no longer serves the page. paused: paused in the app (not fetched, not billed)."
    },
    "rating": {
      "type": [
        "object",
        "null"
      ],
      "description": "The current worldwide rating as the platform shows it.",
      "properties": {
        "score": {
          "type": [
            "number",
            "null"
          ]
        },
        "count": {
          "type": [
            "integer",
            "null"
          ]
        },
        "stars": {
          "type": [
            "object",
            "null"
          ],
          "description": "The platform's own star split, where it publishes one (\"5\" to \"1\").",
          "additionalProperties": {
            "type": [
              "integer",
              "null"
            ]
          }
        }
      }
    },
    "last_synced_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "dimensions": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "reviews": {
      "description": "POST /sources and POST /sources/{id}/sync with a finished Prefer: wait only: the first page of reviews (for a sync, the ones it found). next_cursor continues with GET /reviews?source=<id>.",
      "allOf": [
        {
          "$ref": "#/$defs/PageMeta"
        },
        {
          "type": "object",
          "properties": {
            "data": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/Review"
              }
            }
          }
        }
      ]
    }
  },
  "$defs": {
    "PageMeta": {
      "type": "object",
      "required": [
        "next_cursor",
        "has_more"
      ],
      "properties": {
        "next_cursor": {
          "type": [
            "string",
            "null"
          ],
          "description": "Pass as cursor to get the next page. Null on the last page."
        },
        "has_more": {
          "type": "boolean"
        }
      }
    },
    "Reply": {
      "type": "object",
      "required": [
        "review",
        "origin",
        "status"
      ],
      "properties": {
        "id": {
          "type": [
            "string",
            "null"
          ],
          "description": "Null for a reply written directly on the platform."
        },
        "review": {
          "type": "string"
        },
        "origin": {
          "type": "string",
          "enum": [
            "reviewflowz",
            "platform"
          ]
        },
        "status": {
          "type": "string",
          "enum": [
            "draft",
            "submitted",
            "published",
            "failed"
          ]
        },
        "text": {
          "type": [
            "string",
            "null"
          ]
        },
        "author": {
          "description": "Who wrote it (ReplySerializer#author): a team member, or the AI agent, for a reply written in Reviewflowz; the name the platform shows, or null, for one written on the platform.",
          "oneOf": [
            {
              "type": "object",
              "description": "A team member.",
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "user"
                  ]
                },
                "name": {
                  "type": "string"
                }
              }
            },
            {
              "type": "object",
              "description": "The AI reply agent.",
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "agent"
                  ]
                },
                "id": {
                  "type": "string",
                  "description": "The reply agent's id (GET /v3/reply-agents)."
                },
                "name": {
                  "type": "string"
                }
              }
            },
            {
              "type": "string",
              "description": "The replier's name as the platform shows it (origin platform)."
            },
            {
              "type": "null"
            }
          ]
        },
        "via": {
          "type": "string",
          "description": "Where it was written (reviewflowz, reply_rule, slack...)."
        },
        "published_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "When it went live. Null until it does."
        },
        "editable": {
          "type": "boolean"
        },
        "deletable": {
          "type": "boolean"
        },
        "created_at": {
          "type": "string",
          "format": "date-time"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "Review": {
      "type": "object",
      "required": [
        "id",
        "source",
        "platform",
        "rating",
        "created_at",
        "updated_at"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "source": {
          "type": "string"
        },
        "platform": {
          "type": "string"
        },
        "location": {
          "type": [
            "string",
            "null"
          ]
        },
        "rating": {
          "type": [
            "number",
            "null"
          ]
        },
        "title": {
          "type": [
            "string",
            "null"
          ]
        },
        "text": {
          "type": [
            "string",
            "null"
          ]
        },
        "pros": {
          "type": [
            "string",
            "null"
          ]
        },
        "cons": {
          "type": [
            "string",
            "null"
          ]
        },
        "language": {
          "type": [
            "string",
            "null"
          ],
          "description": "ISO 639-1."
        },
        "reviewer": {
          "type": "object",
          "properties": {
            "name": {
              "type": [
                "string",
                "null"
              ]
            },
            "company": {
              "type": [
                "string",
                "null"
              ]
            },
            "avatar_url": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        },
        "url": {
          "type": [
            "string",
            "null"
          ]
        },
        "date": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "Posted on the platform."
        },
        "removed": {
          "type": "boolean"
        },
        "removed_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "previous_version": {
          "type": [
            "string",
            "null"
          ],
          "description": "The version this edit replaced."
        },
        "root_review": {
          "type": "string",
          "description": "The first version of this review."
        },
        "latest_version": {
          "type": "boolean"
        },
        "tags": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            }
          }
        },
        "owners": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            }
          }
        },
        "owner_suggestions": {
          "type": "array",
          "description": "Owners we think the review mentions, waiting to be accepted or rejected (POST /owner-suggestions/{id}/accept or reject).",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "owner": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                }
              },
              "certainty": {
                "type": [
                  "integer",
                  "null"
                ]
              }
            }
          }
        },
        "topics": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "topic": {
                "type": "string"
              },
              "subtopic": {
                "type": "string"
              },
              "sentiment": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "positive",
                  "negative",
                  "neutral",
                  null
                ]
              },
              "sentiment_score": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "excerpt": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "description": "Found by Reviewflowz."
        },
        "updated_at": {
          "type": "string",
          "format": "date-time",
          "description": "The latest change: found, edited, removed, reinstated, replied to, tagged or given an owner. updated_after= returns the reviews whose updated_at is after its time. Start your next sync from when this one started, not from the largest updated_at: a change made while you page can land on a page you've already read."
        },
        "columns": {
          "type": "object",
          "description": "columns= only: each requested export column, as a CSV export writes it (null where no source of the account fills it).",
          "additionalProperties": true
        },
        "media": {
          "type": "object",
          "description": "include=media",
          "properties": {
            "photos": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string"
                  }
                }
              }
            },
            "videos": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "reply": {
          "description": "include=reply. The current reply, or null.",
          "oneOf": [
            {
              "$ref": "#/$defs/Reply"
            },
            {
              "type": "null"
            }
          ]
        },
        "events": {
          "type": "array",
          "description": "include=events. The review's history, oldest first, named like the webhook events.",
          "items": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string"
              },
              "at": {
                "type": "string",
                "format": "date-time"
              },
              "reason": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}