# GET State

Получение текущего состояния Sandbox по займам и партнерской части.

## GET /api/sandbox/state

> Возвращает полный снимок Sandbox по текущему API-ключу: блок \`loans\` с займами и flow, а также блок \`partner\` с партнерским профилем, ссылками и вознаграждениями.\
> \
> Используйте этот endpoint для синхронизации своего интерфейса после любого POST-запроса или после ошибки \`FLOW\_CONFLICT\`. В Sandbox каждый API-ключ видит только свое тестовое состояние.\
> \
> \`Idempotency-Key\` для GET-запросов не нужен и в ответе \`idempotency\_replayed\` не возвращается.\
> \
> Пример:\
> \`\`\`bash\
> curl <https://partner.fundora.capital/api/sandbox/state> \\\
> &#x20; -H "Authorization: Bearer sk\_sandbox\_YOUR\_KEY"\
> \`\`\`

````json
{"openapi":"3.0.3","info":{"title":"Fundora API","version":"0.3.0"},"tags":[{"name":"get-state","description":"Получение текущего состояния Sandbox по займам и партнерской части."}],"servers":[{"url":"https://partner.fundora.capital","description":"Production-домен партнерского API"}],"security":[{"SandboxBearer":[]}],"components":{"securitySchemes":{"SandboxBearer":{"type":"http","scheme":"bearer","bearerFormat":"sk_sandbox"}},"schemas":{"SandboxStateResponse":{"type":"object","description":"Полный снимок Sandbox: займы плюс партнерский блок.","properties":{"request_id":{"type":"string","description":"Идентификатор запроса для поддержки и поиска в Logs."},"success":{"type":"boolean","description":"Признак успешного ответа."},"loans":{"$ref":"#/components/schemas/SandboxLoansState"},"partner":{"$ref":"#/components/schemas/SandboxPartnerState"}},"required":["request_id","success","loans","partner"]},"SandboxLoansState":{"type":"object","properties":{"activatedScenarios":{"type":"object","description":"Какие sandbox-сценарии активированы для текущего пользователя/API-ключа.","properties":{"miner":{"type":"boolean","description":"Активирован borrower/miner сценарий."},"investor":{"type":"boolean","description":"Активирован investor сценарий."}}},"wallet":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/SandboxWalletState"}],"description":"Тестовый кошелек симулятора."},"activeLoans":{"type":"array","description":"Активные Sandbox-займы.","items":{"$ref":"#/components/schemas/SandboxLoanRecord"}},"loanHistory":{"type":"array","description":"Закрытые или исторические Sandbox-займы.","items":{"$ref":"#/components/schemas/SandboxLoanRecord"}},"loanHistoryEvents":{"type":"array","description":"События истории по займам для UI/таймлайна.","items":{"$ref":"#/components/schemas/SandboxLoanHistoryEvent"}},"loanDraft":{"$ref":"#/components/schemas/SandboxLoanDraft"},"sandboxFlow":{"$ref":"#/components/schemas/SandboxLoanFlowState"}}},"SandboxWalletState":{"type":"object","properties":{"id":{"type":"string","description":"ID sandbox-кошелька симулятора."},"virtualBtcBalance":{"type":"string","description":"Доступный тестовый BTC-баланс."},"virtualUsdBalance":{"type":"string","description":"Доступный тестовый USD/USDT-баланс."},"virtualRubBalance":{"type":"string","description":"Доступный тестовый RUB-баланс."},"lockedBtcBalance":{"type":"string","description":"BTC, заблокированный в залоге."},"investedRubBalance":{"type":"string","description":"RUB, задействованный в инвестиционном сценарии."}}},"SandboxLoanRecord":{"type":"object","properties":{"id":{"type":"string","description":"ID Sandbox-займа."},"status":{"type":"string","description":"Статус займа."},"collateral_btc":{"type":"number","description":"Общий BTC-залог."},"collateral_received":{"type":"number","description":"Фактически подтвержденный BTC-залог."},"collateral_address":{"type":"string","nullable":true,"description":"Адрес залога в симуляторе."},"external_client_id":{"type":"string","nullable":true,"description":"ID клиента в системе партнера."},"client_reference":{"type":"string","nullable":true,"description":"Человекочитаемая ссылка на клиента или сделку."},"loan_amount":{"type":"number","description":"Исходная сумма займа."},"loan_currency":{"type":"string","enum":["RUB","USDT"],"description":"Валюта займа."},"debt_amount":{"type":"number","description":"Исходный основной долг."},"annual_rate":{"type":"number","description":"Годовая ставка займа в процентах."},"btc_rate":{"type":"number","description":"BTC rate, зафиксированный на момент создания."},"usd_rub_rate":{"type":"number","description":"USD/RUB rate, зафиксированный на момент создания."},"current_collateral_usd":{"type":"number","description":"Текущая стоимость залога в USD."},"current_collateral_rub":{"type":"number","description":"Текущая стоимость залога в RUB."},"current_debt":{"type":"number","description":"Текущий долг с учетом операций."},"health_factor":{"type":"number","description":"Индикатор здоровья займа: чем выше, тем безопаснее."},"accrued_interest":{"type":"number","description":"Начисленные проценты."},"max_ltv":{"type":"number","description":"Максимальный LTV для займа."},"liquidation_threshold":{"type":"number","description":"Порог ликвидации для займа."},"created_at":{"type":"string","format":"date-time","description":"Время создания займа."},"funded_at":{"type":"string","format":"date-time","description":"Время выдачи займа."},"interest_due_at":{"type":"string","nullable":true,"format":"date-time","description":"Дата ближайшего процентного платежа."},"principal_due_at":{"type":"string","nullable":true,"format":"date-time","description":"Дата платежа основного долга."}}},"SandboxLoanHistoryEvent":{"type":"object","properties":{"id":{"type":"string","description":"ID события истории."},"type":{"type":"string","enum":["opened","collateral","loan","interest_paid","closed"],"description":"Тип события."},"title":{"type":"string","description":"Название события для UI."},"amountLabel":{"type":"string","description":"Основная сумма для отображения."},"amountSubLabel":{"type":"string","nullable":true,"description":"Дополнительная сумма для отображения."},"rateLabel":{"type":"string","nullable":true,"description":"Ставка или курс для отображения."},"createdAt":{"type":"string","format":"date-time","description":"Время события."},"loanId":{"type":"string","description":"ID связанного займа."},"canRemoveCollateral":{"type":"boolean","description":"Можно ли снять часть залога после этого события."}}},"SandboxLoanDraft":{"type":"object","nullable":true,"properties":{"id":{"type":"string","description":"ID draft-заявки."},"status":{"type":"string","enum":["active","completed","discarded"],"description":"Статус draft-заявки."},"currentStep":{"type":"string","enum":["contract","kyt","collateral","cfa"],"description":"Текущий шаг draft в legacy simulator flow."},"loanId":{"type":"string","nullable":true,"description":"ID созданного займа, если draft уже завершен."},"loanParams":{"type":"object","properties":{"collateral_btc":{"type":"number","description":"BTC-залог draft-заявки."},"loan_amount":{"type":"number","description":"Сумма займа draft-заявки."},"loan_currency":{"type":"string","enum":["RUB","USDT"],"description":"Валюта займа draft-заявки."}}},"contractAddress":{"type":"string","nullable":true,"description":"Тестовый contract/collateral address."},"kytReport":{"type":"object","nullable":true,"additionalProperties":true,"description":"KYT payload, переданный в run_kyt."},"collateralPosted":{"type":"boolean","description":"Подтвержден ли залог."},"cfaIssued":{"type":"boolean","description":"Завершена ли выдача займа."},"collateralPostedAt":{"type":"string","nullable":true,"format":"date-time"},"cfaIssuedAt":{"type":"string","nullable":true,"format":"date-time"},"completedAt":{"type":"string","nullable":true,"format":"date-time"},"discardedAt":{"type":"string","nullable":true,"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"SandboxLoanFlowState":{"type":"object","properties":{"loanApplications":{"type":"array","description":"Все активные и завершенные loan application flows.","items":{"$ref":"#/components/schemas/SandboxLoanApplicationFlow"}},"repaymentOperations":{"type":"array","description":"Все repayment flows по займам.","items":{"$ref":"#/components/schemas/SandboxRepaymentOperationFlow"}}}},"SandboxLoanApplicationFlow":{"type":"object","description":"Текущий loan application flow для выдачи займа.","properties":{"id":{"type":"string","description":"Идентификатор draft/application flow."},"loanId":{"type":"string","nullable":true,"description":"Идентификатор созданного займа. До complete_payout может быть null."},"externalClientId":{"type":"string","nullable":true,"description":"ID клиента в системе партнера."},"clientReference":{"type":"string","nullable":true,"description":"Человекочитаемая ссылка на клиента/сделку."},"status":{"type":"string","enum":["pending","completed"],"description":"Статус loan application flow."},"currentStepId":{"type":"string","nullable":true,"enum":["calculator","collateral_transfer","btc_confirmation","kyt","payout"],"description":"Следующий или текущий шаг, который нужно завершить."},"collateralRequiredConfirmations":{"type":"integer","description":"Сколько подтверждений нужно передать в confirm_btc."},"payoutRequiredConfirmations":{"type":"integer","description":"Сколько подтверждений ожидается для тестовой выдачи."},"wallets":{"type":"object","description":"Тестовые кошельки loan flow.","properties":{"collateralDeposit":{"$ref":"#/components/schemas/SandboxTestWallet"},"loanPayout":{"$ref":"#/components/schemas/SandboxTestWallet"},"collateralReturn":{"$ref":"#/components/schemas/SandboxTestWallet"}}},"steps":{"type":"array","items":{"$ref":"#/components/schemas/SandboxFlowStep"}}}},"SandboxTestWallet":{"type":"object","description":"Тестовый deterministic wallet/address для Sandbox flow. Не является реальным custody-кошельком.","properties":{"purpose":{"type":"string","enum":["collateral_deposit","loan_payout","repayment","collateral_return"],"description":"Назначение тестового кошелька в flow."},"asset":{"type":"string","enum":["BTC","USDT"],"description":"Актив кошелька."},"network":{"type":"string","enum":["sandbox"],"description":"Всегда sandbox: адрес не предназначен для реального blockchain-перевода."},"chainCode":{"type":"string","enum":["SANDBOX_BTC","SANDBOX_USDT"],"description":"Код тестовой сети."},"address":{"type":"string","description":"Тестовый адрес, который партнер показывает клиенту или использует в симуляции."},"isRealWallet":{"type":"boolean","enum":[false],"description":"Всегда false: в Sandbox не создается реальный custody wallet."},"confirmationMode":{"type":"string","enum":["api_simulated"],"description":"Подтверждение выполняется через API action, а не через внешний blockchain polling."},"requiredConfirmations":{"type":"integer","description":"Сколько подтверждений нужно передать в confirm action."}},"required":["purpose","asset","network","chainCode","address","isRealWallet","confirmationMode","requiredConfirmations"]},"SandboxFlowStep":{"type":"object","properties":{"id":{"type":"string","description":"Машинный идентификатор шага flow."},"title":{"type":"string","description":"Название шага для отображения."},"status":{"type":"string","enum":["pending","processing","completed"],"description":"Текущий статус шага."}}},"SandboxRepaymentOperationFlow":{"type":"object","description":"Repayment operation flow для процентов, частичного или полного погашения.","properties":{"id":{"type":"string","description":"Идентификатор repayment operation. Передавайте его как operation_id на следующих шагах."},"loanId":{"type":"string","nullable":true,"description":"ID займа, к которому относится repayment operation."},"kind":{"type":"string","enum":["interest","partial_principal","full_principal"],"description":"Тип погашения."},"status":{"type":"string","enum":["pending","completed"],"description":"Статус repayment flow."},"currentStepId":{"type":"string","nullable":true,"enum":["payment","usdt_confirmation","kyt","interest_settlement","debt_update","collateral_return"],"description":"Следующий или текущий шаг repayment flow."},"requiredConfirmations":{"type":"integer","description":"Сколько подтверждений нужно передать в confirm_usdt."},"wallets":{"type":"object","description":"Тестовые кошельки repayment flow.","properties":{"repayment":{"$ref":"#/components/schemas/SandboxTestWallet"},"collateralReturn":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/SandboxTestWallet"}],"description":"Кошелек возврата залога. Заполняется для полного погашения."}}},"steps":{"type":"array","items":{"$ref":"#/components/schemas/SandboxFlowStep"}},"createdAt":{"type":"string","format":"date-time","description":"Время создания repayment operation."}}},"SandboxPartnerState":{"type":"object","properties":{"partner":{"$ref":"#/components/schemas/SandboxPartnerProfile"},"rewards":{"$ref":"#/components/schemas/SandboxPartnerRewards"},"subpartners":{"type":"array","description":"Прямые subpartners текущего партнера.","items":{"$ref":"#/components/schemas/SandboxSubpartner"}},"links":{"type":"array","description":"Партнерские ссылки текущего партнера.","items":{"$ref":"#/components/schemas/SandboxPartnerLink"}}}},"SandboxPartnerProfile":{"type":"object","nullable":true,"properties":{"id":{"type":"string","description":"ID sandbox-партнера."},"displayName":{"type":"string","description":"Отображаемое имя партнера."},"phone":{"type":"string","nullable":true,"description":"Телефон партнера, если передан."},"inviteCode":{"type":"string","description":"Invite code для подключения subpartners."},"partnerLevel":{"type":"integer","description":"Уровень партнера в sandbox-сети."},"parentPartnerId":{"type":"string","nullable":true,"description":"ID вышестоящего партнера."},"status":{"type":"string","description":"Статус партнера."},"defaultLink":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/SandboxPartnerLink"}],"description":"Основная партнерская ссылка."},"createdAt":{"type":"string","format":"date-time","description":"Время создания партнера."}}},"SandboxPartnerLink":{"type":"object","properties":{"id":{"type":"string","description":"ID партнерской ссылки."},"slug":{"type":"string","description":"Slug ссылки, который можно передать как partner_link_slug при создании займа."},"label":{"type":"string","description":"Название ссылки."},"marginPercent":{"type":"number","description":"Партнерская маржа/ставка ссылки в процентах. В Sandbox по умолчанию 4%."},"disabledAt":{"type":"string","nullable":true,"format":"date-time","description":"Когда ссылка была отключена."},"createdAt":{"type":"string","format":"date-time","description":"Когда ссылка была создана."}}},"SandboxPartnerRewards":{"type":"object","properties":{"totalUsd":{"type":"number","description":"Общие sandbox-вознаграждения в USD."},"directUsd":{"type":"number","description":"Прямые вознаграждения в USD."},"networkUsd":{"type":"number","description":"Сетевые вознаграждения в USD."}}},"SandboxSubpartner":{"type":"object","properties":{"id":{"type":"string","description":"ID subpartner."},"displayName":{"type":"string","description":"Имя subpartner."},"inviteCode":{"type":"string","description":"Invite code subpartner."},"partnerLevel":{"type":"integer","description":"Уровень subpartner."},"rewardUsd":{"type":"number","description":"Вознаграждение от этого subpartner в USD."},"createdAt":{"type":"string","format":"date-time","description":"Время создания subpartner."}}},"ErrorResponse":{"type":"object","properties":{"request_id":{"type":"string","description":"Идентификатор запроса для поддержки и поиска в Logs."},"error_code":{"type":"string","description":"Формализованный код ошибки для интеграционной логики.","enum":["SANDBOX_API_KEY_REQUIRED","SANDBOX_API_KEY_INVALID","SANDBOX_API_KEY_DATABASE_REQUIRED","SANDBOX_SESSION_REQUIRED","SANDBOX_RATE_LIMIT_EXCEEDED","INVALID_REQUEST","INVALID_ACTION","INVALID_SCOPE","LOAN_NOT_FOUND","WALLET_NOT_FOUND","FLOW_CONFLICT","LIMIT_EXCEEDED","INSUFFICIENT_BALANCE","IDEMPOTENCY_KEY_REQUIRED","IDEMPOTENCY_KEY_CONFLICT","IDEMPOTENCY_KEY_IN_PROGRESS","DATABASE_UNAVAILABLE","INTERNAL_ERROR"]},"error":{"type":"string","description":"Человекочитаемое описание ошибки. Не используйте его для интеграционной логики, для этого есть error_code."}},"required":["request_id","error_code","error"]}},"responses":{"Unauthorized":{"description":"Sandbox API-ключ отсутствует или недействителен","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"TooManyRequests":{"description":"Превышен Sandbox API rate limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/api/sandbox/state":{"get":{"operationId":"getSandboxState","tags":["get-state"],"summary":"GET /api/sandbox/state","description":"Возвращает полный снимок Sandbox по текущему API-ключу: блок `loans` с займами и flow, а также блок `partner` с партнерским профилем, ссылками и вознаграждениями.\n\nИспользуйте этот endpoint для синхронизации своего интерфейса после любого POST-запроса или после ошибки `FLOW_CONFLICT`. В Sandbox каждый API-ключ видит только свое тестовое состояние.\n\n`Idempotency-Key` для GET-запросов не нужен и в ответе `idempotency_replayed` не возвращается.\n\nПример:\n```bash\ncurl https://partner.fundora.capital/api/sandbox/state \\\n  -H \"Authorization: Bearer sk_sandbox_YOUR_KEY\"\n```","responses":{"200":{"description":"Состояние Sandbox","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SandboxStateResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}}}}
````


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fundora.capital/api-sandbox/get-state.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
