{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/robosystems-ai/json-schema/robosystems-ai-connection-response-schema.json",
  "title": "ConnectionResponse",
  "description": "Connection response model.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/robosystems-ai-connections-api-openapi.yml#/components/schemas/ConnectionResponse",
  "properties": {
    "connection_id": {
      "type": "string",
      "title": "Connection Id",
      "description": "Unique connection identifier"
    },
    "provider": {
      "type": "string",
      "title": "Provider",
      "description": "Connection provider type"
    },
    "entity_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Entity Id",
      "description": "The entity whose books the connection keeps: the group parent for QuickBooks, the entity a bank feed was connected for (each of its accounts can move to another entity later), none for an external source, whose events name their own."
    },
    "status": {
      "type": "string",
      "title": "Status",
      "description": "Connection status"
    },
    "created_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "string"
        }
      ],
      "title": "Created At",
      "description": "Creation timestamp"
    },
    "updated_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Updated At",
      "description": "Last update timestamp"
    },
    "last_sync": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Last Sync",
      "description": "Last sync timestamp"
    },
    "write_policy": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Write Policy",
      "description": "Source-of-truth write policy: 'native' (RoboSystems is authoritative; no outbound write-back) or 'qb_authoritative' (QuickBooks is authoritative; RoboSystems-originated entries publish to QB). Set via the write-policy endpoint."
    },
    "source_name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Source Name",
      "description": "External-provider registered source slug — the value the integration stamps on the events it emits. Null for platform providers."
    },
    "metadata": {
      "additionalProperties": true,
      "type": "object",
      "title": "Metadata",
      "description": "Provider-specific metadata"
    }
  },
  "type": "object",
  "required": [
    "connection_id",
    "provider",
    "status",
    "created_at",
    "metadata"
  ]
}