POST /v1/workflows/prepare
Prepare and preflight an explicit Torq workflow
| Availability | Private Preview |
|---|---|
| Method and path | POST /v1/workflows/prepare |
| API version | 1.0.0-private-preview |
| Base URL | https://api.torq.finance |
| Authentication | SecretKey, WalletSession, PublishableKey |
| Idempotency | Required header: Idempotency-Key. |
| Rate limits | Read x-ratelimit-* and x-request-id response headers. Do not hard-code a quota. |
Authentication requirements
SecretKeyWalletSessionPublishableKey
Request examples
curl -X POST 'https://api.torq.finance/v1/workflows/prepare' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer $TORQ_SECRET_KEY' \
-H 'x-torq-wallet-session: $TORQ_WALLET_SESSION' \
-H 'Idempotency-Key: $TORQ_IDEMPOTENCY_KEY' \
-H 'Content-Type: application/json' \
--data '{"workflowType":"borrow","chainId":11155111,"input":{"marketAddress":"0x4ac10f0186719528ae77B1cf6186AE83002C450D","amount":"1000000"}}'This calls the docs preview and returns sample data shaped by the governed OpenAPI response. It never accepts credentials or changes protocol state.
Run the sample call to inspect a schema-shaped response without credentials or side effects.| Request body | WorkflowPrepareRequest |
|---|
Parameters
| Name | In | Required | Type |
|---|---|---|---|
Idempotency-Key | header | Yes | string |
Request schema
WorkflowPrepareRequest WorkflowPrepareRequest
| Property | Type | Required | Description |
|---|---|---|---|
workflowType | string | Yes | — |
chainId | integer | Yes | — |
deploymentNamespace | string | null | No | — |
principalAddress | string | No | — |
input | object | Yes | — |
constraints | object | No | — |
Inspect nested properties
workflowType string · required
one of: borrow, claimWithdrawal, deposit, depositCollateral, liquidate, repay, requestWithdrawal, role.allocator.vaultAllocate, role.allocator.vaultDeallocate, role.allocator.vaultReallocationBatch, role.asset_issuer.assetSubmissionRequestCreate, role.asset_manager.distressedRecoveryAcquisitionV3Bid, role.asset_manager.distressedRecoveryFundV3ChannelPolicySet, role.asset_manager.distressedRecoveryFundV3SelfLaunch, role.asset_manager.vaultDeploy, role.asset_manager.vaultShareMobilityManagerAction, role.borrower.borrowerBorrow, role.borrower.borrowerDepositCollateral, role.borrower.borrowerRepay, role.borrower.borrowerWithdrawCollateral, role.curator.partnerChannelBlockedUpdate, role.curator.partnerChannelDeploy, role.curator.vaultMarketListingSave, role.investor.partnerWrapperDeposit, role.investor.partnerWrapperRedeem, role.lender.distressedRecoveryFundV3AuctionBid, role.lender.distressedRecoveryFundV3RfqCancelBid, role.lender.distressedRecoveryFundV3RfqClaimRefund, role.lender.distressedRecoveryFundV3RfqFinalize, role.lender.distressedRecoveryFundV3RfqPlaceBid, role.lender.distressedRecoveryFundV3RfqReplaceBid, role.lender.investorFulfillRedeem, role.lender.investorRequestRedeem, role.lender.vaultShareMobilityInvestorAction, role.liquidator.liquidate, role.liquidator.settleLiquidationClaim, role.nav_reporter.navReportSignAndSubmit, role.partner.partnerBorrowerFeeClaim, role.partner.partnerChannelDeploy, role.partner.partnerFeeSharesClaim, role.partner.partnerSubmitApplication, role.partner.partnerWrapperDeposit, role.partner.partnerWrapperRedeem, role.vault_manager.partnerChannelDeploy, role.vault_owner.attachMarketToVault, role.vault_owner.vaultAllocate, role.vault_owner.vaultAllocatorUpdate, role.vault_owner.vaultCuratorCapsSettingsSave, role.vault_owner.vaultCuratorFeeSettingsSave, role.vault_owner.vaultDeallocate, role.vault_owner.vaultFeeConfigUpdate, role.vault_owner.vaultManagementSettingsSave, role.vault_owner.vaultOwnerSettingsSave, role.vault_owner.vaultOwnerTransferUpdate, role.vault_owner.vaultReallocationBatch, role.vault_owner.vaultRoleSettingsSave, role.vault_owner.vaultRoutingUpdate, role.vault_owner.vaultSettingsUpdate, settleLiquidationClaim, withdrawCollateral, withdrawNow
chainId integer · required
minimum: 1
deploymentNamespace string | null · optional
nullable
principalAddress string · optional
pattern: ^0x[a-fA-F0-9]{40}$
input object · required
constraints object · optional
Responses
| Status | Meaning | Schema |
|---|---|---|
200 | Successful response | PreparedWorkflow |
400 | Invalid request | TorqApiError |
401 | Authentication required | TorqApiError |
403 | Insufficient scope or authority | TorqApiError |
409 | State or idempotency conflict | TorqApiError |
429 | Rate limit exceeded | TorqApiError |
500 | Internal failure | TorqApiError |
200 response schema
PreparedWorkflow PreparedWorkflow
| Property | Type | Required | Description |
|---|---|---|---|
ok | boolean | Yes | — |
requestId | string | Yes | — |
workflowType | enum | Yes | — |
status | enum | Yes | — |
executionMode | enum | Yes | — |
custodyBoundary | enum | Yes | — |
snapshotHash | string | Yes | — |
expiresAt | string (date-time) | Yes | — |
preflight | WorkflowPreflight | Yes | — |
transactions | TransactionIntent[] | Yes | — |
canonicalPostconditions | CanonicalPostcondition[] | Yes | — |
Inspect nested properties
ok boolean · required
requestId string · required
minimum length: 1 · maximum length: 200
workflowType enum · required
one of: borrow, claimWithdrawal, deposit, depositCollateral, liquidate, repay, requestWithdrawal, role.allocator.vaultAllocate, role.allocator.vaultDeallocate, role.allocator.vaultReallocationBatch, role.asset_issuer.assetSubmissionRequestCreate, role.asset_manager.distressedRecoveryAcquisitionV3Bid, role.asset_manager.distressedRecoveryFundV3ChannelPolicySet, role.asset_manager.distressedRecoveryFundV3SelfLaunch, role.asset_manager.vaultDeploy, role.asset_manager.vaultShareMobilityManagerAction, role.borrower.borrowerBorrow, role.borrower.borrowerDepositCollateral, role.borrower.borrowerRepay, role.borrower.borrowerWithdrawCollateral, role.curator.partnerChannelBlockedUpdate, role.curator.partnerChannelDeploy, role.curator.vaultMarketListingSave, role.investor.partnerWrapperDeposit, role.investor.partnerWrapperRedeem, role.lender.distressedRecoveryFundV3AuctionBid, role.lender.distressedRecoveryFundV3RfqCancelBid, role.lender.distressedRecoveryFundV3RfqClaimRefund, role.lender.distressedRecoveryFundV3RfqFinalize, role.lender.distressedRecoveryFundV3RfqPlaceBid, role.lender.distressedRecoveryFundV3RfqReplaceBid, role.lender.investorFulfillRedeem, role.lender.investorRequestRedeem, role.lender.vaultShareMobilityInvestorAction, role.liquidator.liquidate, role.liquidator.settleLiquidationClaim, role.nav_reporter.navReportSignAndSubmit, role.partner.partnerBorrowerFeeClaim, role.partner.partnerChannelDeploy, role.partner.partnerFeeSharesClaim, role.partner.partnerSubmitApplication, role.partner.partnerWrapperDeposit, role.partner.partnerWrapperRedeem, role.vault_manager.partnerChannelDeploy, role.vault_owner.attachMarketToVault, role.vault_owner.vaultAllocate, role.vault_owner.vaultAllocatorUpdate, role.vault_owner.vaultCuratorCapsSettingsSave, role.vault_owner.vaultCuratorFeeSettingsSave, role.vault_owner.vaultDeallocate, role.vault_owner.vaultFeeConfigUpdate, role.vault_owner.vaultManagementSettingsSave, role.vault_owner.vaultOwnerSettingsSave, role.vault_owner.vaultOwnerTransferUpdate, role.vault_owner.vaultReallocationBatch, role.vault_owner.vaultRoleSettingsSave, role.vault_owner.vaultRoutingUpdate, role.vault_owner.vaultSettingsUpdate, settleLiquidationClaim, withdrawCollateral, withdrawNow
status enum · required
one of: prepared, final_success
executionMode enum · required
one of: onchain_transaction, metadata_only
custodyBoundary enum · required
one of: external_wallet_required, wallet_session_authenticated
snapshotHash string · required
pattern: ^0x[a-fA-F0-9]{64}$
expiresAt string (date-time) · required
preflight WorkflowPreflight · required
| Property | Type | Required | Description |
|---|---|---|---|
status | enum | Yes | — |
blockedReasons | string[] | Yes | — |
freshness | FreshnessEvidence | Yes | — |
revalidateAtExecution | string[] | Yes | — |
Inspect nested properties
status enum · required
one of: passed, blocked
blockedReasons string[] · required
items string
freshness FreshnessEvidence · required
| Property | Type | Required | Description |
|---|---|---|---|
status | enum | Yes | — |
lagSeconds | integer | Yes | — |
blockNumber | string | null | No | — |
blockTimestamp | string | null (date-time) | No | — |
projectedAt | string | null (date-time) | No | — |
snapshotAt | string | null (date-time) | No | — |
reason | string | null | No | — |
Inspect nested properties
status enum · required
one of: current, healthy, stale, missing, blocked
lagSeconds integer · required
minimum: 0
blockNumber string | null · optional
nullable
blockTimestamp string | null (date-time) · optional
nullable
projectedAt string | null (date-time) · optional
nullable
snapshotAt string | null (date-time) · optional
nullable
reason string | null · optional
nullable
revalidateAtExecution string[] · required
items string
transactions TransactionIntent[] · required
items TransactionIntent
| Property | Type | Required | Description |
|---|---|---|---|
order | integer | Yes | — |
chainId | integer | Yes | — |
transactionKind | enum | Yes | — |
target | string | null | Yes | — |
calldata | string | Yes | — |
value | string | Yes | — |
label | string | Yes | — |
simulationRequired | boolean | Yes | — |
signing | Eip712SigningInstruction | No | — |
Inspect nested properties
order integer · required
minimum: 0
chainId integer · required
minimum: 1
transactionKind enum · required
one of: contract_call, contract_deployment
target string | null · required
pattern: ^0x[a-fA-F0-9]{40}$ · nullable
calldata string · required
pattern: ^0x[a-fA-F0-9]*$
value string · required
pattern: ^[0-9]+$
label string · required
minimum length: 1 · maximum length: 200
simulationRequired boolean · required
signing Eip712SigningInstruction · optional
| Property | Type | Required | Description |
|---|---|---|---|
kind | string | Yes | — |
typedData | Eip712TypedData | Yes | — |
signaturePlacement | string | Yes | — |
canonicalPostconditions CanonicalPostcondition[] · required
items CanonicalPostcondition
| Property | Type | Required | Description |
|---|---|---|---|
entityType | string | Yes | — |
entityId | string | Yes | — |
field | string | Yes | — |
expected | unknown | Yes | — |
Inspect nested properties
entityType string · required
minimum length: 1 · maximum length: 200
entityId string · required
minimum length: 1 · maximum length: 200
field string · required
minimum length: 1 · maximum length: 200
expected unknown · required
400, 401, 403, 409, 429, 500 response schema
TorqApiError TorqApiError
| Property | Type | Required | Description |
|---|---|---|---|
ok | boolean | Yes | — |
code | string | Yes | — |
message | string | Yes | — |
requestId | string | Yes | — |
retryable | boolean | Yes | — |
blockedReason | string | null | No | — |
docsUrl | string (uri) | No | — |
Inspect nested properties
ok boolean · required
code string · required
minimum length: 1 · maximum length: 200
message string · required
minimum length: 1 · maximum length: 200
requestId string · required
minimum length: 1 · maximum length: 200
retryable boolean · required
blockedReason string | null · optional
nullable
docsUrl string (uri) · optional
Related guides
- Authentication and scopes
- Errors, idempotency, and rate limits
- Canonical state and final completion
- SDK reference
For retry behavior and blocked-state handling, see Errors and rate limits.