> For the complete documentation index, see [llms.txt](https://docs.qiro.fi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.qiro.fi/developer-section/openapi-spec/drawdowns/prepare-the-borrower-transaction.md).

# Prepare the borrower transaction

Returns unsigned calldata only while the drawdown is `READY_FOR_SUBMISSION`, or returns the same unexpired stored preparation for an idempotent retry. Preparations are valid for ten minutes. Preparation atomically moves the resource to `SUBMITTING` because the transaction may be broadcast immediately after this response.

The partner signs and broadcasts the returned transaction using the designated wallet. Qiro never receives a private key and this endpoint does not submit a blockchain transaction. The Qiro SDK can perform preparation, wallet submission, and immediate receipt verification as one client-side method.

```json
{"openapi":"3.1.0","info":{"title":"Qiro Partner Instant Settlement API","version":"1.0.0-draft"},"tags":[{"name":"Drawdowns","description":"Request, prepare, and track a drawdown against an approved facility."}],"servers":[{"url":"/","description":"Qiro API host supplied to the partner during onboarding."}],"security":[{"oauth2":["drawdowns:write"]}],"components":{"securitySchemes":{"oauth2":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"/oauth/token","scopes":{"facilities:read":"Read facilities owned by the authenticated partner.","drawdowns:read":"Read partner drawdown resources.","drawdowns:write":"Create and prepare partner drawdowns.","repayments:read":"Read dues quotes and repayment resources.","repayments:write":"Create and prepare repayments.","closures:read":"Read facility closure dues and closure resources.","closures:write":"Create and prepare facility closures."}}}}},"parameters":{"DrawdownId":{"name":"drawdown_id","in":"path","required":true,"description":"Stable Qiro identifier for one partner drawdown workflow.","schema":{"type":"string","pattern":"^drw_[A-Za-z0-9]+$"}},"CorrelationId":{"name":"X-Correlation-ID","in":"header","required":true,"description":"End-to-end request identifier. When the body contains `correlation_id`, both values must match.","schema":{"type":"string","minLength":1,"maxLength":128}}},"headers":{"CorrelationId":{"description":"Echo of the request correlation identifier.","schema":{"type":"string","minLength":1,"maxLength":128}}},"schemas":{"DrawdownPreparation":{"type":"object","additionalProperties":false,"required":["drawdown_id","status","expires_at","transaction"],"properties":{"drawdown_id":{"type":"string","pattern":"^drw_[A-Za-z0-9]+$"},"status":{"type":"string","const":"SUBMITTING"},"expires_at":{"type":"string","format":"date-time"},"transaction":{"$ref":"#/components/schemas/UnsignedTransaction"}}},"UnsignedTransaction":{"type":"object","additionalProperties":false,"required":["chain_id","to","data","value"],"properties":{"chain_id":{"type":"integer","minimum":1},"to":{"$ref":"#/components/schemas/EvmAddress"},"data":{"type":"string","pattern":"^0x(?:[a-fA-F0-9]{2})*$"},"value":{"$ref":"#/components/schemas/UnsignedIntegerString"}}},"EvmAddress":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$"},"UnsignedIntegerString":{"type":"string","pattern":"^(0|[1-9]\\d*)$"},"ErrorResponse":{"type":"object","additionalProperties":false,"required":["error"],"properties":{"error":{"type":"object","additionalProperties":false,"required":["code","message"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code."},"message":{"type":"string","description":"Safe human-readable explanation."},"request_id":{"type":"string"},"correlation_id":{"type":"string"},"retryable":{"type":"boolean"},"details":{"type":"object","additionalProperties":true},"issues":{"type":"array","items":{"type":"string"}}}}}}},"responses":{"BadRequest":{"description":"Invalid schema, field format, or correlation identifier.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Unauthorized":{"description":"The bearer token is missing, invalid, or expired.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Forbidden":{"description":"The authenticated partner does not own the resource or lacks the required scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"DrawdownNotFound":{"description":"The drawdown was not found for the authenticated partner.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"ResourceConflict":{"description":"Idempotency, workflow state, or verified facility identity conflicts with the request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"EligibilityRejected":{"description":"The request is valid but rejected by facility, policy, liquidity, or contract rules.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"ServiceUnavailable":{"description":"Contract, RPC, subgraph, or reconciliation infrastructure is temporarily unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/v1/drawdowns/{drawdown_id}/prepare":{"post":{"tags":["Drawdowns"],"operationId":"prepareDrawdown","summary":"Prepare the borrower transaction","description":"Returns unsigned calldata only while the drawdown is `READY_FOR_SUBMISSION`, or returns\nthe same unexpired stored preparation for an idempotent retry. Preparations are valid for\nten minutes.\nPreparation atomically moves the resource to `SUBMITTING` because the transaction\nmay be broadcast immediately after this response.\n\nThe partner signs and broadcasts the returned transaction using the designated wallet.\nQiro never receives a private key and this endpoint does not submit a blockchain\ntransaction. The Qiro SDK can perform preparation, wallet submission, and immediate\nreceipt verification as one client-side method.\n","parameters":[{"$ref":"#/components/parameters/DrawdownId"},{"$ref":"#/components/parameters/CorrelationId"}],"responses":{"200":{"description":"A short-lived unsigned transaction bound to the approved facility and wallet.","headers":{"X-Correlation-ID":{"$ref":"#/components/headers/CorrelationId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DrawdownPreparation"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/DrawdownNotFound"},"409":{"$ref":"#/components/responses/ResourceConflict"},"422":{"$ref":"#/components/responses/EligibilityRejected"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}}}}
```
