{
  "openapi": "3.1.0",
  "jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
  "info": {
    "title": "UnifyWire customer API",
    "version": "v1-broker-account-number-20261112",
    "summary": "Implemented server-to-server public HTTP contract",
    "description": "Source-derived contract for UnifyWire API v1. Success responses have {data,meta}; errors have {error}. API keys stay in the customer backend; enforce your own trader login, ownership and CSRF before mutations. Reads use stored data and never request provider refresh. Implemented routes are not an account-eligibility or deployment promise. The recipient-acquisition amendment admits supported centrally consented Demo/HEDGED recipients after explicit selection and one accepted request. Retained recipients share their exact original central source stream and retain their own public IDs; no recipient copies another tenant token or acquires competing source ownership. Older deployed workers may still be restricted, so consent, selection and 202 alone are not live completion proof. This contract includes explicit browser-owned source consent, guarded recovery of withdrawn empty enrollments and retained-history read projections. Verify the actual saved grant, resource capabilities and account-specific public results independently. Require execution-details-v2 before using opt-in closing facts; retained trades and a current balance do not prove full historical equity. This specification describes implementation, not current deployment or real-account acceptance."
  },
  "x-source-revision": "8a9e2e65818dc7b88405bae39d5c42057db767ec",
  "x-retained-owner-amendment": {
    "sourceRevision": "81c653058af1507b60aae6cab8c3c6a8db07bb1c",
    "status": "implemented_in_source",
    "deploymentVerification": "not_asserted_by_spec",
    "scope": "Explicit source-pinned owner consent, retained-data projection and guarded withdrawn-empty-recipient recovery; no worker eligibility expansion."
  },
  "x-contract-inspected-date": "2026-11-14",
  "x-signup-free-connection-journey": {
    "status": "implemented_in_source",
    "deploymentVerification": "not_asserted_by_spec",
    "default": "Returned consentPath starts fresh accounts-only Demo OAuth automatically after request validation, including a browser with other owned sources. One account-specific Connect to SaaS decision follows; multiple eligible accounts require a choice. Confirmed decisions return automatically with a fallback link. No UnifyWire signup or extra checkbox.",
    "reuse": "Separate website fragment selector &reuse=1 offers existing browser-owned sources without new OAuth. An exact owner_source selector remains supported instead. These are website handoff selectors, not JSON request properties or authority. Retained reconsent and source-pinned requests never fall back to fresh OAuth.",
    "return": "Original request, recipient, browser continuity, one-use state, expiry, decision and server-side receipt verification remain mandatory. Return status is a hint. Normal refreshes do not repeat authorization. No new endpoint, migration or worker behavior is implied."
  },
  "x-owner-review-loading": {
    "status": "implemented_in_source",
    "deploymentVerification": "not_asserted_by_spec",
    "browserDeadlineMs": 25000,
    "serverBudgetMs": 18000,
    "upstreamCapMs": 10000,
    "scope": "Read-only website review loading only. No absolute expiry extension, approval retry, new customer endpoint or provider acquisition. Browser timeout requires reconciliation through the existing permission-request GET. Real owner delivery remains separately verified."
  },
  "x-broker-account-number": {
    "status": "implemented_in_source",
    "deploymentVerification": "not_asserted_by_spec",
    "scope": "Nullable string brokerAccountNumber on existing authorized account list/detail responses. Retained display metadata only; no provider fetch, reverse lookup, consent change or native/canonical ID replacement."
  },
  "x-browser-owner-recovery": {
    "status": "implemented_in_source",
    "deploymentVerification": "not_asserted_by_spec",
    "ownerPage": "https://www.unifywire.com/connect/ctrader/owner/recover",
    "issuance": "Private operator authorization after independent verification of the original owner and exact retained source. No API-key issuance endpoint. Matching account/profile IDs are not authority.",
    "authorizationLifetimeSeconds": 600,
    "confirmation": "Manual source-specific browser confirmation; one-use authorization, new HttpOnly management credential. Saved-result reconciliation requires the same provisional browser proof.",
    "preserves": "Original source/principal, provider authorization, SaaS grants, recipient account and connection IDs, history and trade identities.",
    "limits": "No implicit SaaS consent, revoked-grant revival, history import, provider reconnect or synchronization. Other source bindings on the former browser key remain unchanged."
  },
  "x-retained-reconsent-readiness": {
    "status": "implemented_in_source",
    "deploymentVerification": "not_asserted_by_spec",
    "withdrawal": "Revision-pinned, bodyless journal DELETE withdraws the grant and logical selection. Prior account deselection is not required.",
    "readiness": "A completed central stream can remain available while the withdrawn journal is unselected and all its work/leases have settled. Availability is not customer acquisition authority.",
    "browserNotReady": "409 / consent_not_ready; no approval or automatic retry. Reopen the original returned consent URL only after cleanup and before expiry. Expired requests are terminal.",
    "preservation": "Fresh manual retained consent keeps source/account/connection/history identities; prior grants remain revoked. Fresh approval does not select or refresh automatically."
  },
  "x-live-verification-scope": "Account-specific stored-data proofs are separate from grant acceptance, hosted refresh eligibility and qualified historical equity. No broader acquisition or consumer cutover is asserted.",
  "servers": [
    {
      "url": "https://api.unifywire.com",
      "description": "Public API origin; all paths below include /api/v1."
    }
  ],
  "security": [
    {
      "PrivateApiKey": []
    }
  ],
  "tags": [
    {
      "name": "Customer API",
      "description": "Private server-to-server access; no trading/order-entry permissions."
    }
  ],
  "paths": {
    "/api/v1/providers": {
      "get": {
        "operationId": "listProviders",
        "summary": "List provider capability declarations",
        "description": "Authenticated metadata only. Development/available declarations are not proof of runtime eligibility for an account.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Successful authorized stored-data read or scoped mutation acknowledgement.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                },
                "description": "Do not cache shared customer responses."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Providers"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/api/v1/end-users": {
      "post": {
        "operationId": "createEndUser",
        "summary": "Create or resolve your end-user mapping",
        "description": "Organization comes from API key. Repeating exact externalId/displayName returns existing mapping (201); different displayName for same externalId returns HTTP 409. No user login is performed by this endpoint.",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Created resource or existing idempotent end-user result.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                },
                "description": "Do not cache shared customer responses."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/EndUser"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                },
                "example": {
                  "data": {
                    "id": "20000000-0000-4000-8000-000000000002",
                    "externalId": "journal:user-42",
                    "displayName": "Sample trader",
                    "createdAt": "2026-10-20T10:00:00.000Z",
                    "updatedAt": "2026-10-20T10:00:00.000Z"
                  },
                  "meta": {
                    "apiVersion": "v1",
                    "source": "postgres"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateEndUser"
              },
              "example": {
                "externalId": "journal:user-42",
                "displayName": "Sample trader"
              }
            }
          }
        }
      }
    },
    "/api/v1/connections": {
      "get": {
        "operationId": "listConnections",
        "summary": "List accessible customer connections",
        "description": "",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 2048
            },
            "description": "Opaque returned cursor. Do not decode, construct, reuse across resources/accounts, or assume a cross-request snapshot."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful authorized stored-data read or scoped mutation acknowledgement.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                },
                "description": "Do not cache shared customer responses."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ConnectionsCollection"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      },
      "post": {
        "operationId": "createConnection",
        "summary": "Create a legacy tenant-owned connection",
        "description": "Compatibility flow; for signup-free SaaS linking prefer cTrader permission requests. Does not discover, select or synchronize an account. No client idempotency key is implemented; do not retry an uncertain create blindly.",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Created resource or existing idempotent end-user result.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                },
                "description": "Do not cache shared customer responses."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Connection"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateConnection"
              }
            }
          }
        }
      }
    },
    "/api/v1/connections/{id}": {
      "get": {
        "operationId": "getConnection",
        "summary": "Read a connection",
        "description": "",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Canonical UnifyWire connection ID, not a shared provider source."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful authorized stored-data read or scoped mutation acknowledgement.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                },
                "description": "Do not cache shared customer responses."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Connection"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      },
      "delete": {
        "operationId": "disconnectConnection",
        "summary": "Disconnect this organization's connection access",
        "description": "Trusted organization backend compatibility route. Prefer the end-user-scoped route for journal disconnect. Central grants withdraw only this SaaS permission; shared provider source/history and other customers remain. Retained legacy OAuth handling differs; cleanup acknowledgement is not confirmed provider shutdown. This generic route does not implement If-Match. Send no request body: not {}, null, whitespace or bytes. A stream must reach EOF.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Canonical UnifyWire connection ID, not a shared provider source."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful authorized stored-data read or scoped mutation acknowledgement.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                },
                "description": "Do not cache shared customer responses."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/DisconnectResult"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        },
        "x-request-body-required-empty": true
      }
    },
    "/api/v1/connections/{id}/authorize": {
      "post": {
        "operationId": "beginConnectionAuthorization",
        "summary": "Begin legacy cTrader OAuth handoff",
        "description": "Returns one-time authorizationUrl and expiresAt for browser navigation; do not invoke provider authorization server-side or log the URL. Only eligible OAuth connection states accepted. This is the legacy tenant-owned flow; new SaaS enrollment should use permission requests. This route does not parse a request body.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Canonical UnifyWire connection ID, not a shared provider source."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful authorized stored-data read or scoped mutation acknowledgement.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                },
                "description": "Do not cache shared customer responses."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/AuthorizationStart"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/api/v1/connections/{id}/accounts": {
      "get": {
        "operationId": "listSelectedAccounts",
        "summary": "Read selected account IDs for a connection",
        "description": "Only selectedAccountIds, not the discovered-account inventory. Find discovered accounts in /accounts and their connectionIds.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Canonical UnifyWire connection ID, not a shared provider source."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful authorized stored-data read or scoped mutation acknowledgement.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                },
                "description": "Do not cache shared customer responses."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/SelectedAccounts"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/api/v1/connections/{id}/accounts/{accountId}": {
      "put": {
        "operationId": "selectAccount",
        "summary": "Select an account for provisioning",
        "description": "Test-environment cTrader only. Idempotent existing selection is retained. This queues/records selection; synchronizationEnabled and selected do not prove a worker is eligible/running. The recipient-acquisition amendment routes an authorized retained recipient to its existing central source, without copying credentials or facts, and provisions a fresh central customer normally. A compatible request-driven worker must be deployed. Selection alone is not acquisition/completion proof. Send no request body: not {}, null, whitespace or bytes. A stream must reach EOF.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Canonical UnifyWire connection ID, not a shared provider source."
          },
          {
            "name": "accountId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Canonical UnifyWire account ID linked to this connection."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful authorized stored-data read or scoped mutation acknowledgement.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                },
                "description": "Do not cache shared customer responses."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/AccountSelection"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        },
        "x-request-body-required-empty": true
      },
      "delete": {
        "operationId": "deselectAccount",
        "summary": "Deselect an account",
        "description": "Requests scoped cancellation; cleanupState=requested and workerCleanupConfirmed=false are truthful acknowledgement, not completed shutdown. Operator-managed work returns HTTP 409. Send no request body: not {}, null, whitespace or bytes. A stream must reach EOF.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Canonical UnifyWire connection ID, not a shared provider source."
          },
          {
            "name": "accountId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Canonical UnifyWire account ID linked to this connection."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful authorized stored-data read or scoped mutation acknowledgement.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                },
                "description": "Do not cache shared customer responses."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/AccountDeselection"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        },
        "x-request-body-required-empty": true
      }
    },
    "/api/v1/end-users/{endUserId}/connections/{id}": {
      "delete": {
        "operationId": "revokeJournalGrant",
        "summary": "Revoke this journal's exact end-user grant",
        "description": "Journal backend must authenticate its trader, check stored user-to-connection ownership and protect its browser action against CSRF. Private API key stays on server. Supported central test cTrader grant only; wrong end user/tenant/environment or legacy connection returns HTTP 404. No UnifyWire login or owner cookie required. Repeat exact authorized revocation is idempotent; uncertain writes must be reconciled before a deliberate repeat. Shared provider source/history and another SaaS grant are preserved. Send no request body: not {}, null, whitespace or bytes. A stream must reach EOF.",
        "parameters": [
          {
            "name": "endUserId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Canonical UnifyWire connection ID, not a shared provider source."
          },
          {
            "name": "If-Match",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\"unifywire-customer-authorization-v1:[0-9a-f]{64}\"$"
            },
            "description": "Recommended exact-grant concurrency precondition; quote the saved account authorizationRevision. Weak/wildcard/multiple/malformed values rejected."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful authorized stored-data read or scoped mutation acknowledgement.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                },
                "description": "Do not cache shared customer responses."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/DisconnectResult"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                },
                "example": {
                  "data": {
                    "connectionId": "30000000-0000-4000-8000-000000000003",
                    "status": "disconnect_requested",
                    "cleanupState": "requested",
                    "workerCleanupConfirmed": false
                  },
                  "meta": {
                    "apiVersion": "v1",
                    "source": "postgres"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "412": {
            "$ref": "#/components/responses/PreconditionFailed"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        },
        "x-request-body-required-empty": true
      }
    },
    "/api/v1/ctrader/permission-requests": {
      "post": {
        "operationId": "createPermissionRequest",
        "summary": "Create a trader consent request",
        "description": "Preferred signup-free Test-key customer linking flow. The normal consentPath automatically starts fresh provider authorization even when the browser owns other sources; a single account-specific confirmation follows. Use the separate website fragment reuse=1 for existing-source reuse, or owner_source for an exact existing source; these are not API JSON fields. Confirmed decisions return automatically with a fallback link and unchanged backend receipt verification. Return consentPath to the intended authenticated trader and navigate browser to https://www.unifywire.com plus that path. User performs provider authorization/account choice and explicit SaaS consent; return is only a hint until authenticated GET confirms request. Optional reconsent is fresh explicit consent for a retained exact connection/revision, not silent reactivation. The 30-day browser-owner credential protects separate global management, not journal disconnect. No POST idempotency-key support. A valid browser owner may explicitly approve a new SaaS against an already-owned source without another provider OAuth. An optional owner_source UUID in the consent fragment restricts review to that exact browser-managed source and fails without OAuth fallback if authority is missing; the selector grants no authority. This creates an independent tenant-local grant and IDs; same-tenant reconsent remains a separate lineage operation. A revoked, never-acquired empty recipient can preserve its own account UUID only when fresh explicit owner consent selects another source for the same verified provider principal/application/environment/native account. It gets a new connection and independent root grant; old connection and terminal grant remain. Active, acquired, differently owned or previously recovered records cannot use that recovery. An authorized retained read projection can serve already committed source facts without reacquisition. Consent does not automatically select acquisition. With the compatible recipient-acquisition release, select this recipient account and submit an ordinary refresh; its current grant, source binding and fixed-cutoff completion remain mandatory.",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Created resource or existing idempotent end-user result.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                },
                "description": "Do not cache shared customer responses."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/PermissionRequestCreated"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                },
                "example": {
                  "data": {
                    "requestId": "40000000-0000-4000-8000-000000000004",
                    "expiresAt": "2026-10-20T10:15:00.000Z",
                    "consentPath": "/connect/ctrader#request=40000000-0000-4000-8000-000000000004&proof=<ONE_TIME_PROOF>"
                  },
                  "meta": {
                    "apiVersion": "v1",
                    "source": "postgres"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PermissionRequest"
              },
              "example": {
                "endUserId": "20000000-0000-4000-8000-000000000002",
                "returnUrl": "https://journal.example/integrations/unifywire/return",
                "returnState": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
              }
            }
          }
        }
      }
    },
    "/api/v1/ctrader/permission-requests/{requestId}": {
      "get": {
        "operationId": "getPermissionRequest",
        "summary": "Read your consent request decision",
        "description": "pending/expired/cancelled/approved is a decision receipt. approved does not promise current access, selected account, worker availability or fresh data; reauthorize account reads independently.",
        "parameters": [
          {
            "name": "requestId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful authorized stored-data read or scoped mutation acknowledgement.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                },
                "description": "Do not cache shared customer responses."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/PermissionRequestStatus"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/api/v1/accounts": {
      "get": {
        "operationId": "listAccounts",
        "summary": "List authorized stored accounts",
        "description": "No provider fetch. Account items include canonical IDs, exact providerAccountId and nullable brokerAccountNumber from retained authorized display metadata. The broker number can differ from the provider API ID and is not an ownership or globally unique lookup key.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 2048
            },
            "description": "Opaque returned cursor. Do not decode, construct, reuse across resources/accounts, or assume a cross-request snapshot."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful authorized stored-data read or scoped mutation acknowledgement.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                },
                "description": "Do not cache shared customer responses."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/AccountsCollection"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/api/v1/accounts/{id}": {
      "get": {
        "operationId": "getAccount",
        "summary": "Read an authorized stored account",
        "description": "",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Canonical UnifyWire account ID; never substitute broker number or providerAccountId."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful authorized stored-data read or scoped mutation acknowledgement.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                },
                "description": "Do not cache shared customer responses."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Account"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/api/v1/accounts/{id}/positions": {
      "get": {
        "operationId": "listPositions",
        "summary": "Read stored position rows",
        "description": "These rows are stored snapshots, not tick-live positions or historical exposure proof.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Canonical UnifyWire account ID; never substitute broker number or providerAccountId."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 2048
            },
            "description": "Opaque returned cursor. Do not decode, construct, reuse across resources/accounts, or assume a cross-request snapshot."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful authorized stored-data read or scoped mutation acknowledgement.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                },
                "description": "Do not cache shared customer responses."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/PositionsCollection"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/api/v1/accounts/{id}/executions": {
      "get": {
        "operationId": "listExecutions",
        "summary": "Read immutable fill-level executions",
        "description": "Fill/deal facts, not reconstructed round trips. account_units quantities, signed costs, nullable gross P&L. Some canonical zeros are defaulted/not applicable; use execution-details costs.source. Reprocessing identical evidence is idempotent; conflicting immutable evidence fails closed.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Canonical UnifyWire account ID; never substitute broker number or providerAccountId."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 2048
            },
            "description": "Opaque returned cursor. Do not decode, construct, reuse across resources/accounts, or assume a cross-request snapshot."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful authorized stored-data read or scoped mutation acknowledgement.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                },
                "description": "Do not cache shared customer responses."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ExecutionsCollection"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                },
                "example": {
                  "data": {
                    "items": [
                      {
                        "id": "60000000-0000-4000-8000-000000000006",
                        "organizationId": "50000000-0000-4000-8000-000000000005",
                        "endUserId": "20000000-0000-4000-8000-000000000002",
                        "connectionId": "30000000-0000-4000-8000-000000000003",
                        "tradingAccountId": "10000000-0000-4000-8000-000000000001",
                        "provider": "ctrader",
                        "providerExecutionId": "810001",
                        "providerOrderId": "820001",
                        "providerPositionId": "830001",
                        "symbol": "EURUSD",
                        "side": "buy",
                        "quantity": "2000",
                        "price": "1.08",
                        "grossPnl": null,
                        "commission": "-0.1",
                        "swap": "0",
                        "fees": "0",
                        "executedAt": "2026-10-20T10:01:00.000Z",
                        "providerObservedAt": "2026-10-20T10:06:00.000Z"
                      }
                    ],
                    "page": {
                      "limit": 50,
                      "hasMore": false,
                      "nextCursor": null
                    }
                  },
                  "meta": {
                    "apiVersion": "v1",
                    "source": "postgres"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/api/v1/accounts/{id}/trades": {
      "get": {
        "operationId": "listReconstructedTrades",
        "summary": "Read reconstructed cTrader lifecycles",
        "description": "Derived from complete bounded executions and opening-boundary evidence; one lifecycle can contain an opening plus several partial closes. Inspect capability and each derivationStatus/netPnlStatus. Current reconstruction requires verified HEDGED/type 0 evidence and at most 5,000 input executions across the entire collection; pagination does not bypass this bound. No balanceAfter/final-close-balance field.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Canonical UnifyWire account ID; never substitute broker number or providerAccountId."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 2048
            },
            "description": "Opaque returned cursor. Do not decode, construct, reuse across resources/accounts, or assume a cross-request snapshot."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful authorized stored-data read or scoped mutation acknowledgement.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                },
                "description": "Do not cache shared customer responses."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/TradesCollection"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                },
                "example": {
                  "data": {
                    "items": [
                      {
                        "id": "70000000-0000-4000-8000-000000000007",
                        "organizationId": "50000000-0000-4000-8000-000000000005",
                        "tradingAccountId": "10000000-0000-4000-8000-000000000001",
                        "provider": "ctrader",
                        "calculationVersion": "ctrader-hedged-lifecycle-v1",
                        "lifecycleKey": "ctrader:position:830001",
                        "providerPositionId": "830001",
                        "openingAbsenceObservedAt": "2026-10-20T10:00:00.000Z",
                        "derivationStatus": "complete",
                        "lifecycleStatus": "closed",
                        "incompleteReasons": [],
                        "unsupportedReasons": [],
                        "symbol": "EURUSD",
                        "side": "buy",
                        "openedQuantity": "2000",
                        "closedQuantity": "2000",
                        "remainingQuantity": "0",
                        "averageEntryPrice": "1.08",
                        "averageExitPrice": "1.0815",
                        "realizedGrossPnl": "3",
                        "commission": "-0.2",
                        "swap": "0",
                        "fees": "0",
                        "netPnl": "2.8",
                        "netPnlStatus": "complete",
                        "openedAt": "2026-10-20T10:01:00.000Z",
                        "closedAt": "2026-10-20T10:05:00.000Z",
                        "firstExecutionAt": "2026-10-20T10:01:00.000Z",
                        "lastExecutionAt": "2026-10-20T10:05:00.000Z",
                        "sourceExecutionIds": [
                          "60000000-0000-4000-8000-000000000006",
                          "60000000-0000-4000-8000-000000000007",
                          "60000000-0000-4000-8000-000000000008"
                        ],
                        "derivedAt": "2026-10-20T10:06:00.000Z"
                      }
                    ],
                    "page": {
                      "limit": 50,
                      "hasMore": false,
                      "nextCursor": null
                    },
                    "capability": {
                      "available": true,
                      "calculationVersion": "ctrader-hedged-lifecycle-v1",
                      "status": "complete",
                      "coverageFrom": "2026-10-20T10:00:00.000Z",
                      "coverageThrough": "2026-10-20T10:06:00.000Z",
                      "inputExecutionCount": 3,
                      "tradeCount": 1,
                      "completeTradeCount": 1,
                      "incompleteTradeCount": 0,
                      "unsupportedTradeCount": 0
                    }
                  },
                  "meta": {
                    "apiVersion": "v1",
                    "source": "postgres"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/api/v1/accounts/{id}/instruments": {
      "get": {
        "operationId": "listInstruments",
        "summary": "Read retained instrument metadata versions",
        "description": "quantityUnit=account_units. unitsPerLot is available only with verified metadata; historical applicability and catalog completeness are not asserted.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Canonical UnifyWire account ID; never substitute broker number or providerAccountId."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 2048
            },
            "description": "Opaque returned cursor. Do not decode, construct, reuse across resources/accounts, or assume a cross-request snapshot."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful authorized stored-data read or scoped mutation acknowledgement.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                },
                "description": "Do not cache shared customer responses."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/InstrumentsCollection"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/api/v1/accounts/{id}/execution-instruments": {
      "get": {
        "operationId": "listExecutionInstruments",
        "summary": "Read execution-to-instrument mapping evidence",
        "description": "Latest committed retained metadata, not guaranteed metadata effective at historical execution time. Inspect per-row availability.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Canonical UnifyWire account ID; never substitute broker number or providerAccountId."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 2048
            },
            "description": "Opaque returned cursor. Do not decode, construct, reuse across resources/accounts, or assume a cross-request snapshot."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful authorized stored-data read or scoped mutation acknowledgement.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                },
                "description": "Do not cache shared customer responses."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ExecutionInstrumentsCollection"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/api/v1/accounts/{id}/execution-details": {
      "get": {
        "operationId": "listExecutionDetails",
        "summary": "Read execution cost and timestamp provenance",
        "description": "Distinguishes reported costs, defaulted zero, not-applicable and unavailable values; supplies currency/timestamp origins when evidenced. fees is specifically P&L conversion fee, not a complete general fee ledger. Optional exact single include=closing selects execution-details-v2, adding provider closing balances/allocated commission without changing v1 fill costs. Openings and unsupported/unverified monetary evidence return explicit null/provenance/availability. Retain include=closing for every page; cursors are representation-bound and cannot cross v1/v2. Malformed/conflicting filled raw evidence fails closed.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Canonical UnifyWire account ID; never substitute broker number or providerAccountId."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 5,
              "default": 5
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 2048
            },
            "description": "Opaque returned cursor. Do not decode, construct, reuse across resources/accounts, or assume a cross-request snapshot. Execution-details cursors are bound to the selected representation; switching include=closing while reusing a cursor returns 400."
          },
          {
            "name": "include",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "const": "closing"
            },
            "description": "Omit for unchanged execution-details-v1. Supply exactly one include=closing for execution-details-v2. Empty, repeated or different include values are invalid. Keep this parameter on every continuation request."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful authorized stored-data read or scoped mutation acknowledgement.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                },
                "description": "Do not cache shared customer responses."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/ExecutionDetailsCollection"
                        },
                        {
                          "$ref": "#/components/schemas/ExecutionDetailsCollectionV2"
                        }
                      ]
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                },
                "examples": {
                  "closingV2": {
                    "summary": "Fictional opt-in example; optional balanceVersion is absent without invalidating amounts",
                    "value": {
                      "data": {
                        "items": [
                          {
                            "schemaVersion": "execution-details-v2",
                            "executionId": "50000000-0000-4000-8000-000000000003",
                            "tradingAccountId": "40000000-0000-4000-8000-000000000004",
                            "quantityUnit": "account_units",
                            "executedAt": "2026-01-14T10:10:00.000Z",
                            "providerObservedAt": "2026-01-14T10:10:01.000Z",
                            "fillRole": "closing",
                            "costs": {
                              "grossPnl": {
                                "value": "2",
                                "basis": "realized_close",
                                "source": "reported"
                              },
                              "commission": {
                                "value": "-0.05",
                                "basis": "executed_fill",
                                "source": "reported"
                              },
                              "swap": {
                                "value": "0",
                                "basis": "realized_close",
                                "source": "reported"
                              },
                              "fees": {
                                "value": "-0.02",
                                "basis": "pnl_conversion_fee",
                                "source": "reported"
                              }
                            },
                            "amountCurrency": {
                              "value": "USD",
                              "observedAt": "2026-01-14T10:10:01.000Z",
                              "basis": "observed_account_deposit_currency",
                              "applicability": "observed_only",
                              "availability": {
                                "available": true,
                                "reason": null
                              }
                            },
                            "timestampOrigins": {
                              "executedAt": "provider_execution",
                              "providerObservedAt": "application_acquisition",
                              "acquisitionBasis": "history_response_acquisition",
                              "availability": {
                                "available": true,
                                "reason": null
                              }
                            },
                            "availability": {
                              "available": true,
                              "reason": null
                            },
                            "closing": {
                              "balance": "1002.78",
                              "allocatedCommission": "-0.1",
                              "moneyDigits": 2,
                              "balanceVersion": null,
                              "provenance": {
                                "balance": "provider_reported",
                                "allocatedCommission": "provider_reported",
                                "moneyDigits": "provider_reported",
                                "balanceVersion": "unavailable"
                              },
                              "availability": {
                                "available": true,
                                "reason": null
                              }
                            }
                          }
                        ],
                        "capability": {
                          "available": true,
                          "reason": null,
                          "schemaVersion": "execution-details-v2",
                          "basis": "first_retained_execution_evidence"
                        },
                        "page": {
                          "limit": 5,
                          "hasMore": false,
                          "nextCursor": null
                        }
                      },
                      "meta": {
                        "apiVersion": "v1",
                        "source": "postgres"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        },
        "x-representation-selection": {
          "default": "execution-details-v1",
          "include=closing": "execution-details-v2",
          "amendmentStatus": "implemented_in_source"
        }
      }
    },
    "/api/v1/accounts/{id}/observations": {
      "get": {
        "operationId": "listObservations",
        "summary": "Read coherent-observation summaries",
        "description": "Retained captures newest first, not complete observation history or interval coverage. Follow each opaque id to observation detail.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Canonical UnifyWire account ID; never substitute broker number or providerAccountId."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 5,
              "default": 1
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 2048
            },
            "description": "Opaque returned cursor. Do not decode, construct, reuse across resources/accounts, or assume a cross-request snapshot."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful authorized stored-data read or scoped mutation acknowledgement.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                },
                "description": "Do not cache shared customer responses."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ObservationsCollection"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/api/v1/accounts/{id}/orders": {
      "get": {
        "operationId": "listOrderObservations",
        "summary": "Read retained order observations",
        "description": "Read-only order observations newest first, not an order-entry/cancellation API. Changed observations have separate revisions; collection completeness is not asserted.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Canonical UnifyWire account ID; never substitute broker number or providerAccountId."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 5,
              "default": 5
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 2048
            },
            "description": "Opaque returned cursor. Do not decode, construct, reuse across resources/accounts, or assume a cross-request snapshot."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful authorized stored-data read or scoped mutation acknowledgement.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                },
                "description": "Do not cache shared customer responses."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/OrdersCollection"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/api/v1/accounts/{id}/cash-movements": {
      "get": {
        "operationId": "listCashMovements",
        "summary": "Read retained balance movements",
        "description": "Deposits/withdrawals/other movements newest observed first, with reported scale; currency is explicitly null/unavailable. balanceAfter/equityAfter are movement-specific, not trade final-close balances.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Canonical UnifyWire account ID; never substitute broker number or providerAccountId."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 5,
              "default": 5
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 2048
            },
            "description": "Opaque returned cursor. Do not decode, construct, reuse across resources/accounts, or assume a cross-request snapshot."
          },
          {
            "name": "include",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "financial"
              ]
            },
            "description": "Opt in to financialLink. Existing IDs, revisions and default representation remain unchanged. Missing balance version is null."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful authorized stored-data read or scoped mutation acknowledgement.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                },
                "description": "Do not cache shared customer responses."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/CashMovementsCollection"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/api/v1/accounts/{id}/history-requests": {
      "get": {
        "operationId": "listHistoryRequests",
        "summary": "Read retained complete provider-response acquisitions",
        "description": "Newest response first. Complete individual responses only; does not assert contiguous execution/financial coverage.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Canonical UnifyWire account ID; never substitute broker number or providerAccountId."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 5,
              "default": 5
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 2048
            },
            "description": "Opaque returned cursor. Do not decode, construct, reuse across resources/accounts, or assume a cross-request snapshot."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful authorized stored-data read or scoped mutation acknowledgement.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                },
                "description": "Do not cache shared customer responses."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/HistoryRequestsCollection"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/api/v1/accounts/{id}/observations/{observationId}": {
      "get": {
        "operationId": "getObservation",
        "summary": "Read one coherent stored observation",
        "description": "No query parameters accepted. Data may be null with an explicit availability reason. Coherent capture contains balance/equity and observed open positions, not a balance at each trade close.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Canonical UnifyWire account ID; never substitute broker number or providerAccountId."
          },
          {
            "name": "observationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Opaque id from /observations, not a private snapshot UUID."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful authorized stored-data read or scoped mutation acknowledgement.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                },
                "description": "Do not cache shared customer responses."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Observation"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/api/v1/accounts/{id}/sync": {
      "get": {
        "operationId": "getSyncStatus",
        "summary": "Read committed coverage and latest run",
        "description": "Read only. state=current means retained successful/covered state; it does not promise wall-clock freshness, active service, demand-job completion or SLA.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Canonical UnifyWire account ID; never substitute broker number or providerAccountId."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful authorized stored-data read or scoped mutation acknowledgement.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                },
                "description": "Do not cache shared customer responses."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/SyncStatus"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/api/v1/accounts/{id}/freshness": {
      "get": {
        "operationId": "getFreshness",
        "summary": "Read independent coverage and observation ages",
        "description": "Application-clock ages of committed execution coverage and coherent stored observation. Unknown/clock-ahead/missing evidence is explicit. Not provider heartbeat or freshness SLA.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Canonical UnifyWire account ID; never substitute broker number or providerAccountId."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful authorized stored-data read or scoped mutation acknowledgement.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                },
                "description": "Do not cache shared customer responses."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Freshness"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/api/v1/accounts/{id}/operations": {
      "get": {
        "operationId": "getOperations",
        "summary": "Read policy and assessed sync activity",
        "description": "Separates policy, latest successful run, sync and freshness. enabled/idle/continuous do not prove worker liveness; cadenceSeconds is not a read-rate limit or evidence of recurring polling.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Canonical UnifyWire account ID; never substitute broker number or providerAccountId."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful authorized stored-data read or scoped mutation acknowledgement.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                },
                "description": "Do not cache shared customer responses."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Operations"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/api/v1/accounts/{id}/refresh": {
      "post": {
        "operationId": "requestRefresh",
        "summary": "Request asynchronous account refresh",
        "description": "Asynchronous account-level demand, shared upstream across authorized customers without exposing their permissions/job identity. Requests while pending coalesce; terminal-job cooldown defaults to 300 seconds with independent minimum five-second admission spacing, provider limits, failure backoff and bounded work. An HTTP 202 response does not prove worker eligibility or success. Fixed requestedThrough is about request time minus five seconds; one request can continue bounded catch-up across batches/restarts. Correlate using requestedAt+requestedThrough/account; GET returns latest receipt, no request-specific/job-ID resource or Idempotency-Key exists. Completion proves committed execution coverage to the cutoff, not recent observation or a new trade. Stored data may be absent, old or incomplete. Send no request body: not {}, null, whitespace or bytes. A stream must reach EOF. Explicit include=financial selects account-refresh-v2: completion additionally requires successful reconstruction and fenced financial publication covering the receipt cutoff. Required inputs continue across internal batches/restarts. Financial physicalObservedAt is the genuine retained endpoint, distinct from fixed requestedThrough. Missing baseline/unsupported evidence fails closed; no equity or cash values are invented. The underlying cooldown/job/permission scope is unchanged; existing terminal v1 receipts are not upgraded by GET.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Canonical UnifyWire account ID; never substitute broker number or providerAccountId."
          },
          {
            "name": "include",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "const": "financial"
            },
            "description": "Select account-refresh-v2. POST binds required financial evidence to this same receipt/cutoff; GET reads only. Default v1 remains execution-only."
          }
        ],
        "responses": {
          "202": {
            "description": "Accepted asynchronous request, coalesced request or cooldown response; inspect data.refresh.status. Not successful provider synchronization.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                },
                "description": "Do not cache shared customer responses."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/RefreshResponse"
                        },
                        {
                          "$ref": "#/components/schemas/FinancialRefreshResponse"
                        }
                      ]
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                },
                "examples": {
                  "executionOnly": {
                    "value": {
                      "data": {
                        "schemaVersion": "account-refresh-v1",
                        "tradingAccountId": "10000000-0000-4000-8000-000000000001",
                        "refresh": {
                          "status": "pending",
                          "requestedAt": "2026-10-20T10:06:05.000Z",
                          "requestedThrough": "2026-10-20T10:06:00.000Z",
                          "nextEligibleAt": "2026-10-20T10:11:05.000Z",
                          "retryAt": null
                        },
                        "stored": {
                          "available": true,
                          "state": {
                            "balance": "10000",
                            "equity": "10000",
                            "marginUsed": "0",
                            "freeMargin": "10000",
                            "currency": "USD",
                            "observedAt": "2026-10-20T09:59:59.000Z",
                            "providerObservedAt": "2026-10-20T09:59:59.000Z"
                          },
                          "sync": {
                            "tradingAccountId": "10000000-0000-4000-8000-000000000001",
                            "provider": "ctrader",
                            "state": "current",
                            "coverageFrom": "2026-10-20T09:00:00.000Z",
                            "coverageThrough": "2026-10-20T10:00:00.000Z",
                            "coverageUpdatedAt": "2026-10-20T10:00:01.000Z",
                            "latestObservation": {
                              "observedAt": "2026-10-20T09:59:59.000Z",
                              "providerObservedAt": "2026-10-20T09:59:59.000Z",
                              "sourceVersion": null,
                              "openPositionCount": 0
                            },
                            "latestRun": null
                          },
                          "freshness": {
                            "schemaVersion": "account-freshness-v1",
                            "tradingAccountId": "10000000-0000-4000-8000-000000000001",
                            "provider": "ctrader",
                            "assessedAt": "2026-10-20T10:06:05.000Z",
                            "assessmentClock": "application",
                            "executionCoverage": {
                              "basis": "contiguous_execution_coverage_through",
                              "coverageFrom": "2026-10-20T09:00:00.000Z",
                              "coverageThrough": "2026-10-20T10:00:00.000Z",
                              "coverageUpdatedAt": "2026-10-20T10:00:01.000Z",
                              "status": "known",
                              "ageMs": 365000,
                              "reason": null
                            },
                            "coherentObservation": {
                              "basis": "retained_coherent_snapshot_observed_at",
                              "observedAt": "2026-10-20T09:59:59.000Z",
                              "status": "known",
                              "ageMs": 366000,
                              "reason": null
                            }
                          }
                        },
                        "statusUrl": "/api/v1/accounts/10000000-0000-4000-8000-000000000001/refresh"
                      },
                      "meta": {
                        "apiVersion": "v1",
                        "source": "postgres"
                      }
                    }
                  },
                  "financialPending": {
                    "value": {
                      "data": {
                        "schemaVersion": "account-refresh-v2",
                        "tradingAccountId": "10000000-0000-4000-8000-000000000001",
                        "refresh": {
                          "status": "pending",
                          "requestedAt": "2026-10-20T10:06:05.000Z",
                          "requestedThrough": "2026-10-20T10:06:00.000Z",
                          "nextEligibleAt": "2026-10-20T10:11:05.000Z",
                          "retryAt": null,
                          "financial": {
                            "requiredFrom": "2026-10-20T09:00:00.000Z",
                            "executionComplete": false,
                            "status": "pending",
                            "through": null,
                            "physicalObservedAt": null,
                            "resourceUrl": null
                          }
                        },
                        "stored": {
                          "available": true,
                          "state": {
                            "balance": "10000",
                            "equity": "10000",
                            "marginUsed": "0",
                            "freeMargin": "10000",
                            "currency": "USD",
                            "observedAt": "2026-10-20T09:59:59.000Z",
                            "providerObservedAt": "2026-10-20T09:59:59.000Z"
                          },
                          "sync": {
                            "tradingAccountId": "10000000-0000-4000-8000-000000000001",
                            "provider": "ctrader",
                            "state": "current",
                            "coverageFrom": "2026-10-20T09:00:00.000Z",
                            "coverageThrough": "2026-10-20T10:00:00.000Z",
                            "coverageUpdatedAt": "2026-10-20T10:00:01.000Z",
                            "latestObservation": {
                              "observedAt": "2026-10-20T09:59:59.000Z",
                              "providerObservedAt": "2026-10-20T09:59:59.000Z",
                              "sourceVersion": null,
                              "openPositionCount": 0
                            },
                            "latestRun": null
                          },
                          "freshness": {
                            "schemaVersion": "account-freshness-v1",
                            "tradingAccountId": "10000000-0000-4000-8000-000000000001",
                            "provider": "ctrader",
                            "assessedAt": "2026-10-20T10:06:05.000Z",
                            "assessmentClock": "application",
                            "executionCoverage": {
                              "basis": "contiguous_execution_coverage_through",
                              "coverageFrom": "2026-10-20T09:00:00.000Z",
                              "coverageThrough": "2026-10-20T10:00:00.000Z",
                              "coverageUpdatedAt": "2026-10-20T10:00:01.000Z",
                              "status": "known",
                              "ageMs": 365000,
                              "reason": null
                            },
                            "coherentObservation": {
                              "basis": "retained_coherent_snapshot_observed_at",
                              "observedAt": "2026-10-20T09:59:59.000Z",
                              "status": "known",
                              "ageMs": 366000,
                              "reason": null
                            }
                          }
                        },
                        "statusUrl": "/api/v1/accounts/10000000-0000-4000-8000-000000000001/refresh?include=financial"
                      },
                      "meta": {
                        "apiVersion": "v1",
                        "source": "postgres"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        },
        "x-request-body-required-empty": true
      },
      "get": {
        "operationId": "getRefresh",
        "summary": "Read latest refresh receipt and stored result",
        "description": "Never queues or settles work. Returns latest tenant-local receipt and stored data/freshness; refresh.status may idle/pending/running/retry_wait/completed/failed/cancelled. cooldown is an admission POST override, not a sticky GET job state. No shared job identifier is exposed. Explicit include=financial selects account-refresh-v2: completion additionally requires successful reconstruction and fenced financial publication covering the receipt cutoff. Required inputs continue across internal batches/restarts. Financial physicalObservedAt is the genuine retained endpoint, distinct from fixed requestedThrough. Missing baseline/unsupported evidence fails closed; no equity or cash values are invented. The underlying cooldown/job/permission scope is unchanged; existing terminal v1 receipts are not upgraded by GET. GET include=history-origin is a stored-data-only registration/coverage witness; it never creates a refresh or financial demand. POST does not support history-origin.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Canonical UnifyWire account ID; never substitute broker number or providerAccountId."
          },
          {
            "name": "include",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "financial",
                "history-origin"
              ]
            },
            "description": "GET-only representation selection. financial reads v2 publication status; history-origin adds account-wide retained registration provenance to v1 without requesting financial work. Omit for unchanged v1."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful authorized stored-data read or scoped mutation acknowledgement.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                },
                "description": "Do not cache shared customer responses."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/RefreshResponse"
                        },
                        {
                          "$ref": "#/components/schemas/FinancialRefreshResponse"
                        },
                        {
                          "$ref": "#/components/schemas/HistoryOriginRefreshResponse"
                        }
                      ]
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                },
                "examples": {
                  "executionOnly": {
                    "value": {
                      "data": {
                        "schemaVersion": "account-refresh-v1",
                        "tradingAccountId": "10000000-0000-4000-8000-000000000001",
                        "refresh": {
                          "status": "pending",
                          "requestedAt": "2026-10-20T10:06:05.000Z",
                          "requestedThrough": "2026-10-20T10:06:00.000Z",
                          "nextEligibleAt": "2026-10-20T10:11:05.000Z",
                          "retryAt": null
                        },
                        "stored": {
                          "available": true,
                          "state": {
                            "balance": "10000",
                            "equity": "10000",
                            "marginUsed": "0",
                            "freeMargin": "10000",
                            "currency": "USD",
                            "observedAt": "2026-10-20T09:59:59.000Z",
                            "providerObservedAt": "2026-10-20T09:59:59.000Z"
                          },
                          "sync": {
                            "tradingAccountId": "10000000-0000-4000-8000-000000000001",
                            "provider": "ctrader",
                            "state": "current",
                            "coverageFrom": "2026-10-20T09:00:00.000Z",
                            "coverageThrough": "2026-10-20T10:00:00.000Z",
                            "coverageUpdatedAt": "2026-10-20T10:00:01.000Z",
                            "latestObservation": {
                              "observedAt": "2026-10-20T09:59:59.000Z",
                              "providerObservedAt": "2026-10-20T09:59:59.000Z",
                              "sourceVersion": null,
                              "openPositionCount": 0
                            },
                            "latestRun": null
                          },
                          "freshness": {
                            "schemaVersion": "account-freshness-v1",
                            "tradingAccountId": "10000000-0000-4000-8000-000000000001",
                            "provider": "ctrader",
                            "assessedAt": "2026-10-20T10:06:05.000Z",
                            "assessmentClock": "application",
                            "executionCoverage": {
                              "basis": "contiguous_execution_coverage_through",
                              "coverageFrom": "2026-10-20T09:00:00.000Z",
                              "coverageThrough": "2026-10-20T10:00:00.000Z",
                              "coverageUpdatedAt": "2026-10-20T10:00:01.000Z",
                              "status": "known",
                              "ageMs": 365000,
                              "reason": null
                            },
                            "coherentObservation": {
                              "basis": "retained_coherent_snapshot_observed_at",
                              "observedAt": "2026-10-20T09:59:59.000Z",
                              "status": "known",
                              "ageMs": 366000,
                              "reason": null
                            }
                          }
                        },
                        "statusUrl": "/api/v1/accounts/10000000-0000-4000-8000-000000000001/refresh"
                      },
                      "meta": {
                        "apiVersion": "v1",
                        "source": "postgres"
                      }
                    }
                  },
                  "financialPending": {
                    "value": {
                      "data": {
                        "schemaVersion": "account-refresh-v2",
                        "tradingAccountId": "10000000-0000-4000-8000-000000000001",
                        "refresh": {
                          "status": "pending",
                          "requestedAt": "2026-10-20T10:06:05.000Z",
                          "requestedThrough": "2026-10-20T10:06:00.000Z",
                          "nextEligibleAt": "2026-10-20T10:11:05.000Z",
                          "retryAt": null,
                          "financial": {
                            "requiredFrom": "2026-10-20T09:00:00.000Z",
                            "executionComplete": false,
                            "status": "pending",
                            "through": null,
                            "physicalObservedAt": null,
                            "resourceUrl": null
                          }
                        },
                        "stored": {
                          "available": true,
                          "state": {
                            "balance": "10000",
                            "equity": "10000",
                            "marginUsed": "0",
                            "freeMargin": "10000",
                            "currency": "USD",
                            "observedAt": "2026-10-20T09:59:59.000Z",
                            "providerObservedAt": "2026-10-20T09:59:59.000Z"
                          },
                          "sync": {
                            "tradingAccountId": "10000000-0000-4000-8000-000000000001",
                            "provider": "ctrader",
                            "state": "current",
                            "coverageFrom": "2026-10-20T09:00:00.000Z",
                            "coverageThrough": "2026-10-20T10:00:00.000Z",
                            "coverageUpdatedAt": "2026-10-20T10:00:01.000Z",
                            "latestObservation": {
                              "observedAt": "2026-10-20T09:59:59.000Z",
                              "providerObservedAt": "2026-10-20T09:59:59.000Z",
                              "sourceVersion": null,
                              "openPositionCount": 0
                            },
                            "latestRun": null
                          },
                          "freshness": {
                            "schemaVersion": "account-freshness-v1",
                            "tradingAccountId": "10000000-0000-4000-8000-000000000001",
                            "provider": "ctrader",
                            "assessedAt": "2026-10-20T10:06:05.000Z",
                            "assessmentClock": "application",
                            "executionCoverage": {
                              "basis": "contiguous_execution_coverage_through",
                              "coverageFrom": "2026-10-20T09:00:00.000Z",
                              "coverageThrough": "2026-10-20T10:00:00.000Z",
                              "coverageUpdatedAt": "2026-10-20T10:00:01.000Z",
                              "status": "known",
                              "ageMs": 365000,
                              "reason": null
                            },
                            "coherentObservation": {
                              "basis": "retained_coherent_snapshot_observed_at",
                              "observedAt": "2026-10-20T09:59:59.000Z",
                              "status": "known",
                              "ageMs": 366000,
                              "reason": null
                            }
                          }
                        },
                        "statusUrl": "/api/v1/accounts/10000000-0000-4000-8000-000000000001/refresh?include=financial"
                      },
                      "meta": {
                        "apiVersion": "v1",
                        "source": "postgres"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/api/v1/accounts/{id}/financial-evidence": {
      "get": {
        "operationId": "getFinancialEvidence",
        "summary": "Read one exact retained replay interval",
        "description": "Retained interval only. Does not acquire/replay arbitrary requested history or invent unavailable rule-boundary anchors. Returns explicit unavailable/incomplete/unsupported when evidence cannot establish results.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Canonical UnifyWire account ID; never substitute broker number or providerAccountId."
          },
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
            },
            "description": "Exact canonical UTC millisecond boundary; through must be greater than from. Do not round returned boundaries."
          },
          {
            "name": "through",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
            },
            "description": "Exact canonical UTC millisecond boundary; through must be greater than from. Do not round returned boundaries."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful authorized stored-data read or scoped mutation acknowledgement.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                },
                "description": "Do not cache shared customer responses."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/FinancialEvidence"
                        },
                        {
                          "$ref": "#/components/schemas/FinancialEvidenceV2"
                        }
                      ]
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/api/v1/accounts/{id}/financial-evidence-intervals": {
      "get": {
        "operationId": "listFinancialIntervals",
        "summary": "Discover retained replay interval metadata",
        "description": "Manifest metadata only (coverageProof=false). Cursor is bound to account and requested range. retainedStatus=complete_record is not validated complete financial evidence; retrieve the exact interval. Unsupported retained intervals remain counted.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Canonical UnifyWire account ID; never substitute broker number or providerAccountId."
          },
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
            },
            "description": "Exact canonical UTC millisecond boundary; through must be greater than from. Do not round returned boundaries."
          },
          {
            "name": "through",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
            },
            "description": "Exact canonical UTC millisecond boundary; through must be greater than from. Do not round returned boundaries."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 25,
              "default": 25
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 2048
            },
            "description": "Opaque returned cursor. Do not decode, construct, reuse across resources/accounts, or assume a cross-request snapshot."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful authorized stored-data read or scoped mutation acknowledgement.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                },
                "description": "Do not cache shared customer responses."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/FinancialEvidenceIntervals"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/api/v1/accounts/{id}/financial-evidence-chain": {
      "get": {
        "operationId": "getFinancialEvidenceChain",
        "summary": "Read a validated contiguous retained evidence chain",
        "description": "Retained read only; does not fetch missing evidence. Exact physical boundary joins, currency/quantity consistency and unique source executions required. Bounded to 2,500 intervals/5,000 total points/10 MiB private evidence/10-second batch; maximum request range is 2,500 ? 600,000 milliseconds. Missing/invalid chain returns HTTP 503 service_unavailable, never a fabricated partial success.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Canonical UnifyWire account ID; never substitute broker number or providerAccountId."
          },
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
            },
            "description": "Exact canonical UTC millisecond boundary; through must be greater than from. Do not round returned boundaries."
          },
          {
            "name": "through",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
            },
            "description": "Exact canonical UTC millisecond boundary; through must be greater than from. Do not round returned boundaries."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful authorized stored-data read or scoped mutation acknowledgement.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                },
                "description": "Do not cache shared customer responses."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/FinancialEvidenceChain"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/api/v1/accounts/{id}/permission-lineage": {
      "get": {
        "operationId": "getPermissionLineage",
        "summary": "Verify retained re-consent enrollment lineage",
        "description": "Exactly these two query parameters. Requires current authorized successor and matching consent request; checks a retained predecessor chain. Does not reactivate access or establish ownership by matching provider IDs. Retained re-consent is implemented but its deployed live acceptance remains deferred.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Canonical UnifyWire account ID; never substitute broker number or providerAccountId."
          },
          {
            "name": "previousAuthorizationRevision",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^unifywire-customer-authorization-v1:[0-9a-f]{64}$"
            }
          },
          {
            "name": "requestId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful authorized stored-data read or scoped mutation acknowledgement.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                },
                "description": "Do not cache shared customer responses."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/PermissionLineage"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/api/v1/accounts/{id}/observations/{observationId}/financial-boundary": {
      "get": {
        "operationId": "getObservationFinancialBoundary",
        "summary": "Join one stored observation to a financial boundary",
        "description": "Authenticated, read-only identity relation for the same retained coherent capture. No query parameters. observationRevision is the canonical SHA256 revision of the unchanged original observation response data; boundaryRevision joins financial-evidence boundaries. Null when the capture is unavailable. This asserts no interval coverage, activation request or freshness, and starts no provider work.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Canonical UnifyWire account ID; never substitute broker number or providerAccountId."
          },
          {
            "name": "observationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Opaque id from /observations, not a private snapshot UUID."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful authorized stored-data read or scoped mutation acknowledgement.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                },
                "description": "Do not cache shared customer responses."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ObservationFinancialBoundary"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/api/v1/accounts/{id}/financial-evidence-links": {
      "get": {
        "operationId": "getFinancialEvidenceLinks",
        "summary": "Read validated baseline and cash-ledger identity links for one retained financial interval",
        "description": "Reuses exact retained financial validation and authorization. financialSourceRevision must match the separately read financial resource. No links are asserted for unavailable evidence. Physical anchor boundary joins observations/{observationId}/financial-boundary; cashMovementId joins cash-movements?include=financial. Does not establish pre-origin absence or acquire missing history.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Canonical UnifyWire account ID; never substitute broker number or providerAccountId."
          },
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
            },
            "description": "Exact canonical UTC millisecond boundary; through must be greater than from. Do not round returned boundaries."
          },
          {
            "name": "through",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
            },
            "description": "Exact canonical UTC millisecond boundary; through must be greater than from. Do not round returned boundaries."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful authorized stored-data read or scoped mutation acknowledgement.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                },
                "description": "Do not cache shared customer responses."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/FinancialEvidenceLinks"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "PrivateApiKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "uw_test_<identifier>.<secret> or uw_live_<identifier>.<secret>",
        "description": "Authorization: Bearer <UNIFYWIRE_API_KEY>. Use only in your backend. Key derives organization and test/live environment; never accept organizationId in request bodies as authority. No public key-issuance endpoint or per-end-user login token is defined by this contract."
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Malformed JSON, invalid fields/query/body, unsupported provider or operation. error.code=invalid_request.",
        "headers": {
          "Cache-Control": {
            "schema": {
              "type": "string",
              "const": "no-store"
            },
            "description": "Do not cache shared customer responses."
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Missing, invalid or revoked private API key. error.code=unauthorized.",
        "headers": {
          "Cache-Control": {
            "schema": {
              "type": "string",
              "const": "no-store"
            },
            "description": "Do not cache shared customer responses."
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "NotFound": {
        "description": "Unknown, foreign, revoked or inaccessible resource. Not evidence that an identifier does not exist globally. error.code=not_found.",
        "headers": {
          "Cache-Control": {
            "schema": {
              "type": "string",
              "const": "no-store"
            },
            "description": "Do not cache shared customer responses."
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Conflict": {
        "description": "Conflicting identity, current state, account selection or operator-managed synchronization. error.code=conflict.",
        "headers": {
          "Cache-Control": {
            "schema": {
              "type": "string",
              "const": "no-store"
            },
            "description": "Do not cache shared customer responses."
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "PreconditionFailed": {
        "description": "Quoted authorization revision does not match the reviewed grant; no revocation made. error.code=precondition_failed.",
        "headers": {
          "Cache-Control": {
            "schema": {
              "type": "string",
              "const": "no-store"
            },
            "description": "Do not cache shared customer responses."
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "InternalError": {
        "description": "Request failed without exposing private details. error.code=internal_error. A mutation transport/server failure does not prove that no write committed.",
        "headers": {
          "Cache-Control": {
            "schema": {
              "type": "string",
              "const": "no-store"
            },
            "description": "Do not cache shared customer responses."
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Unavailable": {
        "description": "Maintenance uses service_unavailable; missing configured backend uses backend_not_configured; a bounded unavailable financial chain uses service_unavailable. Retry reads with bounded backoff; do not blindly repeat uncertain writes.",
        "headers": {
          "Cache-Control": {
            "schema": {
              "type": "string",
              "const": "no-store"
            },
            "description": "Do not cache shared customer responses."
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "schemas": {
      "EndUser": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "externalId": {
            "type": "string"
          },
          "displayName": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "externalId",
          "displayName",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "Connection": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "organizationId": {
            "type": "string"
          },
          "endUserId": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "environment": {
            "type": "string",
            "enum": [
              "test",
              "live"
            ]
          },
          "authorizationStrategy": {
            "type": "string",
            "enum": [
              "oauth",
              "credentials",
              "external"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "pending",
              "authorizing",
              "connected",
              "requires_action",
              "degraded",
              "disconnected",
              "revoked",
              "failed"
            ]
          },
          "externalReference": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string"
              }
            ]
          },
          "failureCategory": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string"
              }
            ]
          },
          "tradingAccountIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "organizationId",
          "endUserId",
          "provider",
          "environment",
          "authorizationStrategy",
          "state",
          "externalReference",
          "failureCategory",
          "tradingAccountIds",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "Account": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "organizationId": {
            "type": "string"
          },
          "endUserId": {
            "type": "string"
          },
          "connectionIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "provider": {
            "type": "string"
          },
          "providerAccountId": {
            "type": "string",
            "description": "Exact provider API account identifier, preserved as a string. It is not necessarily the broker-facing trading number."
          },
          "externalReference": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string"
              }
            ]
          },
          "displayName": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string"
              }
            ]
          },
          "brokerAccountNumber": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "pattern": "^[0-9]{1,19}$"
              }
            ],
            "description": "Retained broker-facing trading number from the currently authorized account/source relationship. Preserve leading zeros. Null when missing, conflicting or unavailable. Display metadata only: use id for routes and providerAccountId for the native API identifier; never infer this number from either ID or displayName."
          },
          "currency": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "discovered",
              "active",
              "disabled",
              "archived"
            ]
          },
          "authorizationRevision": {
            "type": "string",
            "pattern": "^unifywire-customer-authorization-v1:[0-9a-f]{64}$",
            "description": "Opaque current central-consent revision, present only for validated central grants. Save with the owned connection and quote in end-user-scoped disconnect If-Match."
          },
          "latestState": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/AccountState"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "organizationId",
          "endUserId",
          "connectionIds",
          "provider",
          "providerAccountId",
          "externalReference",
          "displayName",
          "brokerAccountNumber",
          "currency",
          "status",
          "latestState",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "AccountState": {
        "type": "object",
        "properties": {
          "balance": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                "description": "Exact decimal string; do not parse financial values through binary floating point."
              }
            ]
          },
          "equity": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                "description": "Exact decimal string; do not parse financial values through binary floating point."
              }
            ]
          },
          "marginUsed": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                "description": "Exact decimal string; do not parse financial values through binary floating point."
              }
            ]
          },
          "freeMargin": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                "description": "Exact decimal string; do not parse financial values through binary floating point."
              }
            ]
          },
          "currency": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string"
              }
            ]
          },
          "observedAt": {
            "type": "string",
            "format": "date-time"
          },
          "providerObservedAt": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "format": "date-time"
              }
            ],
            "description": "For current cTrader capture this is the local P&L response-received clock, not a provider event clock."
          }
        },
        "required": [
          "balance",
          "equity",
          "marginUsed",
          "freeMargin",
          "currency",
          "observedAt",
          "providerObservedAt"
        ],
        "additionalProperties": false
      },
      "Execution": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "organizationId": {
            "type": "string"
          },
          "endUserId": {
            "type": "string"
          },
          "connectionId": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string"
              }
            ]
          },
          "tradingAccountId": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "providerExecutionId": {
            "type": "string"
          },
          "providerOrderId": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string"
              }
            ]
          },
          "providerPositionId": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string"
              }
            ]
          },
          "symbol": {
            "type": "string"
          },
          "side": {
            "type": "string",
            "enum": [
              "buy",
              "sell"
            ]
          },
          "quantity": {
            "type": "string",
            "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
            "description": "Exact decimal string; do not parse financial values through binary floating point. Normalized account units, not lots or provider hundredths-of-unit raw volume."
          },
          "price": {
            "type": "string",
            "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
            "description": "Exact decimal string; do not parse financial values through binary floating point."
          },
          "grossPnl": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                "description": "Exact decimal string; do not parse financial values through binary floating point."
              }
            ],
            "description": "Realized closing-fill P&L; null for non-closing/unavailable evidence."
          },
          "commission": {
            "type": "string",
            "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
            "description": "Signed executed-fill commission. A canonical zero may be defaulted; see execution-details.costs.commission.source."
          },
          "swap": {
            "type": "string",
            "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
            "description": "Signed realized-close swap; opening fills use zero as not applicable."
          },
          "fees": {
            "type": "string",
            "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
            "description": "Signed P&L conversion fee only, not every broker fee. See execution-details provenance."
          },
          "executedAt": {
            "type": "string",
            "format": "date-time"
          },
          "providerObservedAt": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "format": "date-time"
              }
            ],
            "description": "Application acquisition time, not provider event time; exact provenance is in execution-details.timestampOrigins."
          }
        },
        "required": [
          "id",
          "organizationId",
          "endUserId",
          "connectionId",
          "tradingAccountId",
          "provider",
          "providerExecutionId",
          "providerOrderId",
          "providerPositionId",
          "symbol",
          "side",
          "quantity",
          "price",
          "grossPnl",
          "commission",
          "swap",
          "fees",
          "executedAt",
          "providerObservedAt"
        ],
        "additionalProperties": false
      },
      "Position": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "organizationId": {
            "type": "string"
          },
          "tradingAccountId": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "providerPositionId": {
            "type": "string"
          },
          "symbol": {
            "type": "string"
          },
          "side": {
            "type": "string",
            "enum": [
              "buy",
              "sell"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "closed"
            ]
          },
          "quantity": {
            "type": "string",
            "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
            "description": "Exact decimal string; do not parse financial values through binary floating point. Normalized account units, not lots."
          },
          "averageEntryPrice": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                "description": "Exact decimal string; do not parse financial values through binary floating point."
              }
            ]
          },
          "averageExitPrice": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                "description": "Exact decimal string; do not parse financial values through binary floating point."
              }
            ]
          },
          "grossPnl": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                "description": "Exact decimal string; do not parse financial values through binary floating point."
              }
            ]
          },
          "openedAt": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "format": "date-time"
              }
            ]
          },
          "closedAt": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "format": "date-time"
              }
            ]
          },
          "providerObservedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Provider update time when supplied; otherwise application observation fallback. Not the execution timestamp."
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "organizationId",
          "tradingAccountId",
          "provider",
          "providerPositionId",
          "symbol",
          "side",
          "status",
          "quantity",
          "averageEntryPrice",
          "averageExitPrice",
          "grossPnl",
          "openedAt",
          "closedAt",
          "providerObservedAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "ReconstructedTrade": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "organizationId": {
            "type": "string"
          },
          "tradingAccountId": {
            "type": "string"
          },
          "provider": {
            "type": "string",
            "const": "ctrader"
          },
          "calculationVersion": {
            "type": "string"
          },
          "lifecycleKey": {
            "type": "string"
          },
          "providerPositionId": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string"
              }
            ]
          },
          "openingAbsenceObservedAt": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "format": "date-time"
              }
            ],
            "description": "Physical absence observation where available. Null for a provider-registration boundary; optional openingAbsenceBasis/effectiveAt identify that logical proof instead."
          },
          "derivationStatus": {
            "type": "string",
            "enum": [
              "complete",
              "incomplete",
              "unsupported"
            ]
          },
          "lifecycleStatus": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "const": "open"
              },
              {
                "type": "string",
                "const": "closed"
              }
            ]
          },
          "incompleteReasons": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "unsupportedReasons": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "symbol": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string"
              }
            ]
          },
          "side": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "const": "buy"
              },
              {
                "type": "string",
                "const": "sell"
              }
            ]
          },
          "openedQuantity": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                "description": "Exact decimal string; do not parse financial values through binary floating point."
              }
            ],
            "description": "Normalized account units, not lots. Exact decimal string or null when derivation is unavailable."
          },
          "closedQuantity": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                "description": "Exact decimal string; do not parse financial values through binary floating point."
              }
            ],
            "description": "Normalized account units, not lots. Exact decimal string or null when derivation is unavailable."
          },
          "remainingQuantity": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                "description": "Exact decimal string; do not parse financial values through binary floating point."
              }
            ],
            "description": "Normalized account units, not lots. Exact decimal string or null when derivation is unavailable."
          },
          "averageEntryPrice": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                "description": "Exact decimal string; do not parse financial values through binary floating point."
              }
            ]
          },
          "averageExitPrice": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                "description": "Exact decimal string; do not parse financial values through binary floating point."
              }
            ]
          },
          "realizedGrossPnl": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                "description": "Exact decimal string; do not parse financial values through binary floating point."
              }
            ]
          },
          "commission": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                "description": "Exact decimal string; do not parse financial values through binary floating point."
              }
            ]
          },
          "swap": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                "description": "Exact decimal string; do not parse financial values through binary floating point."
              }
            ]
          },
          "fees": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                "description": "Exact decimal string; do not parse financial values through binary floating point."
              }
            ]
          },
          "netPnl": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                "description": "Exact decimal string; do not parse financial values through binary floating point."
              }
            ],
            "description": "Complete closed lifecycle: realizedGrossPnl + signed commission + signed swap + signed fees. Null until full close or when evidence is unavailable. Not a broker account balance."
          },
          "netPnlStatus": {
            "type": "string",
            "enum": [
              "complete",
              "pending_full_close",
              "unavailable"
            ]
          },
          "openedAt": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "format": "date-time"
              }
            ]
          },
          "closedAt": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "format": "date-time"
              }
            ]
          },
          "firstExecutionAt": {
            "type": "string",
            "format": "date-time"
          },
          "lastExecutionAt": {
            "type": "string",
            "format": "date-time"
          },
          "sourceExecutionIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "derivedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Deterministic latest source-execution record creation timestamp, not a tick-live calculation time."
          },
          "openingAbsenceBasis": {
            "type": "string",
            "const": "account_registration"
          },
          "openingAbsenceEffectiveAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "organizationId",
          "tradingAccountId",
          "provider",
          "calculationVersion",
          "lifecycleKey",
          "providerPositionId",
          "openingAbsenceObservedAt",
          "derivationStatus",
          "lifecycleStatus",
          "incompleteReasons",
          "unsupportedReasons",
          "symbol",
          "side",
          "openedQuantity",
          "closedQuantity",
          "remainingQuantity",
          "averageEntryPrice",
          "averageExitPrice",
          "realizedGrossPnl",
          "commission",
          "swap",
          "fees",
          "netPnl",
          "netPnlStatus",
          "openedAt",
          "closedAt",
          "firstExecutionAt",
          "lastExecutionAt",
          "sourceExecutionIds",
          "derivedAt"
        ],
        "additionalProperties": false
      },
      "SyncStatus": {
        "type": "object",
        "properties": {
          "tradingAccountId": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "failed",
              "incomplete",
              "not_started",
              "syncing",
              "current"
            ]
          },
          "coverageFrom": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "format": "date-time"
              }
            ]
          },
          "coverageThrough": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "format": "date-time"
              }
            ]
          },
          "coverageUpdatedAt": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "format": "date-time"
              }
            ]
          },
          "latestObservation": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "properties": {
                  "observedAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "providerObservedAt": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "string",
                        "format": "date-time"
                      }
                    ]
                  },
                  "sourceVersion": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "string"
                      }
                    ]
                  },
                  "openPositionCount": {
                    "type": "integer",
                    "minimum": 0
                  }
                },
                "required": [
                  "observedAt",
                  "providerObservedAt",
                  "sourceVersion",
                  "openPositionCount"
                ],
                "additionalProperties": false
              }
            ]
          },
          "latestRun": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "account_snapshot",
                      "incremental",
                      "historical_backfill",
                      "reconciliation"
                    ]
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "failed",
                      "queued",
                      "running",
                      "succeeded",
                      "partial",
                      "cancelled"
                    ]
                  },
                  "requestedFrom": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "string",
                        "format": "date-time"
                      }
                    ]
                  },
                  "requestedTo": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "string",
                        "format": "date-time"
                      }
                    ]
                  },
                  "startedAt": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "string",
                        "format": "date-time"
                      }
                    ]
                  },
                  "completedAt": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "string",
                        "format": "date-time"
                      }
                    ]
                  },
                  "counts": {
                    "type": "object",
                    "properties": {
                      "executions": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "positions": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "accountStates": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "providerEvents": {
                        "type": "integer",
                        "minimum": 0
                      }
                    },
                    "required": [
                      "executions",
                      "positions",
                      "accountStates",
                      "providerEvents"
                    ],
                    "additionalProperties": false
                  },
                  "failureCategory": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "string"
                      }
                    ]
                  }
                },
                "required": [
                  "kind",
                  "status",
                  "requestedFrom",
                  "requestedTo",
                  "startedAt",
                  "completedAt",
                  "counts",
                  "failureCategory"
                ],
                "additionalProperties": false
              }
            ]
          }
        },
        "required": [
          "tradingAccountId",
          "provider",
          "state",
          "coverageFrom",
          "coverageThrough",
          "coverageUpdatedAt",
          "latestObservation",
          "latestRun"
        ],
        "additionalProperties": false
      },
      "Freshness": {
        "type": "object",
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "account-freshness-v1"
          },
          "tradingAccountId": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "assessedAt": {
            "type": "string",
            "format": "date-time"
          },
          "assessmentClock": {
            "type": "string",
            "const": "application"
          },
          "executionCoverage": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "const": "known"
                  },
                  "ageMs": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "reason": {
                    "type": "null"
                  },
                  "basis": {
                    "type": "string",
                    "const": "contiguous_execution_coverage_through"
                  },
                  "coverageFrom": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "string",
                        "format": "date-time"
                      }
                    ]
                  },
                  "coverageThrough": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "string",
                        "format": "date-time"
                      }
                    ]
                  },
                  "coverageUpdatedAt": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "string",
                        "format": "date-time"
                      }
                    ]
                  }
                },
                "required": [
                  "status",
                  "ageMs",
                  "reason",
                  "basis",
                  "coverageFrom",
                  "coverageThrough",
                  "coverageUpdatedAt"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "const": "unknown"
                  },
                  "ageMs": {
                    "type": "null"
                  },
                  "reason": {
                    "type": "string",
                    "enum": [
                      "evidence_missing",
                      "evidence_clock_invalid",
                      "evidence_clock_ahead",
                      "provider_not_supported"
                    ]
                  },
                  "basis": {
                    "type": "string",
                    "const": "contiguous_execution_coverage_through"
                  },
                  "coverageFrom": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "string",
                        "format": "date-time"
                      }
                    ]
                  },
                  "coverageThrough": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "string",
                        "format": "date-time"
                      }
                    ]
                  },
                  "coverageUpdatedAt": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "string",
                        "format": "date-time"
                      }
                    ]
                  }
                },
                "required": [
                  "status",
                  "ageMs",
                  "reason",
                  "basis",
                  "coverageFrom",
                  "coverageThrough",
                  "coverageUpdatedAt"
                ],
                "additionalProperties": false
              }
            ]
          },
          "coherentObservation": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "const": "known"
                  },
                  "ageMs": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "reason": {
                    "type": "null"
                  },
                  "basis": {
                    "type": "string",
                    "const": "retained_coherent_snapshot_observed_at"
                  },
                  "observedAt": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "string",
                        "format": "date-time"
                      }
                    ]
                  }
                },
                "required": [
                  "status",
                  "ageMs",
                  "reason",
                  "basis",
                  "observedAt"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "const": "unknown"
                  },
                  "ageMs": {
                    "type": "null"
                  },
                  "reason": {
                    "type": "string",
                    "enum": [
                      "evidence_missing",
                      "evidence_clock_invalid",
                      "evidence_clock_ahead",
                      "provider_not_supported"
                    ]
                  },
                  "basis": {
                    "type": "string",
                    "const": "retained_coherent_snapshot_observed_at"
                  },
                  "observedAt": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "string",
                        "format": "date-time"
                      }
                    ]
                  }
                },
                "required": [
                  "status",
                  "ageMs",
                  "reason",
                  "basis",
                  "observedAt"
                ],
                "additionalProperties": false
              }
            ]
          }
        },
        "required": [
          "schemaVersion",
          "tradingAccountId",
          "provider",
          "assessedAt",
          "assessmentClock",
          "executionCoverage",
          "coherentObservation"
        ],
        "additionalProperties": false
      },
      "Operations": {
        "type": "object",
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "account-operations-v1"
          },
          "tradingAccountId": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "assessedAt": {
            "type": "string",
            "format": "date-time"
          },
          "activity": {
            "type": "string",
            "enum": [
              "syncing",
              "queued",
              "unknown",
              "catching_up",
              "idle"
            ]
          },
          "operations": {
            "type": "object",
            "properties": {
              "targetMode": {
                "anyOf": [
                  {
                    "type": "null"
                  },
                  {
                    "type": "string",
                    "const": "disabled"
                  },
                  {
                    "type": "string",
                    "const": "canary"
                  },
                  {
                    "type": "string",
                    "const": "continuous"
                  }
                ]
              },
              "cadenceSeconds": {
                "anyOf": [
                  {
                    "type": "null"
                  },
                  {
                    "type": "integer",
                    "minimum": 0
                  }
                ]
              },
              "nextDueAt": {
                "anyOf": [
                  {
                    "type": "null"
                  },
                  {
                    "type": "string",
                    "format": "date-time"
                  }
                ]
              },
              "acquisitionPolicy": {
                "type": "string",
                "enum": [
                  "unknown",
                  "paused",
                  "enabled"
                ]
              },
              "lastSucceededRunAt": {
                "anyOf": [
                  {
                    "type": "null"
                  },
                  {
                    "type": "string",
                    "format": "date-time"
                  }
                ]
              }
            },
            "required": [
              "targetMode",
              "cadenceSeconds",
              "nextDueAt",
              "acquisitionPolicy",
              "lastSucceededRunAt"
            ],
            "additionalProperties": false
          },
          "sync": {
            "$ref": "#/components/schemas/SyncStatus"
          },
          "freshness": {
            "$ref": "#/components/schemas/Freshness"
          }
        },
        "required": [
          "schemaVersion",
          "tradingAccountId",
          "provider",
          "assessedAt",
          "activity",
          "operations",
          "sync",
          "freshness"
        ],
        "additionalProperties": false
      },
      "Instrument": {
        "type": "object",
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "account-instrument-v1"
          },
          "id": {
            "type": "string"
          },
          "revision": {
            "type": "string"
          },
          "tradingAccountId": {
            "type": "string"
          },
          "provider": {
            "type": "string",
            "const": "ctrader"
          },
          "symbol": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string"
              }
            ]
          },
          "archived": {
            "type": "boolean"
          },
          "observedAt": {
            "type": "string",
            "format": "date-time"
          },
          "observationBasis": {
            "type": "string",
            "const": "first_retained_observation"
          },
          "applicability": {
            "type": "string",
            "const": "observed_metadata_only"
          },
          "quantityUnit": {
            "type": "string",
            "const": "account_units"
          },
          "measurementUnits": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string"
              }
            ]
          },
          "priceDigits": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 18
              },
              {
                "type": "null"
              }
            ]
          },
          "unitsPerLot": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                "description": "Exact decimal string; do not parse financial values through binary floating point."
              }
            ]
          },
          "lotConversion": {
            "type": "object",
            "properties": {
              "available": {
                "type": "boolean"
              },
              "reason": {
                "anyOf": [
                  {
                    "type": "null"
                  },
                  {
                    "type": "string",
                    "const": "archived_instrument"
                  },
                  {
                    "type": "string",
                    "const": "metadata_missing"
                  },
                  {
                    "type": "string",
                    "const": "metadata_invalid"
                  }
                ]
              }
            },
            "required": [
              "available",
              "reason"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "schemaVersion",
          "id",
          "revision",
          "tradingAccountId",
          "provider",
          "symbol",
          "archived",
          "observedAt",
          "observationBasis",
          "applicability",
          "quantityUnit",
          "measurementUnits",
          "priceDigits",
          "unitsPerLot",
          "lotConversion"
        ],
        "additionalProperties": false
      },
      "ExecutionInstrument": {
        "type": "object",
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "execution-instrument-v1"
          },
          "executionId": {
            "type": "string"
          },
          "tradingAccountId": {
            "type": "string"
          },
          "executedAt": {
            "type": "string",
            "format": "date-time"
          },
          "quantityUnit": {
            "type": "string",
            "const": "account_units"
          },
          "mappingBasis": {
            "type": "string",
            "const": "latest_committed_retained_metadata"
          },
          "metadataRecordedAt": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "format": "date-time"
              }
            ]
          },
          "instrument": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Instrument"
              }
            ]
          },
          "availability": {
            "type": "object",
            "properties": {
              "available": {
                "type": "boolean"
              },
              "reason": {
                "anyOf": [
                  {
                    "type": "null"
                  },
                  {
                    "type": "string",
                    "const": "execution_evidence_missing"
                  },
                  {
                    "type": "string",
                    "const": "execution_evidence_mismatch"
                  },
                  {
                    "type": "string",
                    "const": "instrument_metadata_missing"
                  },
                  {
                    "type": "string",
                    "const": "instrument_metadata_unverified"
                  },
                  {
                    "type": "string",
                    "const": "instrument_metadata_ambiguous"
                  }
                ]
              }
            },
            "required": [
              "available",
              "reason"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "schemaVersion",
          "executionId",
          "tradingAccountId",
          "executedAt",
          "quantityUnit",
          "mappingBasis",
          "metadataRecordedAt",
          "instrument",
          "availability"
        ],
        "additionalProperties": false
      },
      "ExecutionDetails": {
        "type": "object",
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "execution-details-v1"
          },
          "executionId": {
            "type": "string"
          },
          "tradingAccountId": {
            "type": "string"
          },
          "quantityUnit": {
            "type": "string",
            "const": "account_units"
          },
          "executedAt": {
            "type": "string",
            "format": "date-time"
          },
          "providerObservedAt": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "format": "date-time"
              }
            ]
          },
          "fillRole": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "const": "opening_or_increase"
              },
              {
                "type": "string",
                "const": "closing"
              }
            ]
          },
          "costs": {
            "type": "object",
            "properties": {
              "grossPnl": {
                "type": "object",
                "properties": {
                  "value": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "$ref": "#/components/schemas/Decimal"
                      }
                    ]
                  },
                  "basis": {
                    "type": "string",
                    "const": "realized_close"
                  },
                  "source": {
                    "type": "string",
                    "enum": [
                      "unavailable",
                      "reported",
                      "defaulted_zero",
                      "not_applicable"
                    ]
                  }
                },
                "required": [
                  "value",
                  "basis",
                  "source"
                ],
                "additionalProperties": false
              },
              "commission": {
                "type": "object",
                "properties": {
                  "value": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "$ref": "#/components/schemas/Decimal"
                      }
                    ]
                  },
                  "basis": {
                    "type": "string",
                    "const": "executed_fill"
                  },
                  "source": {
                    "type": "string",
                    "enum": [
                      "unavailable",
                      "reported",
                      "defaulted_zero",
                      "not_applicable"
                    ]
                  }
                },
                "required": [
                  "value",
                  "basis",
                  "source"
                ],
                "additionalProperties": false
              },
              "swap": {
                "type": "object",
                "properties": {
                  "value": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "$ref": "#/components/schemas/Decimal"
                      }
                    ]
                  },
                  "basis": {
                    "type": "string",
                    "const": "realized_close"
                  },
                  "source": {
                    "type": "string",
                    "enum": [
                      "unavailable",
                      "reported",
                      "defaulted_zero",
                      "not_applicable"
                    ]
                  }
                },
                "required": [
                  "value",
                  "basis",
                  "source"
                ],
                "additionalProperties": false
              },
              "fees": {
                "type": "object",
                "properties": {
                  "value": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "$ref": "#/components/schemas/Decimal"
                      }
                    ]
                  },
                  "basis": {
                    "type": "string",
                    "const": "pnl_conversion_fee"
                  },
                  "source": {
                    "type": "string",
                    "enum": [
                      "unavailable",
                      "reported",
                      "defaulted_zero",
                      "not_applicable"
                    ]
                  }
                },
                "required": [
                  "value",
                  "basis",
                  "source"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "grossPnl",
              "commission",
              "swap",
              "fees"
            ],
            "additionalProperties": false
          },
          "amountCurrency": {
            "type": "object",
            "properties": {
              "value": {
                "anyOf": [
                  {
                    "type": "null"
                  },
                  {
                    "type": "string"
                  }
                ]
              },
              "observedAt": {
                "anyOf": [
                  {
                    "type": "null"
                  },
                  {
                    "type": "string",
                    "format": "date-time"
                  }
                ]
              },
              "basis": {
                "type": "string",
                "const": "observed_account_deposit_currency"
              },
              "applicability": {
                "type": "string",
                "const": "observed_only"
              },
              "availability": {
                "type": "object",
                "properties": {
                  "available": {
                    "type": "boolean"
                  },
                  "reason": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "string",
                        "const": "currency_missing"
                      },
                      {
                        "type": "string",
                        "const": "currency_ambiguous"
                      },
                      {
                        "type": "string",
                        "const": "currency_unverified"
                      }
                    ]
                  }
                },
                "required": [
                  "available",
                  "reason"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "value",
              "observedAt",
              "basis",
              "applicability",
              "availability"
            ],
            "additionalProperties": false
          },
          "timestampOrigins": {
            "type": "object",
            "properties": {
              "executedAt": {
                "anyOf": [
                  {
                    "type": "null"
                  },
                  {
                    "type": "string",
                    "const": "provider_execution"
                  }
                ]
              },
              "providerObservedAt": {
                "anyOf": [
                  {
                    "type": "null"
                  },
                  {
                    "type": "string",
                    "const": "application_acquisition"
                  }
                ]
              },
              "acquisitionBasis": {
                "anyOf": [
                  {
                    "type": "null"
                  },
                  {
                    "type": "string",
                    "const": "history_response_acquisition"
                  },
                  {
                    "type": "string",
                    "const": "coherent_capture_response"
                  }
                ]
              },
              "availability": {
                "type": "object",
                "properties": {
                  "available": {
                    "type": "boolean"
                  },
                  "reason": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "string",
                        "const": "execution_evidence_missing"
                      },
                      {
                        "type": "string",
                        "const": "execution_evidence_unverified"
                      },
                      {
                        "type": "string",
                        "const": "monetary_scale_unavailable"
                      },
                      {
                        "type": "string",
                        "const": "first_acquisition_missing"
                      },
                      {
                        "type": "string",
                        "const": "acquisition_basis_missing"
                      }
                    ]
                  }
                },
                "required": [
                  "available",
                  "reason"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "executedAt",
              "providerObservedAt",
              "acquisitionBasis",
              "availability"
            ],
            "additionalProperties": false
          },
          "availability": {
            "type": "object",
            "properties": {
              "available": {
                "type": "boolean"
              },
              "reason": {
                "anyOf": [
                  {
                    "type": "null"
                  },
                  {
                    "type": "string",
                    "const": "execution_evidence_missing"
                  },
                  {
                    "type": "string",
                    "const": "execution_evidence_unverified"
                  },
                  {
                    "type": "string",
                    "const": "monetary_scale_unavailable"
                  }
                ]
              }
            },
            "required": [
              "available",
              "reason"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "schemaVersion",
          "executionId",
          "tradingAccountId",
          "quantityUnit",
          "executedAt",
          "providerObservedAt",
          "fillRole",
          "costs",
          "amountCurrency",
          "timestampOrigins",
          "availability"
        ],
        "additionalProperties": false
      },
      "ObservationSummary": {
        "type": "object",
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "account-observation-v1"
          },
          "id": {
            "type": "string"
          },
          "tradingAccountId": {
            "type": "string"
          },
          "provider": {
            "type": "string",
            "const": "ctrader"
          },
          "observedAt": {
            "type": "string",
            "format": "date-time"
          },
          "observationBasis": {
            "type": "string",
            "const": "retained_coherent_capture"
          },
          "openPositionCount": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "integer",
                "minimum": 0
              }
            ]
          },
          "availability": {
            "type": "object",
            "properties": {
              "available": {
                "type": "boolean"
              },
              "reason": {
                "anyOf": [
                  {
                    "type": "null"
                  },
                  {
                    "type": "string",
                    "const": "capture_incomplete"
                  },
                  {
                    "type": "string",
                    "const": "amount_basis_missing"
                  },
                  {
                    "type": "string",
                    "const": "observation_invalid"
                  },
                  {
                    "type": "string",
                    "const": "observation_too_large"
                  }
                ]
              }
            },
            "required": [
              "available",
              "reason"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "schemaVersion",
          "id",
          "tradingAccountId",
          "provider",
          "observedAt",
          "observationBasis",
          "openPositionCount",
          "availability"
        ],
        "additionalProperties": false
      },
      "Observation": {
        "type": "object",
        "properties": {
          "data": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "properties": {
                  "currency": {
                    "type": "string"
                  },
                  "currencyBasis": {
                    "type": "string",
                    "const": "account_deposit_currency"
                  },
                  "accountModel": {
                    "type": "string",
                    "enum": [
                      "unknown",
                      "hedged"
                    ]
                  },
                  "balance": {
                    "type": "string",
                    "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                    "description": "Exact decimal string; do not parse financial values through binary floating point."
                  },
                  "equity": {
                    "type": "string",
                    "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                    "description": "Exact decimal string; do not parse financial values through binary floating point."
                  },
                  "grossUnrealizedPnl": {
                    "type": "string",
                    "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                    "description": "Exact decimal string; do not parse financial values through binary floating point."
                  },
                  "providerNetUnrealizedPnl": {
                    "type": "string",
                    "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                    "description": "Exact decimal string; do not parse financial values through binary floating point."
                  },
                  "closingCommissionAdjustment": {
                    "type": "string",
                    "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                    "description": "Exact decimal string; do not parse financial values through binary floating point."
                  },
                  "adjustedNetUnrealizedPnl": {
                    "type": "string",
                    "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                    "description": "Exact decimal string; do not parse financial values through binary floating point."
                  },
                  "equityBasis": {
                    "type": "string",
                    "const": "balance_plus_provider_net_plus_closing_commission_adjustment"
                  },
                  "acquisition": {
                    "type": "object",
                    "properties": {
                      "startedAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "pnlRequestSentAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "pnlResponseReceivedAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "completedAt": {
                        "type": "string",
                        "format": "date-time"
                      }
                    },
                    "required": [
                      "startedAt",
                      "pnlRequestSentAt",
                      "pnlResponseReceivedAt",
                      "completedAt"
                    ],
                    "additionalProperties": false,
                    "description": "Local acquisition clocks, not provider event times or interval coverage."
                  },
                  "positions": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "instrumentId": {
                          "type": "string"
                        },
                        "symbol": {
                          "anyOf": [
                            {
                              "type": "null"
                            },
                            {
                              "type": "string"
                            }
                          ]
                        },
                        "side": {
                          "type": "string",
                          "enum": [
                            "buy",
                            "sell"
                          ]
                        },
                        "quantity": {
                          "type": "string",
                          "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                          "description": "Exact decimal string; do not parse financial values through binary floating point."
                        },
                        "quantityUnit": {
                          "type": "string",
                          "const": "account_units"
                        },
                        "measurementUnits": {
                          "anyOf": [
                            {
                              "type": "null"
                            },
                            {
                              "type": "string"
                            }
                          ]
                        },
                        "entryPrice": {
                          "anyOf": [
                            {
                              "type": "null"
                            },
                            {
                              "type": "string",
                              "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                              "description": "Exact decimal string; do not parse financial values through binary floating point."
                            }
                          ]
                        },
                        "stopLoss": {
                          "anyOf": [
                            {
                              "type": "null"
                            },
                            {
                              "type": "string",
                              "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                              "description": "Exact decimal string; do not parse financial values through binary floating point."
                            }
                          ]
                        },
                        "takeProfit": {
                          "anyOf": [
                            {
                              "type": "null"
                            },
                            {
                              "type": "string",
                              "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                              "description": "Exact decimal string; do not parse financial values through binary floating point."
                            }
                          ]
                        },
                        "openedAt": {
                          "anyOf": [
                            {
                              "type": "null"
                            },
                            {
                              "type": "string",
                              "format": "date-time"
                            }
                          ]
                        },
                        "providerUpdatedAt": {
                          "anyOf": [
                            {
                              "type": "null"
                            },
                            {
                              "type": "string",
                              "format": "date-time"
                            }
                          ]
                        },
                        "grossUnrealizedPnl": {
                          "type": "string",
                          "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                          "description": "Exact decimal string; do not parse financial values through binary floating point."
                        },
                        "providerNetUnrealizedPnl": {
                          "type": "string",
                          "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                          "description": "Exact decimal string; do not parse financial values through binary floating point."
                        },
                        "closingCommissionAdjustment": {
                          "type": "string",
                          "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                          "description": "Exact decimal string; do not parse financial values through binary floating point."
                        },
                        "adjustedNetUnrealizedPnl": {
                          "type": "string",
                          "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                          "description": "Exact decimal string; do not parse financial values through binary floating point."
                        },
                        "costs": {
                          "type": "object",
                          "properties": {
                            "basis": {
                              "type": "string",
                              "const": "reported_position_costs"
                            },
                            "swap": {
                              "type": "object",
                              "properties": {
                                "amount": {
                                  "anyOf": [
                                    {
                                      "type": "null"
                                    },
                                    {
                                      "type": "string",
                                      "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                                      "description": "Exact decimal string; do not parse financial values through binary floating point."
                                    }
                                  ]
                                },
                                "reason": {
                                  "anyOf": [
                                    {
                                      "type": "null"
                                    },
                                    {
                                      "type": "string",
                                      "const": "not_supplied"
                                    },
                                    {
                                      "type": "string",
                                      "const": "money_scale_missing"
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "amount",
                                "reason"
                              ],
                              "additionalProperties": false
                            },
                            "commission": {
                              "type": "object",
                              "properties": {
                                "amount": {
                                  "anyOf": [
                                    {
                                      "type": "null"
                                    },
                                    {
                                      "type": "string",
                                      "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                                      "description": "Exact decimal string; do not parse financial values through binary floating point."
                                    }
                                  ]
                                },
                                "reason": {
                                  "anyOf": [
                                    {
                                      "type": "null"
                                    },
                                    {
                                      "type": "string",
                                      "const": "not_supplied"
                                    },
                                    {
                                      "type": "string",
                                      "const": "money_scale_missing"
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "amount",
                                "reason"
                              ],
                              "additionalProperties": false
                            },
                            "mirroringCommission": {
                              "type": "object",
                              "properties": {
                                "amount": {
                                  "anyOf": [
                                    {
                                      "type": "null"
                                    },
                                    {
                                      "type": "string",
                                      "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                                      "description": "Exact decimal string; do not parse financial values through binary floating point."
                                    }
                                  ]
                                },
                                "reason": {
                                  "anyOf": [
                                    {
                                      "type": "null"
                                    },
                                    {
                                      "type": "string",
                                      "const": "not_supplied"
                                    },
                                    {
                                      "type": "string",
                                      "const": "money_scale_missing"
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "amount",
                                "reason"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "basis",
                            "swap",
                            "commission",
                            "mirroringCommission"
                          ],
                          "additionalProperties": false,
                          "description": "Signed reported amounts, in the parent observation's deposit currency."
                        }
                      },
                      "required": [
                        "id",
                        "instrumentId",
                        "symbol",
                        "side",
                        "quantity",
                        "quantityUnit",
                        "measurementUnits",
                        "entryPrice",
                        "stopLoss",
                        "takeProfit",
                        "openedAt",
                        "providerUpdatedAt",
                        "grossUnrealizedPnl",
                        "providerNetUnrealizedPnl",
                        "closingCommissionAdjustment",
                        "adjustedNetUnrealizedPnl",
                        "costs"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "currency",
                  "currencyBasis",
                  "accountModel",
                  "balance",
                  "equity",
                  "grossUnrealizedPnl",
                  "providerNetUnrealizedPnl",
                  "closingCommissionAdjustment",
                  "adjustedNetUnrealizedPnl",
                  "equityBasis",
                  "acquisition",
                  "positions"
                ],
                "additionalProperties": false
              }
            ]
          },
          "schemaVersion": {
            "type": "string",
            "const": "account-observation-v1"
          },
          "id": {
            "type": "string"
          },
          "tradingAccountId": {
            "type": "string"
          },
          "provider": {
            "type": "string",
            "const": "ctrader"
          },
          "observedAt": {
            "type": "string",
            "format": "date-time"
          },
          "observationBasis": {
            "type": "string",
            "const": "retained_coherent_capture"
          },
          "openPositionCount": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "integer",
                "minimum": 0
              }
            ]
          },
          "availability": {
            "type": "object",
            "properties": {
              "available": {
                "type": "boolean"
              },
              "reason": {
                "anyOf": [
                  {
                    "type": "null"
                  },
                  {
                    "type": "string",
                    "const": "capture_incomplete"
                  },
                  {
                    "type": "string",
                    "const": "amount_basis_missing"
                  },
                  {
                    "type": "string",
                    "const": "observation_invalid"
                  },
                  {
                    "type": "string",
                    "const": "observation_too_large"
                  }
                ]
              }
            },
            "required": [
              "available",
              "reason"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "data",
          "schemaVersion",
          "id",
          "tradingAccountId",
          "provider",
          "observedAt",
          "observationBasis",
          "openPositionCount",
          "availability"
        ],
        "additionalProperties": false
      },
      "OrderObservation": {
        "type": "object",
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "order-observation-v1"
          },
          "id": {
            "type": "string"
          },
          "orderId": {
            "type": "string"
          },
          "revision": {
            "type": "string"
          },
          "tradingAccountId": {
            "type": "string"
          },
          "provider": {
            "type": "string",
            "const": "ctrader"
          },
          "observedAt": {
            "type": "string",
            "format": "date-time"
          },
          "basis": {
            "type": "string",
            "const": "retained_order_observation"
          },
          "instrumentId": {
            "type": "string"
          },
          "positionReference": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string"
              }
            ]
          },
          "type": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "side": {
            "type": "string",
            "enum": [
              "buy",
              "sell"
            ]
          },
          "quantity": {
            "type": "string",
            "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
            "description": "Exact decimal string; do not parse financial values through binary floating point."
          },
          "executedQuantity": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                "description": "Exact decimal string; do not parse financial values through binary floating point."
              }
            ]
          },
          "quantityUnit": {
            "type": "string",
            "const": "account_units"
          },
          "measurementUnits": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string"
              }
            ]
          },
          "createdAt": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "format": "date-time"
              }
            ]
          },
          "updatedAt": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "format": "date-time"
              }
            ]
          },
          "expiresAt": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "format": "date-time"
              }
            ]
          },
          "executionPrice": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                "description": "Exact decimal string; do not parse financial values through binary floating point."
              }
            ]
          },
          "limitPrice": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                "description": "Exact decimal string; do not parse financial values through binary floating point."
              }
            ]
          },
          "stopPrice": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                "description": "Exact decimal string; do not parse financial values through binary floating point."
              }
            ]
          },
          "stopLoss": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                "description": "Exact decimal string; do not parse financial values through binary floating point."
              }
            ]
          },
          "takeProfit": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                "description": "Exact decimal string; do not parse financial values through binary floating point."
              }
            ]
          },
          "closingOrder": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "boolean",
                "const": false
              },
              {
                "type": "boolean",
                "const": true
              }
            ]
          },
          "timeInForce": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string"
              }
            ]
          },
          "extensions": {
            "type": "object",
            "properties": {
              "ctrader": {
                "type": "object",
                "properties": {
                  "isStopOut": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "boolean",
                        "const": false
                      },
                      {
                        "type": "boolean",
                        "const": true
                      }
                    ]
                  },
                  "guaranteedStopLoss": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "boolean",
                        "const": false
                      },
                      {
                        "type": "boolean",
                        "const": true
                      }
                    ]
                  },
                  "trailingStopLoss": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "boolean",
                        "const": false
                      },
                      {
                        "type": "boolean",
                        "const": true
                      }
                    ]
                  },
                  "stopTriggerMethod": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "string"
                      }
                    ]
                  },
                  "baseSlippagePrice": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "string",
                        "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                        "description": "Exact decimal string; do not parse financial values through binary floating point."
                      }
                    ]
                  },
                  "relativeStopLoss": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "string",
                        "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                        "description": "Exact decimal string; do not parse financial values through binary floating point."
                      }
                    ]
                  },
                  "relativeTakeProfit": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "string",
                        "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                        "description": "Exact decimal string; do not parse financial values through binary floating point."
                      }
                    ]
                  },
                  "relativeProtectionUnit": {
                    "type": "string",
                    "const": "price_1e_5"
                  },
                  "slippageInPoints": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "string",
                        "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                        "description": "Exact decimal string; do not parse financial values through binary floating point."
                      }
                    ]
                  }
                },
                "required": [
                  "isStopOut",
                  "guaranteedStopLoss",
                  "trailingStopLoss",
                  "stopTriggerMethod",
                  "baseSlippagePrice",
                  "relativeStopLoss",
                  "relativeTakeProfit",
                  "relativeProtectionUnit",
                  "slippageInPoints"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "ctrader"
            ],
            "additionalProperties": false
          },
          "acquisition": {
            "$ref": "#/components/schemas/HistoryRequest"
          }
        },
        "required": [
          "schemaVersion",
          "id",
          "orderId",
          "revision",
          "tradingAccountId",
          "provider",
          "observedAt",
          "basis",
          "instrumentId",
          "positionReference",
          "type",
          "status",
          "side",
          "quantity",
          "executedQuantity",
          "quantityUnit",
          "measurementUnits",
          "createdAt",
          "updatedAt",
          "expiresAt",
          "executionPrice",
          "limitPrice",
          "stopPrice",
          "stopLoss",
          "takeProfit",
          "closingOrder",
          "timeInForce",
          "extensions",
          "acquisition"
        ],
        "additionalProperties": false
      },
      "CashMovement": {
        "type": "object",
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "cash-movement-v1"
          },
          "id": {
            "type": "string"
          },
          "revision": {
            "type": "string"
          },
          "tradingAccountId": {
            "type": "string"
          },
          "provider": {
            "type": "string",
            "const": "ctrader"
          },
          "observedAt": {
            "type": "string",
            "format": "date-time"
          },
          "occurredAt": {
            "type": "string",
            "format": "date-time"
          },
          "basis": {
            "type": "string",
            "const": "retained_balance_movement"
          },
          "kind": {
            "type": "string",
            "enum": [
              "deposit",
              "withdrawal",
              "other"
            ]
          },
          "amount": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                "description": "Exact decimal string; do not parse financial values through binary floating point."
              }
            ]
          },
          "balanceAfter": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                "description": "Exact decimal string; do not parse financial values through binary floating point."
              }
            ]
          },
          "equityAfter": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                "description": "Exact decimal string; do not parse financial values through binary floating point."
              }
            ]
          },
          "currency": {
            "type": "null"
          },
          "currencyBasis": {
            "type": "string",
            "const": "unavailable"
          },
          "moneyDigits": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "integer",
                "minimum": 0
              }
            ]
          },
          "monetaryScale": {
            "type": "string",
            "enum": [
              "provider_reported",
              "unavailable_missing_money_digits",
              "unavailable_unsupported_money_digits"
            ]
          },
          "extensions": {
            "type": "object",
            "properties": {
              "ctrader": {
                "type": "object",
                "properties": {
                  "operation": {
                    "type": "string"
                  },
                  "operationCode": {
                    "type": "integer",
                    "minimum": 0
                  }
                },
                "required": [
                  "operation",
                  "operationCode"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "ctrader"
            ],
            "additionalProperties": false
          },
          "acquisition": {
            "$ref": "#/components/schemas/HistoryRequest"
          },
          "financialLink": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "reference": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "balanceVersion": {
                "anyOf": [
                  {
                    "type": "string",
                    "pattern": "^(?:0|[1-9][0-9]{0,18})$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "basis": {
                "const": "same_retained_cash_movement"
              }
            },
            "required": [
              "reference",
              "balanceVersion",
              "basis"
            ]
          }
        },
        "required": [
          "schemaVersion",
          "id",
          "revision",
          "tradingAccountId",
          "provider",
          "observedAt",
          "occurredAt",
          "basis",
          "kind",
          "amount",
          "balanceAfter",
          "equityAfter",
          "currency",
          "currencyBasis",
          "moneyDigits",
          "monetaryScale",
          "extensions",
          "acquisition"
        ],
        "additionalProperties": false
      },
      "HistoryRequest": {
        "type": "object",
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "account-history-request-v1"
          },
          "id": {
            "type": "string"
          },
          "resource": {
            "type": "string",
            "enum": [
              "orders",
              "cash_movements"
            ]
          },
          "requestedFilter": {
            "type": "object",
            "properties": {
              "from": {
                "type": "string",
                "format": "date-time"
              },
              "through": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "from",
              "through"
            ],
            "additionalProperties": false
          },
          "filterClock": {
            "type": "string",
            "enum": [
              "provider_unspecified",
              "provider_cash_flow_timestamp"
            ]
          },
          "boundaryInclusivity": {
            "type": "string",
            "const": "unspecified"
          },
          "requestCompleteness": {
            "type": "string",
            "const": "complete"
          },
          "executionCoverage": {
            "type": "string",
            "const": "not_asserted"
          },
          "financialCoverage": {
            "type": "string",
            "const": "not_asserted"
          },
          "firstRequestWrittenAt": {
            "type": "string",
            "format": "date-time"
          },
          "lastResponseReceivedAt": {
            "type": "string",
            "format": "date-time"
          },
          "responseCount": {
            "type": "integer",
            "minimum": 0
          },
          "recordCount": {
            "type": "integer",
            "minimum": 0
          }
        },
        "required": [
          "schemaVersion",
          "id",
          "resource",
          "requestedFilter",
          "filterClock",
          "boundaryInclusivity",
          "requestCompleteness",
          "executionCoverage",
          "financialCoverage",
          "firstRequestWrittenAt",
          "lastResponseReceivedAt",
          "responseCount",
          "recordCount"
        ],
        "additionalProperties": false
      },
      "FinancialEvidence": {
        "type": "object",
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "financial-evidence-v1"
          },
          "organizationId": {
            "type": "string"
          },
          "tradingAccountId": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "interval": {
            "type": "object",
            "properties": {
              "from": {
                "type": "string",
                "format": "date-time"
              },
              "through": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "from",
              "through"
            ],
            "additionalProperties": false
          },
          "status": {
            "type": "string",
            "enum": [
              "complete",
              "incomplete",
              "unsupported",
              "unavailable"
            ]
          },
          "available": {
            "type": "boolean"
          },
          "reason": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "const": "retained_replay_unavailable"
              },
              {
                "type": "string",
                "const": "retained_replay_ambiguous"
              },
              {
                "type": "string",
                "const": "retained_replay_invalid"
              },
              {
                "type": "string",
                "const": "retained_replay_incomplete"
              },
              {
                "type": "string",
                "const": "retained_replay_unsupported"
              },
              {
                "type": "string",
                "const": "historical_currency_unavailable"
              },
              {
                "type": "string",
                "const": "execution_provenance_unavailable"
              },
              {
                "type": "string",
                "const": "provider_unsupported"
              }
            ]
          },
          "calculationVersion": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "const": "ctrader-account-equity-replay-v13"
              }
            ]
          },
          "sourceRevision": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string"
              }
            ]
          },
          "sourceExecutionContentRevision": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string"
              }
            ]
          },
          "currency": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string"
              }
            ]
          },
          "quantityUnits": {
            "type": "string",
            "const": "account_units"
          },
          "boundaries": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "properties": {
                  "start": {
                    "type": "object",
                    "properties": {
                      "observedAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "balance": {
                        "type": "string",
                        "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                        "description": "Exact decimal string; do not parse financial values through binary floating point."
                      },
                      "equity": {
                        "type": "string",
                        "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                        "description": "Exact decimal string; do not parse financial values through binary floating point."
                      },
                      "openPositionCount": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "boundaryRevision": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "observedAt",
                      "balance",
                      "equity",
                      "openPositionCount",
                      "boundaryRevision"
                    ],
                    "additionalProperties": false
                  },
                  "end": {
                    "type": "object",
                    "properties": {
                      "observedAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "balance": {
                        "type": "string",
                        "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                        "description": "Exact decimal string; do not parse financial values through binary floating point."
                      },
                      "equity": {
                        "type": "string",
                        "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                        "description": "Exact decimal string; do not parse financial values through binary floating point."
                      },
                      "openPositionCount": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "boundaryRevision": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "observedAt",
                      "balance",
                      "equity",
                      "openPositionCount",
                      "boundaryRevision"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "start",
                  "end"
                ],
                "additionalProperties": false
              }
            ]
          },
          "points": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "sequence": {
                  "type": "integer",
                  "minimum": 0
                },
                "timestampMs": {
                  "type": "string",
                  "pattern": "^[0-9]+$",
                  "description": "Unix epoch milliseconds as an exact decimal integer string."
                },
                "source": {
                  "type": "string",
                  "enum": [
                    "boundary_start",
                    "quote",
                    "before_swap",
                    "after_swap",
                    "before_lifecycle",
                    "after_lifecycle",
                    "boundary_end"
                  ]
                },
                "balance": {
                  "type": "string",
                  "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                  "description": "Exact decimal string; do not parse financial values through binary floating point."
                },
                "equity": {
                  "type": "string",
                  "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                  "description": "Exact decimal string; do not parse financial values through binary floating point."
                },
                "grossUnrealizedPnl": {
                  "type": "string",
                  "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                  "description": "Exact decimal string; do not parse financial values through binary floating point."
                },
                "nativeNetUnrealizedPnl": {
                  "type": "string",
                  "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                  "description": "Exact decimal string; do not parse financial values through binary floating point."
                },
                "equityCompatibleNetUnrealizedPnl": {
                  "type": "string",
                  "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                  "description": "Exact decimal string; do not parse financial values through binary floating point."
                },
                "retainedReplayValuation": {
                  "type": "object",
                  "properties": {
                    "balance": {
                      "type": "string",
                      "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                      "description": "Exact decimal string; do not parse financial values through binary floating point."
                    },
                    "equity": {
                      "type": "string",
                      "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                      "description": "Exact decimal string; do not parse financial values through binary floating point."
                    },
                    "grossUnrealizedPnl": {
                      "type": "string",
                      "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                      "description": "Exact decimal string; do not parse financial values through binary floating point."
                    },
                    "nativeNetUnrealizedPnl": {
                      "type": "string",
                      "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                      "description": "Exact decimal string; do not parse financial values through binary floating point."
                    },
                    "equityCompatibleNetUnrealizedPnl": {
                      "type": "string",
                      "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                      "description": "Exact decimal string; do not parse financial values through binary floating point."
                    }
                  },
                  "required": [
                    "balance",
                    "equity",
                    "grossUnrealizedPnl",
                    "nativeNetUnrealizedPnl",
                    "equityCompatibleNetUnrealizedPnl"
                  ],
                  "additionalProperties": false,
                  "description": "Retained seeded replay state, distinct from the physical start snapshot.\r\nPresent only at boundary_start; permits the recipient's native reset\r\ninitialization without substituting captured equity for quote valuation."
                },
                "lifecycleKind": {
                  "anyOf": [
                    {
                      "type": "null"
                    },
                    {
                      "type": "string",
                      "const": "open"
                    },
                    {
                      "type": "string",
                      "const": "increase"
                    },
                    {
                      "type": "string",
                      "const": "partial_close"
                    },
                    {
                      "type": "string",
                      "const": "full_close"
                    }
                  ]
                },
                "lifecycleReference": {
                  "anyOf": [
                    {
                      "type": "null"
                    },
                    {
                      "type": "string"
                    }
                  ]
                },
                "lifecycleExecutionId": {
                  "anyOf": [
                    {
                      "type": "null"
                    },
                    {
                      "type": "string"
                    }
                  ],
                  "description": "Canonical execution ID joining /executions and /trades; null away from an evidenced lifecycle event."
                },
                "realizedBalanceAdjustment": {
                  "anyOf": [
                    {
                      "type": "null"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "dealId": {
                          "type": "string",
                          "description": "Opaque scope-derived reference, not a native provider identifier or canonical execution UUID."
                        },
                        "positionId": {
                          "type": "string",
                          "description": "Opaque scope-derived reference, not a native provider identifier or canonical execution UUID."
                        },
                        "lifecycleKind": {
                          "type": "string",
                          "enum": [
                            "partial_close",
                            "full_close"
                          ]
                        },
                        "remainingVolume": {
                          "type": "string",
                          "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                          "description": "Exact decimal string; do not parse financial values through binary floating point. Normalized account units, not the provider's hundredths-of-unit volume."
                        },
                        "balanceDelta": {
                          "type": "string",
                          "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                          "description": "Exact decimal string; do not parse financial values through binary floating point."
                        },
                        "grossProfit": {
                          "type": "string",
                          "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                          "description": "Exact decimal string; do not parse financial values through binary floating point."
                        },
                        "commission": {
                          "type": "string",
                          "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                          "description": "Signed commission allocated in the retained close balance adjustment; may include opening commission. Do not assume equality to the closing fill commission."
                        },
                        "swap": {
                          "type": "string",
                          "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                          "description": "Exact decimal string; do not parse financial values through binary floating point."
                        },
                        "conversionFee": {
                          "type": "string",
                          "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                          "description": "Exact decimal string; do not parse financial values through binary floating point."
                        }
                      },
                      "required": [
                        "dealId",
                        "positionId",
                        "lifecycleKind",
                        "remainingVolume",
                        "balanceDelta",
                        "grossProfit",
                        "commission",
                        "swap",
                        "conversionFee"
                      ],
                      "additionalProperties": false
                    }
                  ]
                },
                "floatingSwapAdjustment": {
                  "anyOf": [
                    {
                      "type": "null"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "positionDeltas": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "positionId": {
                                "type": "string",
                                "description": "Opaque scope-derived position reference, not a provider-native identifier."
                              },
                              "delta": {
                                "type": "string",
                                "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                                "description": "Exact decimal string; do not parse financial values through binary floating point."
                              }
                            },
                            "required": [
                              "positionId",
                              "delta"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "totalDelta": {
                          "type": "string",
                          "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                          "description": "Exact decimal string; do not parse financial values through binary floating point."
                        }
                      },
                      "required": [
                        "positionDeltas",
                        "totalDelta"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              },
              "required": [
                "sequence",
                "timestampMs",
                "source",
                "balance",
                "equity",
                "grossUnrealizedPnl",
                "nativeNetUnrealizedPnl",
                "equityCompatibleNetUnrealizedPnl",
                "lifecycleKind",
                "lifecycleReference",
                "lifecycleExecutionId",
                "realizedBalanceAdjustment",
                "floatingSwapAdjustment"
              ],
              "additionalProperties": false
            }
          },
          "summary": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "properties": {
                  "minimumEquity": {
                    "type": "string",
                    "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                    "description": "Exact decimal string; do not parse financial values through binary floating point."
                  },
                  "minimumEquityTimestampMs": {
                    "type": "string",
                    "pattern": "^[0-9]+$",
                    "description": "Unix epoch milliseconds as an exact decimal integer string."
                  },
                  "maximumEquity": {
                    "type": "string",
                    "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                    "description": "Exact decimal string; do not parse financial values through binary floating point."
                  },
                  "maximumEquityTimestampMs": {
                    "type": "string",
                    "pattern": "^[0-9]+$",
                    "description": "Unix epoch milliseconds as an exact decimal integer string."
                  }
                },
                "required": [
                  "minimumEquity",
                  "minimumEquityTimestampMs",
                  "maximumEquity",
                  "maximumEquityTimestampMs"
                ],
                "additionalProperties": false
              }
            ]
          },
          "endpoint": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "properties": {
                  "certainty": {
                    "type": "string",
                    "enum": [
                      "exact",
                      "bounded"
                    ]
                  },
                  "lower": {
                    "type": "string",
                    "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                    "description": "Exact decimal string; do not parse financial values through binary floating point."
                  },
                  "upper": {
                    "type": "string",
                    "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                    "description": "Exact decimal string; do not parse financial values through binary floating point."
                  },
                  "witnessIdentity": {
                    "type": "string"
                  }
                },
                "required": [
                  "certainty",
                  "lower",
                  "upper",
                  "witnessIdentity"
                ],
                "additionalProperties": false
              }
            ]
          },
          "coverage": {
            "type": "object",
            "properties": {
              "executions": {
                "type": "string",
                "enum": [
                  "complete",
                  "unavailable"
                ]
              },
              "boundaries": {
                "type": "string",
                "enum": [
                  "complete",
                  "unavailable"
                ]
              },
              "quotes": {
                "type": "string",
                "enum": [
                  "complete",
                  "unavailable"
                ]
              },
              "productMetadata": {
                "type": "string",
                "enum": [
                  "complete",
                  "unavailable"
                ]
              },
              "currencyConversion": {
                "type": "string",
                "enum": [
                  "complete",
                  "unavailable"
                ]
              },
              "endpoint": {
                "type": "string",
                "enum": [
                  "complete",
                  "unavailable"
                ]
              }
            },
            "required": [
              "executions",
              "boundaries",
              "quotes",
              "productMetadata",
              "currencyConversion",
              "endpoint"
            ],
            "additionalProperties": false
          },
          "sourceExecutionIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "limitations": {
            "type": "array",
            "prefixItems": [
              {
                "type": "string",
                "const": "retained_bounded_interval_only"
              },
              {
                "type": "string",
                "const": "rule_boundary_anchors_unavailable"
              }
            ],
            "minItems": 2,
            "maxItems": 2
          }
        },
        "required": [
          "schemaVersion",
          "organizationId",
          "tradingAccountId",
          "provider",
          "interval",
          "status",
          "available",
          "reason",
          "calculationVersion",
          "sourceRevision",
          "sourceExecutionContentRevision",
          "currency",
          "quantityUnits",
          "boundaries",
          "points",
          "summary",
          "endpoint",
          "coverage",
          "sourceExecutionIds",
          "limitations"
        ],
        "additionalProperties": false
      },
      "FinancialEvidenceIntervals": {
        "type": "object",
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "financial-evidence-intervals-v1"
          },
          "organizationId": {
            "type": "string"
          },
          "tradingAccountId": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "range": {
            "type": "object",
            "properties": {
              "from": {
                "type": "string",
                "format": "date-time"
              },
              "through": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "from",
              "through"
            ],
            "additionalProperties": false
          },
          "coverageProof": {
            "type": "boolean",
            "const": false
          },
          "manifestRevision": {
            "type": "string"
          },
          "unsupportedIntervalCount": {
            "type": "integer",
            "minimum": 0
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "interval": {
                  "type": "object",
                  "properties": {
                    "from": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "through": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "required": [
                    "from",
                    "through"
                  ],
                  "additionalProperties": false
                },
                "retainedStatus": {
                  "type": "string",
                  "enum": [
                    "complete_record",
                    "incomplete_record",
                    "unsupported_record",
                    "unfenced_record",
                    "ambiguous"
                  ],
                  "description": "Retained record metadata only, never validated financial coverage."
                }
              },
              "required": [
                "interval",
                "retainedStatus"
              ],
              "additionalProperties": false
            }
          },
          "page": {
            "type": "object",
            "properties": {
              "limit": {
                "type": "integer",
                "minimum": 0
              },
              "hasMore": {
                "type": "boolean"
              },
              "nextCursor": {
                "anyOf": [
                  {
                    "type": "null"
                  },
                  {
                    "type": "string"
                  }
                ]
              }
            },
            "required": [
              "limit",
              "hasMore",
              "nextCursor"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "schemaVersion",
          "organizationId",
          "tradingAccountId",
          "provider",
          "range",
          "coverageProof",
          "manifestRevision",
          "unsupportedIntervalCount",
          "items",
          "page"
        ],
        "additionalProperties": false
      },
      "FinancialEvidenceChain": {
        "type": "object",
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "financial-evidence-chain-v1"
          },
          "organizationId": {
            "type": "string"
          },
          "tradingAccountId": {
            "type": "string"
          },
          "provider": {
            "type": "string",
            "const": "ctrader"
          },
          "interval": {
            "type": "object",
            "properties": {
              "from": {
                "type": "string",
                "format": "date-time"
              },
              "through": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "from",
              "through"
            ],
            "additionalProperties": false
          },
          "manifestRevision": {
            "type": "string"
          },
          "intervals": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/FinancialEvidence"
                },
                {
                  "$ref": "#/components/schemas/FinancialEvidenceV2"
                }
              ]
            }
          }
        },
        "required": [
          "schemaVersion",
          "organizationId",
          "tradingAccountId",
          "provider",
          "interval",
          "manifestRevision",
          "intervals"
        ],
        "additionalProperties": false
      },
      "RefreshStatus": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "failed",
              "running",
              "cancelled",
              "idle",
              "retry_wait",
              "completed",
              "cooldown"
            ]
          },
          "requestedAt": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "format": "date-time"
              }
            ]
          },
          "requestedThrough": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string"
              }
            ]
          },
          "nextEligibleAt": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "format": "date-time"
              }
            ]
          },
          "retryAt": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "format": "date-time"
              }
            ]
          },
          "financial": {
            "$ref": "#/components/schemas/FinancialRefreshStatus"
          },
          "unavailableReason": {
            "type": "string",
            "enum": [
              "history_origin_unavailable",
              "historical_trading_metadata_unavailable",
              "historical_baseline_unavailable",
              "cash_metadata_unavailable",
              "cash_operation_unsupported"
            ],
            "description": "Qualified unavailable input for this receipt. Not zero, full financial completion, or proof that the broker can never recover it."
          }
        },
        "required": [
          "status",
          "requestedAt",
          "requestedThrough",
          "nextEligibleAt",
          "retryAt"
        ],
        "additionalProperties": false
      },
      "Provider": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "displayName": {
            "type": "string"
          },
          "availability": {
            "type": "string",
            "enum": [
              "degraded",
              "planned",
              "development",
              "available"
            ]
          },
          "authorizationStrategies": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "oauth",
                "credentials",
                "external"
              ]
            }
          },
          "capabilities": {
            "type": "object",
            "properties": {
              "oauth": {
                "type": "string",
                "enum": [
                  "unsupported",
                  "planned",
                  "development",
                  "available"
                ]
              },
              "orders": {
                "type": "string",
                "enum": [
                  "unsupported",
                  "planned",
                  "development",
                  "available"
                ]
              },
              "executions": {
                "type": "string",
                "enum": [
                  "unsupported",
                  "planned",
                  "development",
                  "available"
                ]
              },
              "accountDiscovery": {
                "type": "string",
                "enum": [
                  "unsupported",
                  "planned",
                  "development",
                  "available"
                ]
              },
              "accountState": {
                "type": "string",
                "enum": [
                  "unsupported",
                  "planned",
                  "development",
                  "available"
                ]
              },
              "positions": {
                "type": "string",
                "enum": [
                  "unsupported",
                  "planned",
                  "development",
                  "available"
                ]
              },
              "historicalExecutions": {
                "type": "string",
                "enum": [
                  "unsupported",
                  "planned",
                  "development",
                  "available"
                ]
              },
              "realTimeExecutions": {
                "type": "string",
                "enum": [
                  "unsupported",
                  "planned",
                  "development",
                  "available"
                ]
              },
              "historicalReconstruction": {
                "type": "string",
                "enum": [
                  "unsupported",
                  "planned",
                  "development",
                  "available"
                ]
              },
              "credentialLogin": {
                "type": "string",
                "enum": [
                  "unsupported",
                  "planned",
                  "development",
                  "available"
                ]
              },
              "readOnlyAuthorization": {
                "type": "string",
                "enum": [
                  "unsupported",
                  "planned",
                  "development",
                  "available"
                ]
              }
            },
            "required": [
              "oauth",
              "orders",
              "executions",
              "accountDiscovery",
              "accountState",
              "positions",
              "historicalExecutions",
              "realTimeExecutions",
              "historicalReconstruction",
              "credentialLogin",
              "readOnlyAuthorization"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "displayName",
          "availability",
          "authorizationStrategies",
          "capabilities"
        ],
        "additionalProperties": false
      },
      "PermissionRequestStatus": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "cancelled",
              "expired",
              "approved"
            ]
          },
          "connectionId": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string"
              }
            ]
          },
          "tradingAccountId": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string"
              }
            ]
          }
        },
        "required": [
          "requestId",
          "status",
          "connectionId",
          "tradingAccountId"
        ],
        "additionalProperties": false
      },
      "TradesCollection": {
        "type": "object",
        "properties": {
          "capability": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "available": {
                    "type": "boolean",
                    "const": false
                  },
                  "calculationVersion": {
                    "type": "string",
                    "const": "ctrader-hedged-lifecycle-v1"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "incomplete",
                      "unsupported"
                    ]
                  },
                  "reason": {
                    "type": "string",
                    "enum": [
                      "provider_not_supported",
                      "account_type_unverified",
                      "contiguous_execution_coverage_unavailable",
                      "execution_input_limit_exceeded",
                      "unsupported_account_type"
                    ]
                  },
                  "coverageFrom": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "string",
                        "format": "date-time"
                      }
                    ]
                  },
                  "coverageThrough": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "string",
                        "format": "date-time"
                      }
                    ]
                  }
                },
                "required": [
                  "available",
                  "calculationVersion",
                  "status",
                  "reason",
                  "coverageFrom",
                  "coverageThrough"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "available": {
                    "type": "boolean",
                    "const": true
                  },
                  "calculationVersion": {
                    "type": "string",
                    "const": "ctrader-hedged-lifecycle-v1"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "complete",
                      "partial"
                    ]
                  },
                  "coverageFrom": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "coverageThrough": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "inputExecutionCount": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "tradeCount": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "completeTradeCount": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "incompleteTradeCount": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "unsupportedTradeCount": {
                    "type": "integer",
                    "minimum": 0
                  }
                },
                "required": [
                  "available",
                  "calculationVersion",
                  "status",
                  "coverageFrom",
                  "coverageThrough",
                  "inputExecutionCount",
                  "tradeCount",
                  "completeTradeCount",
                  "incompleteTradeCount",
                  "unsupportedTradeCount"
                ],
                "additionalProperties": false
              }
            ]
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReconstructedTrade"
            }
          },
          "page": {
            "type": "object",
            "properties": {
              "limit": {
                "type": "integer",
                "minimum": 0
              },
              "hasMore": {
                "type": "boolean"
              },
              "nextCursor": {
                "anyOf": [
                  {
                    "type": "null"
                  },
                  {
                    "type": "string"
                  }
                ]
              }
            },
            "required": [
              "limit",
              "hasMore",
              "nextCursor"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "capability",
          "items",
          "page"
        ],
        "additionalProperties": false
      },
      "AccountsCollection": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Account"
            }
          },
          "page": {
            "type": "object",
            "properties": {
              "limit": {
                "type": "integer",
                "minimum": 0
              },
              "hasMore": {
                "type": "boolean"
              },
              "nextCursor": {
                "anyOf": [
                  {
                    "type": "null"
                  },
                  {
                    "type": "string"
                  }
                ]
              }
            },
            "required": [
              "limit",
              "hasMore",
              "nextCursor"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "items",
          "page"
        ],
        "additionalProperties": false
      },
      "ConnectionsCollection": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Connection"
            }
          },
          "page": {
            "type": "object",
            "properties": {
              "limit": {
                "type": "integer",
                "minimum": 0
              },
              "hasMore": {
                "type": "boolean"
              },
              "nextCursor": {
                "anyOf": [
                  {
                    "type": "null"
                  },
                  {
                    "type": "string"
                  }
                ]
              }
            },
            "required": [
              "limit",
              "hasMore",
              "nextCursor"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "items",
          "page"
        ],
        "additionalProperties": false
      },
      "PositionsCollection": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Position"
            }
          },
          "page": {
            "type": "object",
            "properties": {
              "limit": {
                "type": "integer",
                "minimum": 0
              },
              "hasMore": {
                "type": "boolean"
              },
              "nextCursor": {
                "anyOf": [
                  {
                    "type": "null"
                  },
                  {
                    "type": "string"
                  }
                ]
              }
            },
            "required": [
              "limit",
              "hasMore",
              "nextCursor"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "items",
          "page"
        ],
        "additionalProperties": false
      },
      "ExecutionsCollection": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Execution"
            }
          },
          "page": {
            "type": "object",
            "properties": {
              "limit": {
                "type": "integer",
                "minimum": 0
              },
              "hasMore": {
                "type": "boolean"
              },
              "nextCursor": {
                "anyOf": [
                  {
                    "type": "null"
                  },
                  {
                    "type": "string"
                  }
                ]
              }
            },
            "required": [
              "limit",
              "hasMore",
              "nextCursor"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "items",
          "page"
        ],
        "additionalProperties": false
      },
      "InstrumentsCollection": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "capability": {
                "type": "object",
                "properties": {
                  "available": {
                    "type": "boolean"
                  },
                  "reason": {
                    "type": "string",
                    "const": "provider_not_supported"
                  },
                  "schemaVersion": {
                    "type": "string",
                    "const": "account-instrument-v1"
                  },
                  "basis": {
                    "type": "string",
                    "const": "retained_metadata_versions"
                  },
                  "catalogCompleteness": {
                    "type": "string",
                    "const": "not_asserted"
                  }
                },
                "required": [
                  "available",
                  "reason",
                  "schemaVersion",
                  "basis",
                  "catalogCompleteness"
                ],
                "additionalProperties": false
              },
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Instrument"
                }
              },
              "page": {
                "type": "object",
                "properties": {
                  "limit": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "hasMore": {
                    "type": "boolean"
                  },
                  "nextCursor": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "string"
                      }
                    ]
                  }
                },
                "required": [
                  "limit",
                  "hasMore",
                  "nextCursor"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "capability",
              "items",
              "page"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Instrument"
                }
              },
              "capability": {
                "type": "object",
                "properties": {
                  "available": {
                    "type": "boolean"
                  },
                  "reason": {
                    "type": "null"
                  },
                  "schemaVersion": {
                    "type": "string",
                    "const": "account-instrument-v1"
                  },
                  "basis": {
                    "type": "string",
                    "const": "retained_metadata_versions"
                  },
                  "catalogCompleteness": {
                    "type": "string",
                    "const": "not_asserted"
                  }
                },
                "required": [
                  "available",
                  "reason",
                  "schemaVersion",
                  "basis",
                  "catalogCompleteness"
                ],
                "additionalProperties": false
              },
              "page": {
                "type": "object",
                "properties": {
                  "limit": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "hasMore": {
                    "type": "boolean"
                  },
                  "nextCursor": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "string"
                      }
                    ]
                  }
                },
                "required": [
                  "limit",
                  "hasMore",
                  "nextCursor"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "items",
              "capability",
              "page"
            ],
            "additionalProperties": false
          }
        ]
      },
      "ExecutionInstrumentsCollection": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "capability": {
                "type": "object",
                "properties": {
                  "available": {
                    "type": "boolean"
                  },
                  "reason": {
                    "type": "string",
                    "const": "provider_not_supported"
                  },
                  "schemaVersion": {
                    "type": "string",
                    "const": "execution-instrument-v1"
                  },
                  "basis": {
                    "type": "string",
                    "const": "retained_execution_symbol_binding"
                  }
                },
                "required": [
                  "available",
                  "reason",
                  "schemaVersion",
                  "basis"
                ],
                "additionalProperties": false
              },
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ExecutionInstrument"
                }
              },
              "page": {
                "type": "object",
                "properties": {
                  "limit": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "hasMore": {
                    "type": "boolean"
                  },
                  "nextCursor": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "string"
                      }
                    ]
                  }
                },
                "required": [
                  "limit",
                  "hasMore",
                  "nextCursor"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "capability",
              "items",
              "page"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ExecutionInstrument"
                }
              },
              "capability": {
                "type": "object",
                "properties": {
                  "available": {
                    "type": "boolean"
                  },
                  "reason": {
                    "type": "null"
                  },
                  "schemaVersion": {
                    "type": "string",
                    "const": "execution-instrument-v1"
                  },
                  "basis": {
                    "type": "string",
                    "const": "retained_execution_symbol_binding"
                  }
                },
                "required": [
                  "available",
                  "reason",
                  "schemaVersion",
                  "basis"
                ],
                "additionalProperties": false
              },
              "page": {
                "type": "object",
                "properties": {
                  "limit": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "hasMore": {
                    "type": "boolean"
                  },
                  "nextCursor": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "string"
                      }
                    ]
                  }
                },
                "required": [
                  "limit",
                  "hasMore",
                  "nextCursor"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "items",
              "capability",
              "page"
            ],
            "additionalProperties": false
          }
        ]
      },
      "ExecutionDetailsCollection": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "capability": {
                "type": "object",
                "properties": {
                  "available": {
                    "type": "boolean"
                  },
                  "reason": {
                    "type": "string",
                    "const": "provider_not_supported"
                  },
                  "schemaVersion": {
                    "type": "string",
                    "const": "execution-details-v1"
                  },
                  "basis": {
                    "type": "string",
                    "const": "first_retained_execution_evidence"
                  }
                },
                "required": [
                  "available",
                  "reason",
                  "schemaVersion",
                  "basis"
                ],
                "additionalProperties": false
              },
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ExecutionDetails"
                }
              },
              "page": {
                "type": "object",
                "properties": {
                  "limit": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "hasMore": {
                    "type": "boolean"
                  },
                  "nextCursor": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "string"
                      }
                    ]
                  }
                },
                "required": [
                  "limit",
                  "hasMore",
                  "nextCursor"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "capability",
              "items",
              "page"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ExecutionDetails"
                }
              },
              "capability": {
                "type": "object",
                "properties": {
                  "available": {
                    "type": "boolean"
                  },
                  "reason": {
                    "type": "null"
                  },
                  "schemaVersion": {
                    "type": "string",
                    "const": "execution-details-v1"
                  },
                  "basis": {
                    "type": "string",
                    "const": "first_retained_execution_evidence"
                  }
                },
                "required": [
                  "available",
                  "reason",
                  "schemaVersion",
                  "basis"
                ],
                "additionalProperties": false
              },
              "page": {
                "type": "object",
                "properties": {
                  "limit": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "hasMore": {
                    "type": "boolean"
                  },
                  "nextCursor": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "string"
                      }
                    ]
                  }
                },
                "required": [
                  "limit",
                  "hasMore",
                  "nextCursor"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "items",
              "capability",
              "page"
            ],
            "additionalProperties": false
          }
        ]
      },
      "ObservationsCollection": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "capability": {
                "type": "object",
                "properties": {
                  "available": {
                    "type": "boolean"
                  },
                  "reason": {
                    "type": "string",
                    "const": "provider_not_supported"
                  },
                  "schemaVersion": {
                    "type": "string",
                    "const": "account-observation-v1"
                  },
                  "basis": {
                    "type": "string",
                    "const": "retained_coherent_captures"
                  },
                  "historyCompleteness": {
                    "type": "string",
                    "const": "not_asserted"
                  }
                },
                "required": [
                  "available",
                  "reason",
                  "schemaVersion",
                  "basis",
                  "historyCompleteness"
                ],
                "additionalProperties": false
              },
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ObservationSummary"
                }
              },
              "page": {
                "type": "object",
                "properties": {
                  "limit": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "hasMore": {
                    "type": "boolean"
                  },
                  "nextCursor": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "string"
                      }
                    ]
                  }
                },
                "required": [
                  "limit",
                  "hasMore",
                  "nextCursor"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "capability",
              "items",
              "page"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ObservationSummary"
                }
              },
              "capability": {
                "type": "object",
                "properties": {
                  "available": {
                    "type": "boolean"
                  },
                  "reason": {
                    "type": "null"
                  },
                  "schemaVersion": {
                    "type": "string",
                    "const": "account-observation-v1"
                  },
                  "basis": {
                    "type": "string",
                    "const": "retained_coherent_captures"
                  },
                  "historyCompleteness": {
                    "type": "string",
                    "const": "not_asserted"
                  }
                },
                "required": [
                  "available",
                  "reason",
                  "schemaVersion",
                  "basis",
                  "historyCompleteness"
                ],
                "additionalProperties": false
              },
              "page": {
                "type": "object",
                "properties": {
                  "limit": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "hasMore": {
                    "type": "boolean"
                  },
                  "nextCursor": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "string"
                      }
                    ]
                  }
                },
                "required": [
                  "limit",
                  "hasMore",
                  "nextCursor"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "items",
              "capability",
              "page"
            ],
            "additionalProperties": false
          }
        ]
      },
      "HistoryRequestsCollection": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "capability": {
                "type": "object",
                "properties": {
                  "available": {
                    "type": "boolean"
                  },
                  "reason": {
                    "type": "string",
                    "const": "provider_not_supported"
                  },
                  "schemaVersion": {
                    "type": "string",
                    "const": "account-history-request-v1"
                  },
                  "basis": {
                    "type": "string",
                    "const": "retained_complete_responses"
                  },
                  "contiguousCoverage": {
                    "type": "string",
                    "const": "not_asserted"
                  }
                },
                "required": [
                  "available",
                  "reason",
                  "schemaVersion",
                  "basis",
                  "contiguousCoverage"
                ],
                "additionalProperties": false
              },
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/HistoryRequest"
                }
              },
              "page": {
                "type": "object",
                "properties": {
                  "limit": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "hasMore": {
                    "type": "boolean"
                  },
                  "nextCursor": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "string"
                      }
                    ]
                  }
                },
                "required": [
                  "limit",
                  "hasMore",
                  "nextCursor"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "capability",
              "items",
              "page"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/HistoryRequest"
                }
              },
              "capability": {
                "type": "object",
                "properties": {
                  "available": {
                    "type": "boolean"
                  },
                  "reason": {
                    "type": "null"
                  },
                  "schemaVersion": {
                    "type": "string",
                    "const": "account-history-request-v1"
                  },
                  "basis": {
                    "type": "string",
                    "const": "retained_complete_responses"
                  },
                  "contiguousCoverage": {
                    "type": "string",
                    "const": "not_asserted"
                  }
                },
                "required": [
                  "available",
                  "reason",
                  "schemaVersion",
                  "basis",
                  "contiguousCoverage"
                ],
                "additionalProperties": false
              },
              "page": {
                "type": "object",
                "properties": {
                  "limit": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "hasMore": {
                    "type": "boolean"
                  },
                  "nextCursor": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "string"
                      }
                    ]
                  }
                },
                "required": [
                  "limit",
                  "hasMore",
                  "nextCursor"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "items",
              "capability",
              "page"
            ],
            "additionalProperties": false
          }
        ]
      },
      "OrdersCollection": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "capability": {
                "type": "object",
                "properties": {
                  "available": {
                    "type": "boolean"
                  },
                  "reason": {
                    "type": "string",
                    "const": "provider_not_supported"
                  },
                  "schemaVersion": {
                    "type": "string",
                    "const": "order-observation-v1"
                  },
                  "basis": {
                    "type": "string",
                    "const": "retained_complete_responses"
                  },
                  "contiguousCoverage": {
                    "type": "string",
                    "const": "not_asserted"
                  }
                },
                "required": [
                  "available",
                  "reason",
                  "schemaVersion",
                  "basis",
                  "contiguousCoverage"
                ],
                "additionalProperties": false
              },
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/OrderObservation"
                }
              },
              "page": {
                "type": "object",
                "properties": {
                  "limit": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "hasMore": {
                    "type": "boolean"
                  },
                  "nextCursor": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "string"
                      }
                    ]
                  }
                },
                "required": [
                  "limit",
                  "hasMore",
                  "nextCursor"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "capability",
              "items",
              "page"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/OrderObservation"
                }
              },
              "capability": {
                "type": "object",
                "properties": {
                  "available": {
                    "type": "boolean"
                  },
                  "reason": {
                    "type": "null"
                  },
                  "schemaVersion": {
                    "type": "string",
                    "const": "order-observation-v1"
                  },
                  "basis": {
                    "type": "string",
                    "const": "retained_complete_responses"
                  },
                  "contiguousCoverage": {
                    "type": "string",
                    "const": "not_asserted"
                  }
                },
                "required": [
                  "available",
                  "reason",
                  "schemaVersion",
                  "basis",
                  "contiguousCoverage"
                ],
                "additionalProperties": false
              },
              "page": {
                "type": "object",
                "properties": {
                  "limit": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "hasMore": {
                    "type": "boolean"
                  },
                  "nextCursor": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "string"
                      }
                    ]
                  }
                },
                "required": [
                  "limit",
                  "hasMore",
                  "nextCursor"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "items",
              "capability",
              "page"
            ],
            "additionalProperties": false
          }
        ]
      },
      "RefreshResponse": {
        "type": "object",
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "account-refresh-v1"
          },
          "tradingAccountId": {
            "type": "string"
          },
          "refresh": {
            "$ref": "#/components/schemas/RefreshStatus"
          },
          "stored": {
            "type": "object",
            "properties": {
              "available": {
                "type": "boolean"
              },
              "state": {
                "anyOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/AccountState"
                  }
                ]
              },
              "sync": {
                "$ref": "#/components/schemas/SyncStatus"
              },
              "freshness": {
                "$ref": "#/components/schemas/Freshness"
              }
            },
            "required": [
              "available",
              "state",
              "sync",
              "freshness"
            ],
            "additionalProperties": false
          },
          "statusUrl": {
            "type": "string",
            "description": "Relative GET path on the same API origin. Does not contain a shared upstream job ID."
          }
        },
        "required": [
          "schemaVersion",
          "tradingAccountId",
          "refresh",
          "stored",
          "statusUrl"
        ],
        "additionalProperties": false
      },
      "AuthorizationStart": {
        "type": "object",
        "properties": {
          "authorizationUrl": {
            "type": "string",
            "format": "uri"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "authorizationUrl",
          "expiresAt"
        ],
        "additionalProperties": false
      },
      "AccountSelection": {
        "type": "object",
        "properties": {
          "accountId": {
            "type": "string"
          },
          "connectionId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "const": "selected"
          },
          "synchronizationEnabled": {
            "type": "boolean"
          }
        },
        "required": [
          "accountId",
          "connectionId",
          "status",
          "synchronizationEnabled"
        ],
        "additionalProperties": false
      },
      "AccountDeselection": {
        "type": "object",
        "properties": {
          "accountId": {
            "type": "string"
          },
          "connectionId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "const": "deselected"
          },
          "cleanupState": {
            "type": "string",
            "const": "requested"
          },
          "workerCleanupConfirmed": {
            "type": "boolean",
            "const": false
          }
        },
        "required": [
          "accountId",
          "connectionId",
          "status",
          "cleanupState",
          "workerCleanupConfirmed"
        ],
        "additionalProperties": false
      },
      "DisconnectResult": {
        "type": "object",
        "properties": {
          "connectionId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "const": "disconnect_requested"
          },
          "cleanupState": {
            "type": "string",
            "const": "requested"
          },
          "workerCleanupConfirmed": {
            "type": "boolean",
            "const": false
          }
        },
        "required": [
          "connectionId",
          "status",
          "cleanupState",
          "workerCleanupConfirmed"
        ],
        "additionalProperties": false
      },
      "CashMovementsCollection": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "capability": {
                "type": "object",
                "properties": {
                  "available": {
                    "type": "boolean"
                  },
                  "reason": {
                    "type": "string",
                    "const": "provider_not_supported"
                  },
                  "schemaVersion": {
                    "type": "string",
                    "const": "cash-movement-v1"
                  },
                  "basis": {
                    "type": "string",
                    "const": "retained_complete_responses"
                  },
                  "contiguousCoverage": {
                    "type": "string",
                    "const": "not_asserted"
                  }
                },
                "required": [
                  "available",
                  "reason",
                  "schemaVersion",
                  "basis",
                  "contiguousCoverage"
                ],
                "additionalProperties": false
              },
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/CashMovement"
                }
              },
              "page": {
                "type": "object",
                "properties": {
                  "limit": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "hasMore": {
                    "type": "boolean"
                  },
                  "nextCursor": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "string"
                      }
                    ]
                  }
                },
                "required": [
                  "limit",
                  "hasMore",
                  "nextCursor"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "capability",
              "items",
              "page"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/CashMovement"
                }
              },
              "capability": {
                "type": "object",
                "properties": {
                  "available": {
                    "type": "boolean"
                  },
                  "reason": {
                    "type": "null"
                  },
                  "schemaVersion": {
                    "type": "string",
                    "const": "cash-movement-v1"
                  },
                  "basis": {
                    "type": "string",
                    "const": "retained_complete_responses"
                  },
                  "contiguousCoverage": {
                    "type": "string",
                    "const": "not_asserted"
                  }
                },
                "required": [
                  "available",
                  "reason",
                  "schemaVersion",
                  "basis",
                  "contiguousCoverage"
                ],
                "additionalProperties": false
              },
              "page": {
                "type": "object",
                "properties": {
                  "limit": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "hasMore": {
                    "type": "boolean"
                  },
                  "nextCursor": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "string"
                      }
                    ]
                  }
                },
                "required": [
                  "limit",
                  "hasMore",
                  "nextCursor"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "items",
              "capability",
              "page"
            ],
            "additionalProperties": false
          }
        ]
      },
      "Decimal": {
        "type": "string",
        "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
        "description": "Exact canonical decimal. Null is unavailable when the containing field allows null."
      },
      "Meta": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "apiVersion": {
            "type": "string",
            "const": "v1"
          },
          "source": {
            "type": "string",
            "enum": [
              "postgres",
              "development_fixture"
            ],
            "description": "Production integration must use real stored postgres data; fixture data is not provider proof."
          }
        },
        "required": [
          "apiVersion",
          "source"
        ]
      },
      "Error": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "error": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ]
          }
        },
        "required": [
          "error"
        ]
      },
      "CreateEndUser": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "externalId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255,
            "description": "Your stable user reference; whitespace-only values are rejected. Exact string is retained.",
            "pattern": "\\S"
          },
          "displayName": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "maxLength": 255,
            "pattern": "\\S"
          }
        },
        "required": [
          "externalId"
        ]
      },
      "CreateConnection": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "endUserId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255,
            "pattern": "\\S"
          },
          "provider": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Must be recognized and accepting connections. cTrader currently uses oauth.",
            "pattern": "\\S"
          },
          "authorizationStrategy": {
            "type": "string",
            "enum": [
              "oauth",
              "credentials",
              "external"
            ]
          },
          "externalReference": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "maxLength": 255,
            "pattern": "\\S"
          }
        },
        "required": [
          "endUserId",
          "provider",
          "authorizationStrategy"
        ]
      },
      "PermissionRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "endUserId": {
            "type": "string",
            "format": "uuid"
          },
          "returnUrl": {
            "type": "string",
            "format": "uri",
            "maxLength": 2048,
            "description": "Optional paired with returnState. Canonical HTTPS URL with lowercase hostname, no credentials, query or fragment; destination retained by server, not browser-authoritative identity."
          },
          "returnState": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{43}$",
            "description": "Canonical base64url encoding of 32 random bytes, paired with returnUrl; bind to the authenticated customer session."
          },
          "reconsent": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "connectionId": {
                "type": "string",
                "format": "uuid"
              },
              "tradingAccountId": {
                "type": "string",
                "format": "uuid"
              },
              "previousAuthorizationRevision": {
                "type": "string",
                "pattern": "^unifywire-customer-authorization-v1:[0-9a-f]{64}$"
              }
            },
            "required": [
              "connectionId",
              "tradingAccountId",
              "previousAuthorizationRevision"
            ]
          }
        },
        "required": [
          "endUserId"
        ],
        "dependentRequired": {
          "returnUrl": [
            "returnState"
          ],
          "returnState": [
            "returnUrl"
          ]
        }
      },
      "PermissionRequestCreated": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "consentPath": {
            "type": "string",
            "description": "Relative path including sensitive fragment proof; navigate trader to https://www.unifywire.com plus this value. Never log or expose it to another user."
          }
        },
        "required": [
          "requestId",
          "expiresAt",
          "consentPath"
        ]
      },
      "PermissionLineage": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "unifywire-customer-enrollment-lineage-v1"
          },
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "endUserId": {
            "type": "string",
            "format": "uuid"
          },
          "tradingAccountId": {
            "type": "string",
            "format": "uuid"
          },
          "connectionId": {
            "type": "string",
            "format": "uuid"
          },
          "previousAuthorizationRevision": {
            "type": "string",
            "pattern": "^unifywire-customer-authorization-v1:[0-9a-f]{64}$"
          },
          "authorizationRevision": {
            "type": "string",
            "pattern": "^unifywire-customer-authorization-v1:[0-9a-f]{64}$"
          },
          "requestId": {
            "type": "string",
            "format": "uuid"
          },
          "enrollmentRevision": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          }
        },
        "required": [
          "schemaVersion",
          "organizationId",
          "endUserId",
          "tradingAccountId",
          "connectionId",
          "previousAuthorizationRevision",
          "authorizationRevision",
          "requestId",
          "enrollmentRevision"
        ]
      },
      "SelectedAccounts": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "connectionId": {
            "type": "string"
          },
          "selectedAccountIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "connectionId",
          "selectedAccountIds"
        ]
      },
      "Providers": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/Provider"
        }
      },
      "ClosingExecutionFacts": {
        "type": "object",
        "description": "Provider-reported balance after this individual partial/final closing fill and its retained close commission allocation. Not current balance, EOD equity, lifecycle P&L or a complete adjustment ledger. Never add allocatedCommission to executed-fill costs again.",
        "properties": {
          "balance": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Decimal"
              }
            ],
            "description": "Exact signed decimal balance reported after this close, normalized using proven moneyDigits; null when unavailable/not applicable."
          },
          "allocatedCommission": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Decimal"
              }
            ],
            "description": "Signed close-detail commission allocation, which can include opening commission. Distinct from costs.commission.value (executed-fill commission); never double charge it."
          },
          "moneyDigits": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 18
              }
            ],
            "description": "Scale used to normalize retained close money, with independent provenance; no assumed scale."
          },
          "balanceVersion": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string"
              }
            ],
            "description": "Exact optional provider balance-version identity. Missing version is unavailable and does not invalidate otherwise verified close amounts; it is not a snapshot/coverage token."
          },
          "provenance": {
            "type": "object",
            "properties": {
              "balance": {
                "type": "string",
                "enum": [
                  "provider_reported",
                  "unavailable",
                  "not_applicable"
                ]
              },
              "allocatedCommission": {
                "type": "string",
                "enum": [
                  "provider_reported",
                  "unavailable",
                  "not_applicable"
                ]
              },
              "moneyDigits": {
                "type": "string",
                "enum": [
                  "provider_reported",
                  "retained_account_fallback",
                  "unavailable",
                  "not_applicable"
                ]
              },
              "balanceVersion": {
                "type": "string",
                "enum": [
                  "provider_reported",
                  "unavailable",
                  "not_applicable"
                ]
              }
            },
            "required": [
              "balance",
              "allocatedCommission",
              "moneyDigits",
              "balanceVersion"
            ],
            "additionalProperties": false
          },
          "availability": {
            "type": "object",
            "properties": {
              "available": {
                "type": "boolean"
              },
              "reason": {
                "anyOf": [
                  {
                    "type": "null"
                  },
                  {
                    "type": "string",
                    "enum": [
                      "not_a_closing_fill",
                      "execution_evidence_missing",
                      "execution_evidence_unverified",
                      "monetary_scale_unavailable"
                    ]
                  }
                ]
              }
            },
            "required": [
              "available",
              "reason"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "balance",
          "allocatedCommission",
          "moneyDigits",
          "balanceVersion",
          "provenance",
          "availability"
        ],
        "additionalProperties": false
      },
      "ExecutionDetailsV2": {
        "type": "object",
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "execution-details-v2"
          },
          "executionId": {
            "type": "string"
          },
          "tradingAccountId": {
            "type": "string"
          },
          "quantityUnit": {
            "type": "string",
            "const": "account_units"
          },
          "executedAt": {
            "type": "string",
            "format": "date-time"
          },
          "providerObservedAt": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "format": "date-time"
              }
            ]
          },
          "fillRole": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "const": "opening_or_increase"
              },
              {
                "type": "string",
                "const": "closing"
              }
            ]
          },
          "costs": {
            "type": "object",
            "properties": {
              "grossPnl": {
                "type": "object",
                "properties": {
                  "value": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "$ref": "#/components/schemas/Decimal"
                      }
                    ]
                  },
                  "basis": {
                    "type": "string",
                    "const": "realized_close"
                  },
                  "source": {
                    "type": "string",
                    "enum": [
                      "unavailable",
                      "reported",
                      "defaulted_zero",
                      "not_applicable"
                    ]
                  }
                },
                "required": [
                  "value",
                  "basis",
                  "source"
                ],
                "additionalProperties": false
              },
              "commission": {
                "type": "object",
                "properties": {
                  "value": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "$ref": "#/components/schemas/Decimal"
                      }
                    ]
                  },
                  "basis": {
                    "type": "string",
                    "const": "executed_fill"
                  },
                  "source": {
                    "type": "string",
                    "enum": [
                      "unavailable",
                      "reported",
                      "defaulted_zero",
                      "not_applicable"
                    ]
                  }
                },
                "required": [
                  "value",
                  "basis",
                  "source"
                ],
                "additionalProperties": false
              },
              "swap": {
                "type": "object",
                "properties": {
                  "value": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "$ref": "#/components/schemas/Decimal"
                      }
                    ]
                  },
                  "basis": {
                    "type": "string",
                    "const": "realized_close"
                  },
                  "source": {
                    "type": "string",
                    "enum": [
                      "unavailable",
                      "reported",
                      "defaulted_zero",
                      "not_applicable"
                    ]
                  }
                },
                "required": [
                  "value",
                  "basis",
                  "source"
                ],
                "additionalProperties": false
              },
              "fees": {
                "type": "object",
                "properties": {
                  "value": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "$ref": "#/components/schemas/Decimal"
                      }
                    ]
                  },
                  "basis": {
                    "type": "string",
                    "const": "pnl_conversion_fee"
                  },
                  "source": {
                    "type": "string",
                    "enum": [
                      "unavailable",
                      "reported",
                      "defaulted_zero",
                      "not_applicable"
                    ]
                  }
                },
                "required": [
                  "value",
                  "basis",
                  "source"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "grossPnl",
              "commission",
              "swap",
              "fees"
            ],
            "additionalProperties": false
          },
          "amountCurrency": {
            "type": "object",
            "properties": {
              "value": {
                "anyOf": [
                  {
                    "type": "null"
                  },
                  {
                    "type": "string"
                  }
                ]
              },
              "observedAt": {
                "anyOf": [
                  {
                    "type": "null"
                  },
                  {
                    "type": "string",
                    "format": "date-time"
                  }
                ]
              },
              "basis": {
                "type": "string",
                "const": "observed_account_deposit_currency"
              },
              "applicability": {
                "type": "string",
                "const": "observed_only"
              },
              "availability": {
                "type": "object",
                "properties": {
                  "available": {
                    "type": "boolean"
                  },
                  "reason": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "string",
                        "const": "currency_missing"
                      },
                      {
                        "type": "string",
                        "const": "currency_ambiguous"
                      },
                      {
                        "type": "string",
                        "const": "currency_unverified"
                      }
                    ]
                  }
                },
                "required": [
                  "available",
                  "reason"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "value",
              "observedAt",
              "basis",
              "applicability",
              "availability"
            ],
            "additionalProperties": false
          },
          "timestampOrigins": {
            "type": "object",
            "properties": {
              "executedAt": {
                "anyOf": [
                  {
                    "type": "null"
                  },
                  {
                    "type": "string",
                    "const": "provider_execution"
                  }
                ]
              },
              "providerObservedAt": {
                "anyOf": [
                  {
                    "type": "null"
                  },
                  {
                    "type": "string",
                    "const": "application_acquisition"
                  }
                ]
              },
              "acquisitionBasis": {
                "anyOf": [
                  {
                    "type": "null"
                  },
                  {
                    "type": "string",
                    "const": "history_response_acquisition"
                  },
                  {
                    "type": "string",
                    "const": "coherent_capture_response"
                  }
                ]
              },
              "availability": {
                "type": "object",
                "properties": {
                  "available": {
                    "type": "boolean"
                  },
                  "reason": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "string",
                        "const": "execution_evidence_missing"
                      },
                      {
                        "type": "string",
                        "const": "execution_evidence_unverified"
                      },
                      {
                        "type": "string",
                        "const": "monetary_scale_unavailable"
                      },
                      {
                        "type": "string",
                        "const": "first_acquisition_missing"
                      },
                      {
                        "type": "string",
                        "const": "acquisition_basis_missing"
                      }
                    ]
                  }
                },
                "required": [
                  "available",
                  "reason"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "executedAt",
              "providerObservedAt",
              "acquisitionBasis",
              "availability"
            ],
            "additionalProperties": false
          },
          "availability": {
            "type": "object",
            "properties": {
              "available": {
                "type": "boolean"
              },
              "reason": {
                "anyOf": [
                  {
                    "type": "null"
                  },
                  {
                    "type": "string",
                    "const": "execution_evidence_missing"
                  },
                  {
                    "type": "string",
                    "const": "execution_evidence_unverified"
                  },
                  {
                    "type": "string",
                    "const": "monetary_scale_unavailable"
                  }
                ]
              }
            },
            "required": [
              "available",
              "reason"
            ],
            "additionalProperties": false
          },
          "closing": {
            "$ref": "#/components/schemas/ClosingExecutionFacts"
          }
        },
        "required": [
          "schemaVersion",
          "executionId",
          "tradingAccountId",
          "quantityUnit",
          "executedAt",
          "providerObservedAt",
          "fillRole",
          "costs",
          "amountCurrency",
          "timestampOrigins",
          "availability",
          "closing"
        ],
        "additionalProperties": false,
        "description": "All v1 fields and semantics retained; explicit include=closing adds verified closing facts. No opt-in means unchanged v1."
      },
      "ExecutionDetailsCollectionV2": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "capability": {
                "type": "object",
                "properties": {
                  "available": {
                    "type": "boolean"
                  },
                  "reason": {
                    "type": "string",
                    "const": "provider_not_supported"
                  },
                  "schemaVersion": {
                    "type": "string",
                    "const": "execution-details-v2"
                  },
                  "basis": {
                    "type": "string",
                    "const": "first_retained_execution_evidence"
                  }
                },
                "required": [
                  "available",
                  "reason",
                  "schemaVersion",
                  "basis"
                ],
                "additionalProperties": false
              },
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ExecutionDetailsV2"
                }
              },
              "page": {
                "type": "object",
                "properties": {
                  "limit": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "hasMore": {
                    "type": "boolean"
                  },
                  "nextCursor": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "string"
                      }
                    ]
                  }
                },
                "required": [
                  "limit",
                  "hasMore",
                  "nextCursor"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "capability",
              "items",
              "page"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ExecutionDetailsV2"
                }
              },
              "capability": {
                "type": "object",
                "properties": {
                  "available": {
                    "type": "boolean"
                  },
                  "reason": {
                    "type": "null"
                  },
                  "schemaVersion": {
                    "type": "string",
                    "const": "execution-details-v2"
                  },
                  "basis": {
                    "type": "string",
                    "const": "first_retained_execution_evidence"
                  }
                },
                "required": [
                  "available",
                  "reason",
                  "schemaVersion",
                  "basis"
                ],
                "additionalProperties": false
              },
              "page": {
                "type": "object",
                "properties": {
                  "limit": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "hasMore": {
                    "type": "boolean"
                  },
                  "nextCursor": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "string"
                      }
                    ]
                  }
                },
                "required": [
                  "limit",
                  "hasMore",
                  "nextCursor"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "items",
              "capability",
              "page"
            ],
            "additionalProperties": false
          }
        ],
        "description": "Same order, five-row limit and paging envelope as v1. Collection capability.schemaVersion is execution-details-v2; it does not promise that every closing field is available."
      },
      "ObservationFinancialBoundary": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "account-observation-financial-boundary-v1"
          },
          "tradingAccountId": {
            "type": "string"
          },
          "provider": {
            "type": "string",
            "const": "ctrader"
          },
          "observationId": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "observationRevision": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "observedAt": {
            "type": "string",
            "format": "date-time"
          },
          "availability": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "available": {
                "type": "boolean"
              },
              "reason": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  null,
                  "capture_incomplete",
                  "amount_basis_missing",
                  "observation_invalid",
                  "observation_too_large"
                ]
              }
            },
            "required": [
              "available",
              "reason"
            ]
          },
          "boundaryRevision": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^[0-9a-f]{64}$"
          },
          "basis": {
            "type": "string",
            "const": "same_retained_coherent_capture"
          },
          "coverageProof": {
            "type": "boolean",
            "const": false
          }
        },
        "required": [
          "schemaVersion",
          "tradingAccountId",
          "provider",
          "observationId",
          "observationRevision",
          "observedAt",
          "availability",
          "boundaryRevision",
          "basis",
          "coverageProof"
        ]
      },
      "FinancialRefreshStatus": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "requiredFrom": {
            "description": "Immutable required logical start once bound. A cold financial request can be pending with null while obtaining its first physical capture and provider-origin evidence. A reconstructed historical start is not a physical capture. See the local customer-history amendment.",
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "executionComplete": {
            "type": "boolean"
          },
          "status": {
            "type": "string",
            "enum": [
              "not_requested",
              "pending",
              "completed",
              "unavailable"
            ]
          },
          "through": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "physicalObservedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "resourceUrl": {
            "type": [
              "string",
              "null"
            ],
            "description": "Authenticated exact financial-evidence GET path only after committed publication. Not a credential or public anonymous resource."
          },
          "reason": {
            "type": "string",
            "enum": [
              "history_origin_unavailable",
              "historical_trading_metadata_unavailable",
              "historical_baseline_unavailable",
              "cash_metadata_unavailable",
              "cash_operation_unsupported"
            ],
            "description": "Qualified unavailable input for this receipt. Not zero, full financial completion, or proof that the broker can never recover it."
          }
        },
        "required": [
          "requiredFrom",
          "executionComplete",
          "status",
          "through",
          "physicalObservedAt",
          "resourceUrl"
        ]
      },
      "FinancialRefreshReceipt": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "failed",
              "running",
              "cancelled",
              "idle",
              "retry_wait",
              "completed",
              "cooldown"
            ]
          },
          "requestedAt": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "format": "date-time"
              }
            ]
          },
          "requestedThrough": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string"
              }
            ]
          },
          "nextEligibleAt": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "format": "date-time"
              }
            ]
          },
          "retryAt": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "format": "date-time"
              }
            ]
          },
          "financial": {
            "$ref": "#/components/schemas/FinancialRefreshStatus"
          },
          "unavailableReason": {
            "type": "string",
            "enum": [
              "history_origin_unavailable",
              "historical_trading_metadata_unavailable",
              "historical_baseline_unavailable",
              "cash_metadata_unavailable",
              "cash_operation_unsupported"
            ],
            "description": "Qualified unavailable input for this receipt. Not zero, full financial completion, or proof that the broker can never recover it."
          }
        },
        "required": [
          "status",
          "requestedAt",
          "requestedThrough",
          "nextEligibleAt",
          "retryAt",
          "financial"
        ],
        "additionalProperties": false
      },
      "FinancialRefreshResponse": {
        "type": "object",
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "account-refresh-v2"
          },
          "tradingAccountId": {
            "type": "string"
          },
          "refresh": {
            "$ref": "#/components/schemas/FinancialRefreshReceipt"
          },
          "stored": {
            "type": "object",
            "properties": {
              "available": {
                "type": "boolean"
              },
              "state": {
                "anyOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/AccountState"
                  }
                ]
              },
              "sync": {
                "$ref": "#/components/schemas/SyncStatus"
              },
              "freshness": {
                "$ref": "#/components/schemas/Freshness"
              }
            },
            "required": [
              "available",
              "state",
              "sync",
              "freshness"
            ],
            "additionalProperties": false
          },
          "statusUrl": {
            "type": "string",
            "description": "Relative GET path on the same API origin. Does not contain a shared upstream job ID."
          }
        },
        "required": [
          "schemaVersion",
          "tradingAccountId",
          "refresh",
          "stored",
          "statusUrl"
        ],
        "additionalProperties": false
      },
      "FinancialEvidenceV2": {
        "type": "object",
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "financial-evidence-v2"
          },
          "organizationId": {
            "type": "string"
          },
          "tradingAccountId": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "interval": {
            "type": "object",
            "properties": {
              "from": {
                "type": "string",
                "format": "date-time"
              },
              "through": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "from",
              "through"
            ],
            "additionalProperties": false
          },
          "status": {
            "type": "string",
            "enum": [
              "complete",
              "incomplete",
              "unsupported",
              "unavailable"
            ]
          },
          "available": {
            "type": "boolean"
          },
          "reason": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "const": "retained_replay_unavailable"
              },
              {
                "type": "string",
                "const": "retained_replay_ambiguous"
              },
              {
                "type": "string",
                "const": "retained_replay_invalid"
              },
              {
                "type": "string",
                "const": "retained_replay_incomplete"
              },
              {
                "type": "string",
                "const": "retained_replay_unsupported"
              },
              {
                "type": "string",
                "const": "historical_currency_unavailable"
              },
              {
                "type": "string",
                "const": "execution_provenance_unavailable"
              },
              {
                "type": "string",
                "const": "provider_unsupported"
              }
            ]
          },
          "calculationVersion": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "const": "ctrader-account-equity-replay-v13"
              }
            ]
          },
          "sourceRevision": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string"
              }
            ]
          },
          "sourceExecutionContentRevision": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string"
              }
            ]
          },
          "currency": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string"
              }
            ]
          },
          "quantityUnits": {
            "type": "string",
            "const": "account_units"
          },
          "boundaries": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "properties": {
                  "start": {
                    "type": "object",
                    "properties": {
                      "observedAt": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "format": "date-time",
                        "description": "Null for a reconstructed history boundary. Never backdate the physical capture."
                      },
                      "balance": {
                        "type": "string",
                        "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                        "description": "Exact decimal string; do not parse financial values through binary floating point."
                      },
                      "equity": {
                        "type": "string",
                        "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                        "description": "Exact decimal string; do not parse financial values through binary floating point."
                      },
                      "openPositionCount": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "boundaryRevision": {
                        "type": "string"
                      },
                      "effectiveAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "basis": {
                        "type": "string",
                        "const": "reconstructed_history"
                      }
                    },
                    "required": [
                      "observedAt",
                      "balance",
                      "equity",
                      "openPositionCount",
                      "boundaryRevision"
                    ],
                    "additionalProperties": false,
                    "allOf": [
                      {
                        "if": {
                          "properties": {
                            "observedAt": {
                              "type": "null"
                            }
                          },
                          "required": [
                            "observedAt"
                          ]
                        },
                        "then": {
                          "required": [
                            "effectiveAt",
                            "basis"
                          ]
                        }
                      }
                    ]
                  },
                  "end": {
                    "type": "object",
                    "properties": {
                      "observedAt": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "balance": {
                        "type": "string",
                        "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                        "description": "Exact decimal string; do not parse financial values through binary floating point."
                      },
                      "equity": {
                        "type": "string",
                        "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                        "description": "Exact decimal string; do not parse financial values through binary floating point."
                      },
                      "openPositionCount": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "boundaryRevision": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "observedAt",
                      "balance",
                      "equity",
                      "openPositionCount",
                      "boundaryRevision"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "start",
                  "end"
                ],
                "additionalProperties": false
              }
            ]
          },
          "points": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "sequence": {
                  "type": "integer",
                  "minimum": 0
                },
                "timestampMs": {
                  "type": "string",
                  "pattern": "^[0-9]+$",
                  "description": "Unix epoch milliseconds as an exact decimal integer string."
                },
                "source": {
                  "type": "string",
                  "enum": [
                    "boundary_start",
                    "quote",
                    "before_swap",
                    "after_swap",
                    "before_lifecycle",
                    "after_lifecycle",
                    "boundary_end",
                    "before_cash",
                    "after_cash"
                  ]
                },
                "balance": {
                  "type": "string",
                  "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                  "description": "Exact decimal string; do not parse financial values through binary floating point."
                },
                "equity": {
                  "type": "string",
                  "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                  "description": "Exact decimal string; do not parse financial values through binary floating point."
                },
                "grossUnrealizedPnl": {
                  "type": "string",
                  "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                  "description": "Exact decimal string; do not parse financial values through binary floating point."
                },
                "nativeNetUnrealizedPnl": {
                  "type": "string",
                  "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                  "description": "Exact decimal string; do not parse financial values through binary floating point."
                },
                "equityCompatibleNetUnrealizedPnl": {
                  "type": "string",
                  "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                  "description": "Exact decimal string; do not parse financial values through binary floating point."
                },
                "retainedReplayValuation": {
                  "type": "object",
                  "properties": {
                    "balance": {
                      "type": "string",
                      "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                      "description": "Exact decimal string; do not parse financial values through binary floating point."
                    },
                    "equity": {
                      "type": "string",
                      "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                      "description": "Exact decimal string; do not parse financial values through binary floating point."
                    },
                    "grossUnrealizedPnl": {
                      "type": "string",
                      "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                      "description": "Exact decimal string; do not parse financial values through binary floating point."
                    },
                    "nativeNetUnrealizedPnl": {
                      "type": "string",
                      "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                      "description": "Exact decimal string; do not parse financial values through binary floating point."
                    },
                    "equityCompatibleNetUnrealizedPnl": {
                      "type": "string",
                      "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                      "description": "Exact decimal string; do not parse financial values through binary floating point."
                    }
                  },
                  "required": [
                    "balance",
                    "equity",
                    "grossUnrealizedPnl",
                    "nativeNetUnrealizedPnl",
                    "equityCompatibleNetUnrealizedPnl"
                  ],
                  "additionalProperties": false,
                  "description": "Retained seeded replay state, distinct from the physical start snapshot.\r\nPresent only at boundary_start; permits the recipient's native reset\r\ninitialization without substituting captured equity for quote valuation."
                },
                "lifecycleKind": {
                  "anyOf": [
                    {
                      "type": "null"
                    },
                    {
                      "type": "string",
                      "const": "open"
                    },
                    {
                      "type": "string",
                      "const": "increase"
                    },
                    {
                      "type": "string",
                      "const": "partial_close"
                    },
                    {
                      "type": "string",
                      "const": "full_close"
                    }
                  ]
                },
                "lifecycleReference": {
                  "anyOf": [
                    {
                      "type": "null"
                    },
                    {
                      "type": "string"
                    }
                  ]
                },
                "lifecycleExecutionId": {
                  "anyOf": [
                    {
                      "type": "null"
                    },
                    {
                      "type": "string"
                    }
                  ],
                  "description": "Canonical execution ID joining /executions and /trades; null away from an evidenced lifecycle event."
                },
                "realizedBalanceAdjustment": {
                  "anyOf": [
                    {
                      "type": "null"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "dealId": {
                          "type": "string",
                          "description": "Opaque scope-derived reference, not a native provider identifier or canonical execution UUID."
                        },
                        "positionId": {
                          "type": "string",
                          "description": "Opaque scope-derived reference, not a native provider identifier or canonical execution UUID."
                        },
                        "lifecycleKind": {
                          "type": "string",
                          "enum": [
                            "partial_close",
                            "full_close"
                          ]
                        },
                        "remainingVolume": {
                          "type": "string",
                          "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                          "description": "Exact decimal string; do not parse financial values through binary floating point. Normalized account units, not the provider's hundredths-of-unit volume."
                        },
                        "balanceDelta": {
                          "type": "string",
                          "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                          "description": "Exact decimal string; do not parse financial values through binary floating point."
                        },
                        "grossProfit": {
                          "type": "string",
                          "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                          "description": "Exact decimal string; do not parse financial values through binary floating point."
                        },
                        "commission": {
                          "type": "string",
                          "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                          "description": "Signed commission allocated in the retained close balance adjustment; may include opening commission. Do not assume equality to the closing fill commission."
                        },
                        "swap": {
                          "type": "string",
                          "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                          "description": "Exact decimal string; do not parse financial values through binary floating point."
                        },
                        "conversionFee": {
                          "type": "string",
                          "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                          "description": "Exact decimal string; do not parse financial values through binary floating point."
                        }
                      },
                      "required": [
                        "dealId",
                        "positionId",
                        "lifecycleKind",
                        "remainingVolume",
                        "balanceDelta",
                        "grossProfit",
                        "commission",
                        "swap",
                        "conversionFee"
                      ],
                      "additionalProperties": false
                    }
                  ]
                },
                "floatingSwapAdjustment": {
                  "anyOf": [
                    {
                      "type": "null"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "positionDeltas": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "positionId": {
                                "type": "string",
                                "description": "Opaque scope-derived position reference, not a provider-native identifier."
                              },
                              "delta": {
                                "type": "string",
                                "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                                "description": "Exact decimal string; do not parse financial values through binary floating point."
                              }
                            },
                            "required": [
                              "positionId",
                              "delta"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "totalDelta": {
                          "type": "string",
                          "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                          "description": "Exact decimal string; do not parse financial values through binary floating point."
                        }
                      },
                      "required": [
                        "positionDeltas",
                        "totalDelta"
                      ],
                      "additionalProperties": false
                    }
                  ]
                },
                "cashMovementAdjustment": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "reference": {
                      "type": "string",
                      "pattern": "^[0-9a-f]{64}$"
                    },
                    "delta": {
                      "type": "string",
                      "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                      "description": "Exact decimal string; do not parse financial values through binary floating point."
                    },
                    "balanceVersion": {
                      "type": "string",
                      "pattern": "^(?:0|[1-9][0-9]{0,18})$"
                    }
                  },
                  "required": [
                    "reference",
                    "delta",
                    "balanceVersion"
                  ]
                }
              },
              "required": [
                "sequence",
                "timestampMs",
                "source",
                "balance",
                "equity",
                "grossUnrealizedPnl",
                "nativeNetUnrealizedPnl",
                "equityCompatibleNetUnrealizedPnl",
                "lifecycleKind",
                "lifecycleReference",
                "lifecycleExecutionId",
                "realizedBalanceAdjustment",
                "floatingSwapAdjustment"
              ],
              "additionalProperties": false
            }
          },
          "summary": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "properties": {
                  "minimumEquity": {
                    "type": "string",
                    "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                    "description": "Exact decimal string; do not parse financial values through binary floating point."
                  },
                  "minimumEquityTimestampMs": {
                    "type": "string",
                    "pattern": "^[0-9]+$",
                    "description": "Unix epoch milliseconds as an exact decimal integer string."
                  },
                  "maximumEquity": {
                    "type": "string",
                    "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                    "description": "Exact decimal string; do not parse financial values through binary floating point."
                  },
                  "maximumEquityTimestampMs": {
                    "type": "string",
                    "pattern": "^[0-9]+$",
                    "description": "Unix epoch milliseconds as an exact decimal integer string."
                  }
                },
                "required": [
                  "minimumEquity",
                  "minimumEquityTimestampMs",
                  "maximumEquity",
                  "maximumEquityTimestampMs"
                ],
                "additionalProperties": false
              }
            ]
          },
          "endpoint": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "properties": {
                  "certainty": {
                    "type": "string",
                    "enum": [
                      "exact",
                      "bounded"
                    ]
                  },
                  "lower": {
                    "type": "string",
                    "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                    "description": "Exact decimal string; do not parse financial values through binary floating point."
                  },
                  "upper": {
                    "type": "string",
                    "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$",
                    "description": "Exact decimal string; do not parse financial values through binary floating point."
                  },
                  "witnessIdentity": {
                    "type": "string"
                  }
                },
                "required": [
                  "certainty",
                  "lower",
                  "upper",
                  "witnessIdentity"
                ],
                "additionalProperties": false
              }
            ]
          },
          "coverage": {
            "type": "object",
            "properties": {
              "executions": {
                "type": "string",
                "enum": [
                  "complete",
                  "unavailable"
                ]
              },
              "boundaries": {
                "type": "string",
                "enum": [
                  "complete",
                  "unavailable"
                ]
              },
              "quotes": {
                "type": "string",
                "enum": [
                  "complete",
                  "unavailable"
                ]
              },
              "productMetadata": {
                "type": "string",
                "enum": [
                  "complete",
                  "unavailable"
                ]
              },
              "currencyConversion": {
                "type": "string",
                "enum": [
                  "complete",
                  "unavailable"
                ]
              },
              "endpoint": {
                "type": "string",
                "enum": [
                  "complete",
                  "unavailable"
                ]
              }
            },
            "required": [
              "executions",
              "boundaries",
              "quotes",
              "productMetadata",
              "currencyConversion",
              "endpoint"
            ],
            "additionalProperties": false
          },
          "sourceExecutionIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "limitations": {
            "type": "array",
            "prefixItems": [
              {
                "type": "string",
                "const": "retained_bounded_interval_only"
              },
              {
                "type": "string",
                "const": "rule_boundary_anchors_unavailable"
              }
            ],
            "minItems": 2,
            "maxItems": 2
          },
          "baselineProof": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "basis": {
                "type": "string",
                "const": "reconstructed_history"
              },
              "effectiveAt": {
                "type": "string",
                "format": "date-time"
              },
              "physicalAnchorObservedAt": {
                "type": "string",
                "format": "date-time"
              },
              "sourceRevision": {
                "type": "string",
                "pattern": "^[0-9a-f]{64}$"
              }
            },
            "required": [
              "basis",
              "effectiveAt",
              "physicalAnchorObservedAt",
              "sourceRevision"
            ]
          },
          "valuationProof": {
            "type": "object",
            "additionalProperties": false,
            "description": "Optional qualification of traded historical exposure from separate retained metadata acquisitions; not historical physical account snapshots.",
            "properties": {
              "basis": {
                "type": "string",
                "const": "retained_metadata_observations"
              },
              "exposureFrom": {
                "type": "string",
                "format": "date-time"
              },
              "exposureThrough": {
                "type": "string",
                "format": "date-time"
              },
              "knownBeforeExposureAt": {
                "type": "string",
                "format": "date-time"
              },
              "laterMetadataAcquisitionStartedAt": {
                "type": "string",
                "format": "date-time"
              },
              "sourceRevision": {
                "type": "string"
              }
            },
            "required": [
              "basis",
              "exposureFrom",
              "exposureThrough",
              "knownBeforeExposureAt",
              "laterMetadataAcquisitionStartedAt",
              "sourceRevision"
            ]
          }
        },
        "required": [
          "schemaVersion",
          "organizationId",
          "tradingAccountId",
          "provider",
          "interval",
          "status",
          "available",
          "reason",
          "calculationVersion",
          "sourceRevision",
          "sourceExecutionContentRevision",
          "currency",
          "quantityUnits",
          "boundaries",
          "points",
          "summary",
          "endpoint",
          "coverage",
          "sourceExecutionIds",
          "limitations"
        ],
        "additionalProperties": false
      },
      "FinancialEvidenceLinks": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "schemaVersion": {
            "const": "financial-evidence-links-v1"
          },
          "organizationId": {
            "type": "string"
          },
          "tradingAccountId": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "interval": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "from": {
                "type": "string",
                "format": "date-time"
              },
              "through": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "from",
              "through"
            ]
          },
          "available": {
            "type": "boolean"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "financialSourceRevision": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "baseline": {
            "anyOf": [
              {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "basis": {
                    "const": "same_validated_reconstruction"
                  },
                  "sourceRevision": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  },
                  "effectiveAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "boundaryRevision": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  },
                  "physicalAnchorObservedAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "physicalAnchorBoundaryRevision": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  },
                  "physicalAnchorBasis": {
                    "const": "same_retained_coherent_capture"
                  }
                },
                "required": [
                  "basis",
                  "sourceRevision",
                  "effectiveAt",
                  "boundaryRevision",
                  "physicalAnchorObservedAt",
                  "physicalAnchorBoundaryRevision",
                  "physicalAnchorBasis"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "cashMovements": {
            "type": "array",
            "maxItems": 5000,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "basis": {
                  "const": "same_retained_cash_movement"
                },
                "reference": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{64}$"
                },
                "cashMovementId": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{64}$"
                },
                "balanceVersion": {
                  "type": "string",
                  "pattern": "^(?:0|[1-9][0-9]{0,18})$"
                },
                "occurredAt": {
                  "type": "string",
                  "format": "date-time"
                }
              },
              "required": [
                "basis",
                "reference",
                "cashMovementId",
                "balanceVersion",
                "occurredAt"
              ]
            }
          }
        },
        "required": [
          "schemaVersion",
          "organizationId",
          "tradingAccountId",
          "provider",
          "interval",
          "available",
          "reason",
          "financialSourceRevision",
          "baseline",
          "cashMovements"
        ]
      },
      "AccountHistoryOrigin": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "schemaVersion": {
            "const": "account-history-origin-v1"
          },
          "tradingAccountId": {
            "type": "string",
            "format": "uuid"
          },
          "authorizationRevision": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "enum": [
              "qualified",
              "unavailable",
              "unqualified"
            ]
          },
          "reason": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              null,
              "registration_missing",
              "capture_unavailable",
              "registration_conflict",
              "registration_invalid",
              "source_lineage_unqualified",
              "capture_unqualified",
              "receipt_incomplete",
              "coverage_unqualified"
            ]
          },
          "basis": {
            "enum": [
              null,
              "broker_account_registration"
            ]
          },
          "effectiveAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "provenance": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "basis": {
                    "const": "retained_coherent_provider_capture"
                  },
                  "physicalObservedAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "observationUrl": {
                    "type": "string",
                    "pattern": "^/api/v1/accounts/[^/]+/observations/[0-9a-f]{64}$"
                  },
                  "observationRevision": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$"
                  },
                  "sourceRevision": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$"
                  }
                },
                "required": [
                  "basis",
                  "physicalObservedAt",
                  "observationUrl",
                  "observationRevision",
                  "sourceRevision"
                ]
              }
            ]
          },
          "receipt": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "requestedAt": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "requestedThrough": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "status": {
                "type": "string",
                "enum": [
                  "pending",
                  "failed",
                  "running",
                  "cancelled",
                  "idle",
                  "retry_wait",
                  "completed",
                  "cooldown"
                ]
              }
            },
            "required": [
              "requestedAt",
              "requestedThrough",
              "status"
            ]
          },
          "executionCoverage": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "from": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "through": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "completeFromOriginThroughCutoff": {
                "enum": [
                  true,
                  null
                ]
              }
            },
            "required": [
              "from",
              "through",
              "completeFromOriginThroughCutoff"
            ]
          },
          "financialEvidence": {
            "const": "not_asserted"
          }
        },
        "required": [
          "schemaVersion",
          "tradingAccountId",
          "authorizationRevision",
          "status",
          "reason",
          "basis",
          "effectiveAt",
          "provenance",
          "receipt",
          "executionCoverage",
          "financialEvidence"
        ],
        "description": "Opt-in account-wide execution-origin attestation from the same locked authorized snapshot. Registration is not a physical observation or financial baseline. A qualified result binds current recipient authorization, exact completed full-history receipt, committed execution coverage and a separately readable coherent observation. Missing/conflicting/unqualified evidence never asserts absence.",
        "allOf": [
          {
            "if": {
              "properties": {
                "status": {
                  "const": "qualified"
                }
              }
            },
            "then": {
              "properties": {
                "reason": {
                  "type": "null"
                },
                "basis": {
                  "const": "broker_account_registration"
                },
                "effectiveAt": {
                  "type": "string",
                  "format": "date-time"
                },
                "provenance": {
                  "type": "object"
                },
                "executionCoverage": {
                  "properties": {
                    "completeFromOriginThroughCutoff": {
                      "const": true
                    }
                  }
                }
              }
            },
            "else": {
              "properties": {
                "reason": {
                  "type": "string",
                  "enum": [
                    "registration_missing",
                    "capture_unavailable",
                    "registration_conflict",
                    "registration_invalid",
                    "source_lineage_unqualified",
                    "capture_unqualified",
                    "receipt_incomplete",
                    "coverage_unqualified"
                  ]
                },
                "basis": {
                  "type": "null"
                },
                "effectiveAt": {
                  "type": "null"
                },
                "provenance": {
                  "type": "null"
                },
                "executionCoverage": {
                  "properties": {
                    "completeFromOriginThroughCutoff": {
                      "type": "null"
                    }
                  }
                }
              }
            }
          }
        ]
      },
      "HistoryOriginRefreshResponse": {
        "type": "object",
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "account-refresh-v1"
          },
          "tradingAccountId": {
            "type": "string"
          },
          "refresh": {
            "$ref": "#/components/schemas/RefreshStatus"
          },
          "stored": {
            "type": "object",
            "properties": {
              "available": {
                "type": "boolean"
              },
              "state": {
                "anyOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/AccountState"
                  }
                ]
              },
              "sync": {
                "$ref": "#/components/schemas/SyncStatus"
              },
              "freshness": {
                "$ref": "#/components/schemas/Freshness"
              }
            },
            "required": [
              "available",
              "state",
              "sync",
              "freshness"
            ],
            "additionalProperties": false
          },
          "statusUrl": {
            "type": "string",
            "description": "Relative GET path on the same API origin. Does not contain a shared upstream job ID."
          },
          "historyOrigin": {
            "$ref": "#/components/schemas/AccountHistoryOrigin"
          }
        },
        "required": [
          "schemaVersion",
          "tradingAccountId",
          "refresh",
          "stored",
          "statusUrl",
          "historyOrigin"
        ],
        "additionalProperties": false,
        "description": "GET-only include=history-origin extends default account-refresh-v1 without changing its receipt or scheduling work. Default and financial representations remain unchanged."
      }
    }
  },
  "x-local-amendment": {
    "id": "execution-details-closing-v2",
    "status": "implemented_in_source",
    "baselineSourceRevision": "4c5e1fd1a8ce140882a64b8121a527186f8e6e2a",
    "amendmentSourceRevision": "8a9e2e65818dc7b88405bae39d5c42057db767ec",
    "deploymentVerification": "not_asserted_by_spec",
    "scope": "Optional include=closing representation on the existing execution-details GET. Default v1, worker configuration and account permissions remain unchanged. Public deployment and real-account acceptance are verified separately."
  },
  "x-deployed-baseline-source": "4c5e1fd1a8ce140882a64b8121a527186f8e6e2a",
  "x-automatic-financial-refresh": {
    "status": "implemented_in_source",
    "baselineSourceRevision": "c5fd3c467a3ded6bee9d9ff9eceaf107dfcceeac",
    "deploymentVerification": "not_asserted_by_spec",
    "representation": "account-refresh-v2",
    "selection": "include=financial"
  },
  "x-customer-history-amendment": {
    "status": "implemented_account_specific_live_verification",
    "baselineSourceRevision": "b74bd680f19f1dbe00c9e3811f52b523eb3fdeaf",
    "migration": "20261102104208_unifywire_ctrader_customer_full_history.sql",
    "deploymentVerification": "No assertion of wider worker eligibility or complete new-account live acceptance; inspect authorized coverage and readiness.",
    "description": "New supported customer receipts request all available broker history independently of SaaS calculation dates, preserve one fixed cutoff across bounded import turns, and can persist financial intent before a baseline exists. Existing receipts retain their obligations. Unknown origins and unqualified historical trading metadata remain explicit unavailable inputs. Production worker eligibility is unchanged."
  },
  "x-recipient-acquisition-amendment": {
    "baseRevision": "d38d8279f33052b72ebc92dd3e070fd92eb4c3e0",
    "status": "implemented_in_source",
    "deploymentVerification": "not_asserted_by_spec",
    "supportedScope": "central cTrader Demo/HEDGED; explicit consent, selection and request-driven refresh",
    "identity": "existing recipient account/connection and stable recipient execution IDs",
    "historicalEquity": "only when independently qualified retained evidence supports it"
  },
  "x-history-origin-amendment": {
    "status": "implemented_in_source",
    "deploymentVerification": "not_asserted_by_spec",
    "selection": "GET include=history-origin",
    "representation": "account-refresh-v1 with historyOrigin/account-history-origin-v1",
    "financialEvidence": "not_asserted",
    "notes": "Exact current tenant/grant/source epoch, original receipt/cutoff and committed coverage are bound to the retained coherent capture. observationRevision is SHA256 of canonical sorted-key JSON of the observation response data without meta; sourceRevision is an opaque server attestation. No private DTOs, source IDs, tokens or leases are exposed. Foreign/revoked account scope remains 404."
  },
  "x-approval-return-amendment": {
    "status": "implemented_in_source",
    "deploymentVerification": "not_asserted_by_spec",
    "decisionBudgetsMs": {
      "api": 24000,
      "websiteUpstream": 28000,
      "website": 32000,
      "browser": 40000
    },
    "recovery": "Original HttpOnly request proof and nonce match the exact connected authenticated attempt or current retained browser owner. Only the already-saved active approval and immutable recipient return can be read. Original request/review expiry remains authoritative; no approval retry, new source, token, proof or expiry. Reload needs no browser storage.",
    "customerContract": "Existing status/state return and backend decision/account/connection verification remain. Browser resume/recover are internal same-origin actions, not customer-key API endpoints. Expired consumer context requires authenticated metadata recovery without renewing the provider return state."
  }
}
