{
  "openapi": "3.1.0",
  "jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
  "info": {
    "title": "UnifyWire customer API",
    "version": "v1-source-4c5e1fd1",
    "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. Last retained release proof on 2026-10-24 verified API/website source 4c5e1fd1 and existing-account stored reads; the unchanged hosted worker was restricted to a preapproved existing account scope. Newly linked accounts are not automatically eligible, real additional-account OAuth remains unexercised and retained re-consent acceptance is deferred. This document changes no account access, credentials or runtime state."
  },
  "x-source-revision": "4c5e1fd1a8ce140882a64b8121a527186f8e6e2a",
  "x-contract-inspected-date": "2026-10-24",
  "x-live-verification-scope": "Stored-data access within a preapproved existing account scope; no newly linked account acquisition or retained re-consent acceptance claim.",
  "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. Current deployed worker is restricted to a preapproved existing account scope; linking another account does not extend it. 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. 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.",
        "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. Accounts include canonical IDs and providerAccountId, not a guaranteed broker-facing trading number. Broker-number dashboard labels are not fields in this public DTO.",
        "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.",
        "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/ExecutionDetailsCollection"
                    },
                    "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": {
      "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."
          }
        ],
        "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.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Canonical UnifyWire account ID; never substitute broker number or providerAccountId."
          }
        ],
        "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": {
                      "$ref": "#/components/schemas/RefreshResponse"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                },
                "example": {
                  "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"
                  }
                }
              }
            }
          },
          "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.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "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/RefreshResponse"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ]
                },
                "example": {
                  "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"
                  }
                }
              }
            }
          },
          "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": {
                      "$ref": "#/components/schemas/FinancialEvidence"
                    },
                    "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"
          }
        }
      }
    }
  },
  "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"
              }
            ]
          },
          "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",
          "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"
              }
            ]
          },
          "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."
          }
        },
        "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"
          }
        },
        "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": {
              "$ref": "#/components/schemas/FinancialEvidence"
            }
          }
        },
        "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"
              }
            ]
          }
        },
        "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"
        }
      }
    }
  }
}
