For the complete documentation index, see llms.txt. This page is also available as Markdown.

Create an atomic repay-and-close facility closure

Reads fresh contract-backed obligations, creates a durable idempotent closure, blocks new drawdowns, and returns the first unsigned action in the same response. A prior closure-dues preview is optional. Partners do not supply closure_dues_id, amount, wallet, chain, contract, or allocation. The eventual borrower transaction repays every outstanding drawdown and closes the LOC atomically.

post
Required scopes
This endpoint requires the following scopes:
  • : Create and prepare facility closures.
Authorizations
OAuth2clientCredentialsRequired
Token URL:
Path parameters
facility_idstringRequired

Stable Qiro identifier for one approved LOC facility.

Example: fac_01J5T4K8D7X2Pattern: ^fac_[A-Za-z0-9]+$
Header parameters
X-Correlation-IDstring · min: 1 · max: 128Optional

Optional end-to-end request identifier. The SDK supplies one automatically; Qiro generates and echoes one when absent.

Example: cor_repayment_123
X-Idempotency-Keystring · uuidRequired

UUID protecting a money-sensitive operation from duplicate execution. Qiro SDK methods generate and reuse it automatically.

Example: 4c61128a-25c1-4f5f-9490-65e09bc93633
Responses
201

Facility closure resource and first unsigned action created.

application/json
post/v1/facilities/{facility_id}/closures
POST /v1/facilities/{facility_id}/closures HTTP/1.1
Authorization: Bearer YOUR_OAUTH2_TOKEN
X-Idempotency-Key: 123e4567-e89b-12d3-a456-426614174000
Accept: */*
{
  "closure": {
    "closure_id": "text",
    "facility_id": "text",
    "status": "READY_FOR_SUBMISSION",
    "repayment_asset": "USDC",
    "loc_address": "text",
    "token_address": "text",
    "token_decimals": 1,
    "active_drawdown_ids": [
      "text"
    ],
    "outstanding_drawdown_count": 1,
    "designated_wallet": {
      "wallet_id": "text",
      "wallet_version": 1
    },
    "latest_quoted_total": {
      "amount": "text",
      "amount_base_units": "text"
    },
    "latest_maximum_closure": {
      "amount": "text",
      "amount_base_units": "text"
    },
    "verified_allocation": {
      "total_paid_base_units": "text",
      "principal_paid_base_units": "text",
      "interest_paid_base_units": "text",
      "late_fees_paid_base_units": "text"
    },
    "correlation_id": "text",
    "failure": {
      "code": "text"
    },
    "blockchain_evidence": [
      {
        "event_name": "RepaymentMade",
        "chain_id": 1,
        "contract_address": "text",
        "transaction_hash": "text",
        "log_index": 1,
        "block_number": "text",
        "block_hash": "text",
        "observed_at": "2026-01-01T00:00:00.000Z",
        "total_amount_base_units": "text",
        "principal_paid_base_units": "text",
        "interest_paid_base_units": "text",
        "late_fees_paid_base_units": "text"
      }
    ],
    "created_at": "2026-01-01T00:00:00.000Z",
    "updated_at": "2026-01-01T00:00:00.000Z",
    "resource_version": 1
  },
  "preparation": {
    "closure_id": "text",
    "status": "READY_FOR_SUBMISSION",
    "action": "TOKEN_APPROVAL",
    "sequence": 1,
    "amount_base_units": "text",
    "maximum_closure_base_units": "text",
    "expires_at": "2026-01-01T00:00:00.000Z",
    "transaction": {
      "chain_id": 1,
      "to": "text",
      "data": "text",
      "value": "text"
    }
  }
}

Last updated