> For the complete documentation index, see [llms.txt](https://docs.creditcoop.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.creditcoop.xyz/developer-api-docs/credit-facilities.md).

# Credit Facilities

Credit facility management

## List credit facilities

> List enabled Credit Facilities. Authentication is required. Users see credit facilities for public orgs plus private orgs they have access to.

```json
{"openapi":"3.0.3","info":{"title":"Credit Coop API","version":"3.0.0"},"tags":[{"name":"Credit Facilities","description":"Credit facility management"}],"servers":[{"url":"https://api.creditcoop.xyz"}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]},{"OAuth2":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"API key in the format: cc_xxx_yyy (for customer API routes)"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Clerk authentication token (session JWT or Clerk OAuth access token) used by Credit Coop"},"OAuth2":{"type":"oauth2","flows":{"authorizationCode":{"authorizationUrl":"https://clerk.creditcoop.xyz/oauth/authorize","tokenUrl":"https://clerk.creditcoop.xyz/oauth/token","scopes":{"openid":"OpenID Connect","email":"User email","profile":"User profile"}}},"description":"Credit Coop OAuth"}},"schemas":{"CreditFacility":{"type":"object","required":["id","address","networkId","protocolVersion","label","organizationId"],"properties":{"id":{"type":"string","format":"uuid","description":"Credit facility unique identifier"},"address":{"type":"string","description":"SecuredLine contract address"},"networkId":{"type":"string","description":"CAIP-2 network identifier"},"protocolVersion":{"type":"string","nullable":true,"description":"Credit Coop protocol/contract generation (\"v1\", \"v2\", or \"v3\"). Determines which fields apply — several facility and credit-line fields are v3 only. Null when not classified."},"label":{"type":"string","nullable":true,"description":"Display label for the credit facility. Always present; null if not configured."},"organizationId":{"type":"string","format":"uuid","nullable":true,"description":"Borrower organization ID"},"organization":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/Organization"}],"description":"Organization details with links. Only included when expand includes \"organization\"."},"relatedAddresses":{"type":"object","nullable":true,"description":"On-chain related addresses. Only included when expand includes \"related-addresses\".","properties":{"spigot":{"type":"string","nullable":true,"description":"v1/v2 only. Spigot contract address. Captures and routes borrower revenue to debt repayment. Null for v3 facilities (no spigot layer)."},"borrower":{"type":"string","nullable":true,"description":"Address authorized to borrow, repay, and close credit lines. Present on all versions."},"admin":{"type":"string","nullable":true,"description":"v1/v2 only. Credit facility administrator address. Null for v3 facilities."},"spigotOperator":{"type":"string","nullable":true,"description":"v1/v2 only. Address authorized to execute revenue claims on the Spigot. Null for v3 facilities."},"escrow":{"type":"string","nullable":true,"description":"v2 only. Escrow contract address. Holds collateral posted by the borrower and enforces the minimum collateral ratio. Null for v1/v3 facilities (v3 collateral lives on the Servicing contract)."},"servicing":{"type":"string","nullable":true,"description":"v3 only. The facility's bound Servicing contract — the per-borrower hub for covenants, collateral, and cross-default. Null for v1/v2 facilities."},"servicingId":{"type":"string","format":"uuid","nullable":true,"description":"v3 only. Resource ID of the bound Servicing (use with GET /v3/servicings/:id). Null when the Servicing address is not registered, or for v1/v2 facilities."},"commitmentToken":{"type":"string","nullable":true,"description":"v3 only. The ERC-721 CommitmentToken singleton — the NFT contract representing every commitment/credit line in the facility (ownerOf(lineTokenId) is the lender). Facility-wide: the same contract for every line. Null for v1/v2 facilities (no commitment-NFT layer)."}}},"fees":{"type":"object","nullable":true,"description":"Fee configuration for the Credit Facility. Only included when expand includes \"fees\".","required":["originationFee","swapFee","servicingFee","drawFee","repayFee"],"properties":{"originationFee":{"type":"string","nullable":true,"description":"Origination fee (basis points). Present on v2 and v3."},"swapFee":{"type":"string","nullable":true,"description":"v2 only. Swap fee (basis points). Null for v3."},"servicingFee":{"type":"string","nullable":true,"description":"v2 only. Servicing fee (basis points). Null for v3."},"drawFee":{"type":"string","nullable":true,"description":"v3 only. Per-draw fee (basis points, FEE_DRAW). Null for v1/v2."},"repayFee":{"type":"string","nullable":true,"description":"v3 only. Per-repay fee (basis points, FEE_REPAY). Null for v1/v2."}}},"counts":{"type":"object","nullable":true,"description":"Active credit lines and open proposals counts. Only included when expand includes \"counts\".","required":["activeCreditLines","openProposals"],"properties":{"activeCreditLines":{"type":"integer","description":"Number of active credit lines"},"openProposals":{"type":"integer","description":"Number of open mutual consent proposals"}}},"status":{"type":"object","nullable":true,"description":"On-chain status for this facility. Only included when expand includes \"status\". An open facility may report LIQUIDATABLE when its borrower is in cross-default; once a facility is closed it reports REPAID and reflects only its own terminal outcome, never absorbing the borrower's wider default state. Borrower-wide default and covenant breach levels are reported per cross-default group on GET /v3/borrowers (expand=status).","required":["code","label","facilityClosed"],"properties":{"code":{"type":"integer","description":"Numeric status code (0: UNINITIALIZED, 1: ACTIVE, 2: LIQUIDATABLE, 3: REPAID, 4: INSOLVENT, 5: ABORTED)"},"label":{"type":"string","enum":["UNINITIALIZED","ACTIVE","LIQUIDATABLE","REPAID","INSOLVENT","ABORTED","UNKNOWN"],"description":"Human-readable status label. UNKNOWN is returned when the on-chain status code is outside the known range (e.g., a new status added by a future contract version)."},"facilityClosed":{"type":"boolean","description":"Whether this specific facility is closed (terminal). Always present whenever status is present (the entire status object is omitted when unavailable). For a closed facility code/label report REPAID; for an open facility they may additionally reflect borrower-wide cross-default (LIQUIDATABLE)."}}},"collateral":{"type":"object","nullable":true,"description":"On-chain collateral state from the Escrow contract. Only included when expand includes \"collateral\". Null when the facility has no escrow, RPC is unavailable, or the facility predates the Escrow architecture.","required":["maxLtvBps","totalOutstandingDebt","collateralValue","ltvBps","targetLtvBps","collateralTokens"],"properties":{"maxLtvBps":{"type":"string","nullable":true,"description":"Maximum loan-to-value ratio allowed for this facility, in basis points (10000 = 100%). Computed server-side as 10000² / minimumCollateralRatio (integer floor). Null when the facility does not enforce a collateral requirement."},"totalOutstandingDebt":{"type":"string","nullable":true,"description":"Total outstanding debt in USD as a formatted decimal string with trailing zeros trimmed (e.g. \"1234.56\"). The debt token's decimals are read from the first active credit position and applied server-side. \"0\" when there are no active positions. Null when the facility does not enforce a collateral requirement."},"collateralValue":{"type":"string","nullable":true,"description":"Collateral value in USD as a formatted decimal string with trailing zeros trimmed (e.g. \"2000\" or \"1999.99\"). Formatted server-side. Null when the facility does not enforce a collateral requirement."},"ltvBps":{"type":"string","nullable":true,"description":"Current loan-to-value ratio in basis points: (totalOutstandingDebt × 10000) / collateralValue, computed server-side from raw on-chain values (decimals normalized before division). \"0\" when there is no outstanding debt. \"999999999\" (sentinel) when debt is positive but on-chain collateral value is 0 — the facility is effectively infinitely undercollateralized. Null when the facility does not enforce a collateral requirement, or when debt decimals could not be resolved."},"targetLtvBps":{"type":"string","nullable":true,"description":"Target LTV in basis points. Defines the minimum collateral value required to back the facility's credit limit (min collateral ≈ creditLimit × 10000 / targetLtvBps). Null when no target is configured for this facility."},"collateralTokens":{"type":"array","description":"Every token ever enabled as collateral on the Escrow, with its current on-chain amount and USD value. May be empty if EnableCollateral events have not been ingested for this Escrow.","items":{"type":"object","required":["address","amount","decimals","usdValue"],"properties":{"address":{"type":"string","description":"Collateral token address (ERC-20)."},"amount":{"type":"string","nullable":true,"description":"Current on-chain collateral amount (raw uint256; divide by `decimals` to get human-readable value). Null if the on-chain `getCollateralData` read failed."},"decimals":{"type":"integer","nullable":true,"description":"Decimals of the collateral token itself (for rendering `amount`). Null if ERC-20 metadata could not be fetched."},"usdValue":{"type":"string","nullable":true,"description":"USD value of the current collateral amount as a human-readable decimal string (e.g. \"1234.56\"), up to 6 decimal places with trailing zeros trimmed. Null if amount, price, or decimals is unavailable."}}}}}},"totals":{"type":"object","nullable":true,"description":"v3 only. Facility-level aggregates for the facility's single asset: native-unit amounts plus `creditLimitUsd` (the total credit limit in USD). Only included when expand includes \"totals\". Null for v1/v2 facilities — their credit lines can use different tokens, so a single-asset total (and one `decimals`) is not meaningful (use the USD totals on GET /v3/credit-facilities/{id}/credit-lines instead). Also null for a v3 facility when the on-chain read is unavailable; use protocolVersion to distinguish the two cases.","required":["totalCommitment","totalDrawn","drawnRate","undrawnRate","token","decimals","creditLimitUsd"],"properties":{"totalCommitment":{"type":"string","nullable":true,"description":"The facility's total committed credit across its active credit lines, raw uint256 — divide by 10^decimals for a human-readable value. Closed lines no longer count toward the commitment."},"creditLimitUsd":{"type":"string","nullable":true,"description":"The facility's total credit limit in USD — totalCommitment priced in `token` at request time, as a human-readable decimal string. Null when totalCommitment is null, decimals is unavailable, or the token is unpriced. (For v1/v2, use creditLimitUsd on GET /v3/credit-facilities/{id}/credit-lines instead.)"},"totalDrawn":{"type":"string","nullable":true,"description":"The facility's total drawn principal across its credit lines, raw uint256 — divide by 10^decimals for a human-readable value."},"drawnRate":{"type":"string","nullable":true,"description":"Facility-default draw rate in basis points (DRAWN_RATE_BPS) — interest on drawn principal. Individual commitments may override this; see each credit line's drawRate for the effective per-line rate. Null if the facility exposes no per-facility rate getter (e.g. TIERED)."},"undrawnRate":{"type":"string","nullable":true,"description":"Facility-default undrawn rate in basis points (UNDRAWN_RATE_BPS) — interest on the undrawn commitment. Individual commitments may override this; see each credit line's facilityRate for the effective per-line rate. Null if the facility exposes no per-facility rate getter (e.g. TIERED)."},"token":{"type":"string","nullable":true,"description":"The single ERC-20 asset every credit line in the facility is denominated in — the unit of totalCommitment and totalDrawn."},"decimals":{"type":"integer","nullable":true,"description":"Decimals of the facility asset (token), for formatting the raw amounts above."}}}}},"Organization":{"type":"object","required":["id","name","slug"],"properties":{"id":{"type":"string","format":"uuid","description":"Organization unique identifier"},"name":{"type":"string","maxLength":255,"description":"Organization display name"},"slug":{"type":"string","maxLength":100,"description":"URL-friendly identifier"},"header":{"type":"string","nullable":true,"description":"Short tagline or headline for the organization profile"},"description":{"type":"string","nullable":true,"description":"Brief summary of the organization"},"overview":{"type":"string","nullable":true,"description":"Long-form organization description (may contain Markdown)"},"links":{"type":"array","description":"Organization links and image assets. Labels starting with \"#\" are image assets (e.g. \"#logo\", \"#header\"); all others are external links (e.g. \"Twitter\", \"Website\").","items":{"type":"object","required":["id","label","url"],"properties":{"id":{"type":"string","format":"uuid","description":"Link unique identifier"},"label":{"type":"string","description":"Link type. \"#logo\" and \"#header\" denote image assets; other values (e.g. \"Twitter\", \"Website\") denote external links."},"linkText":{"type":"string","nullable":true,"description":"Display text for external links (e.g. \"@raincards\", \"rain.xyz\")"},"iconUrl":{"type":"string","nullable":true,"description":"Icon image URL for external links"},"url":{"type":"string","description":"Target URL (image URL for asset links, destination URL for external links)"}}}}}},"Pagination":{"type":"object","required":["total","limit","offset"],"properties":{"total":{"type":"integer","description":"Total number of records matching the query"},"limit":{"type":"integer","description":"Maximum number of records returned per page"},"offset":{"type":"integer","description":"Number of records skipped from the start"}}},"ErrorResponse":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"integer"}}}}},"paths":{"/v3/credit-facilities":{"get":{"operationId":"listCreditFacilities","summary":"List credit facilities","tags":["Credit Facilities"],"description":"List enabled Credit Facilities. Authentication is required. Users see credit facilities for public orgs plus private orgs they have access to.","parameters":[{"schema":{"type":"string","maxLength":36,"format":"uuid"},"in":"query","name":"organizationId","required":false,"description":"Filter by borrower organization ID. Example: 550e8400-e29b-41d4-a716-446655440000"},{"schema":{"type":"string","maxLength":100},"in":"query","name":"address","required":false,"description":"Filter by credit facility address. Case-insensitive when networkId is omitted or is an EVM chain (eip155:*), case-sensitive otherwise."},{"schema":{"type":"string","maxLength":50},"in":"query","name":"networkId","required":false,"description":"Filter by network ID (CAIP-2 blockchain ID), e.g., `eip155:1` (Ethereum), `eip155:137` (Polygon), `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp` (Solana)"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"limit","required":false},{"schema":{"type":"integer","minimum":0,"default":0},"in":"query","name":"offset","required":false},{"schema":{"type":"array","style":"form","explode":false,"items":{"type":"string","enum":["related-addresses","fees","organization","counts","status","collateral"]}},"in":"query","name":"expand","required":false,"description":"Comma-separated list of fields to expand. Valid values: \"related-addresses\" (fetches on-chain addresses: spigot, borrower, admin, spigotOperator, escrow, servicing (v3 only)), \"fees\" (fetches fee configuration: originationFee, swapFee + servicingFee (v2 only), drawFee + repayFee (v3 only)), \"organization\" (includes full organization object with links), \"counts\" (fetches activeCreditLines and openProposals), \"status\" (fetches on-chain contract status), \"collateral\" (fetches on-chain collateral state: maxLtvBps, collateralValue, totalOutstandingDebt, ltvBps, collateralTokens[])."}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","required":["creditFacilities","pagination"],"properties":{"creditFacilities":{"type":"array","items":{"$ref":"#/components/schemas/CreditFacility"}},"pagination":{"$ref":"#/components/schemas/Pagination"}}}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```

## Get credit facility by ID

> Get a single Credit Facility by ID. Authentication is required.

```json
{"openapi":"3.0.3","info":{"title":"Credit Coop API","version":"3.0.0"},"tags":[{"name":"Credit Facilities","description":"Credit facility management"}],"servers":[{"url":"https://api.creditcoop.xyz"}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]},{"OAuth2":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"API key in the format: cc_xxx_yyy (for customer API routes)"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Clerk authentication token (session JWT or Clerk OAuth access token) used by Credit Coop"},"OAuth2":{"type":"oauth2","flows":{"authorizationCode":{"authorizationUrl":"https://clerk.creditcoop.xyz/oauth/authorize","tokenUrl":"https://clerk.creditcoop.xyz/oauth/token","scopes":{"openid":"OpenID Connect","email":"User email","profile":"User profile"}}},"description":"Credit Coop OAuth"}},"schemas":{"CreditFacility":{"type":"object","required":["id","address","networkId","protocolVersion","label","organizationId"],"properties":{"id":{"type":"string","format":"uuid","description":"Credit facility unique identifier"},"address":{"type":"string","description":"SecuredLine contract address"},"networkId":{"type":"string","description":"CAIP-2 network identifier"},"protocolVersion":{"type":"string","nullable":true,"description":"Credit Coop protocol/contract generation (\"v1\", \"v2\", or \"v3\"). Determines which fields apply — several facility and credit-line fields are v3 only. Null when not classified."},"label":{"type":"string","nullable":true,"description":"Display label for the credit facility. Always present; null if not configured."},"organizationId":{"type":"string","format":"uuid","nullable":true,"description":"Borrower organization ID"},"organization":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/Organization"}],"description":"Organization details with links. Only included when expand includes \"organization\"."},"relatedAddresses":{"type":"object","nullable":true,"description":"On-chain related addresses. Only included when expand includes \"related-addresses\".","properties":{"spigot":{"type":"string","nullable":true,"description":"v1/v2 only. Spigot contract address. Captures and routes borrower revenue to debt repayment. Null for v3 facilities (no spigot layer)."},"borrower":{"type":"string","nullable":true,"description":"Address authorized to borrow, repay, and close credit lines. Present on all versions."},"admin":{"type":"string","nullable":true,"description":"v1/v2 only. Credit facility administrator address. Null for v3 facilities."},"spigotOperator":{"type":"string","nullable":true,"description":"v1/v2 only. Address authorized to execute revenue claims on the Spigot. Null for v3 facilities."},"escrow":{"type":"string","nullable":true,"description":"v2 only. Escrow contract address. Holds collateral posted by the borrower and enforces the minimum collateral ratio. Null for v1/v3 facilities (v3 collateral lives on the Servicing contract)."},"servicing":{"type":"string","nullable":true,"description":"v3 only. The facility's bound Servicing contract — the per-borrower hub for covenants, collateral, and cross-default. Null for v1/v2 facilities."},"servicingId":{"type":"string","format":"uuid","nullable":true,"description":"v3 only. Resource ID of the bound Servicing (use with GET /v3/servicings/:id). Null when the Servicing address is not registered, or for v1/v2 facilities."},"commitmentToken":{"type":"string","nullable":true,"description":"v3 only. The ERC-721 CommitmentToken singleton — the NFT contract representing every commitment/credit line in the facility (ownerOf(lineTokenId) is the lender). Facility-wide: the same contract for every line. Null for v1/v2 facilities (no commitment-NFT layer)."}}},"fees":{"type":"object","nullable":true,"description":"Fee configuration for the Credit Facility. Only included when expand includes \"fees\".","required":["originationFee","swapFee","servicingFee","drawFee","repayFee"],"properties":{"originationFee":{"type":"string","nullable":true,"description":"Origination fee (basis points). Present on v2 and v3."},"swapFee":{"type":"string","nullable":true,"description":"v2 only. Swap fee (basis points). Null for v3."},"servicingFee":{"type":"string","nullable":true,"description":"v2 only. Servicing fee (basis points). Null for v3."},"drawFee":{"type":"string","nullable":true,"description":"v3 only. Per-draw fee (basis points, FEE_DRAW). Null for v1/v2."},"repayFee":{"type":"string","nullable":true,"description":"v3 only. Per-repay fee (basis points, FEE_REPAY). Null for v1/v2."}}},"counts":{"type":"object","nullable":true,"description":"Active credit lines and open proposals counts. Only included when expand includes \"counts\".","required":["activeCreditLines","openProposals"],"properties":{"activeCreditLines":{"type":"integer","description":"Number of active credit lines"},"openProposals":{"type":"integer","description":"Number of open mutual consent proposals"}}},"status":{"type":"object","nullable":true,"description":"On-chain status for this facility. Only included when expand includes \"status\". An open facility may report LIQUIDATABLE when its borrower is in cross-default; once a facility is closed it reports REPAID and reflects only its own terminal outcome, never absorbing the borrower's wider default state. Borrower-wide default and covenant breach levels are reported per cross-default group on GET /v3/borrowers (expand=status).","required":["code","label","facilityClosed"],"properties":{"code":{"type":"integer","description":"Numeric status code (0: UNINITIALIZED, 1: ACTIVE, 2: LIQUIDATABLE, 3: REPAID, 4: INSOLVENT, 5: ABORTED)"},"label":{"type":"string","enum":["UNINITIALIZED","ACTIVE","LIQUIDATABLE","REPAID","INSOLVENT","ABORTED","UNKNOWN"],"description":"Human-readable status label. UNKNOWN is returned when the on-chain status code is outside the known range (e.g., a new status added by a future contract version)."},"facilityClosed":{"type":"boolean","description":"Whether this specific facility is closed (terminal). Always present whenever status is present (the entire status object is omitted when unavailable). For a closed facility code/label report REPAID; for an open facility they may additionally reflect borrower-wide cross-default (LIQUIDATABLE)."}}},"collateral":{"type":"object","nullable":true,"description":"On-chain collateral state from the Escrow contract. Only included when expand includes \"collateral\". Null when the facility has no escrow, RPC is unavailable, or the facility predates the Escrow architecture.","required":["maxLtvBps","totalOutstandingDebt","collateralValue","ltvBps","targetLtvBps","collateralTokens"],"properties":{"maxLtvBps":{"type":"string","nullable":true,"description":"Maximum loan-to-value ratio allowed for this facility, in basis points (10000 = 100%). Computed server-side as 10000² / minimumCollateralRatio (integer floor). Null when the facility does not enforce a collateral requirement."},"totalOutstandingDebt":{"type":"string","nullable":true,"description":"Total outstanding debt in USD as a formatted decimal string with trailing zeros trimmed (e.g. \"1234.56\"). The debt token's decimals are read from the first active credit position and applied server-side. \"0\" when there are no active positions. Null when the facility does not enforce a collateral requirement."},"collateralValue":{"type":"string","nullable":true,"description":"Collateral value in USD as a formatted decimal string with trailing zeros trimmed (e.g. \"2000\" or \"1999.99\"). Formatted server-side. Null when the facility does not enforce a collateral requirement."},"ltvBps":{"type":"string","nullable":true,"description":"Current loan-to-value ratio in basis points: (totalOutstandingDebt × 10000) / collateralValue, computed server-side from raw on-chain values (decimals normalized before division). \"0\" when there is no outstanding debt. \"999999999\" (sentinel) when debt is positive but on-chain collateral value is 0 — the facility is effectively infinitely undercollateralized. Null when the facility does not enforce a collateral requirement, or when debt decimals could not be resolved."},"targetLtvBps":{"type":"string","nullable":true,"description":"Target LTV in basis points. Defines the minimum collateral value required to back the facility's credit limit (min collateral ≈ creditLimit × 10000 / targetLtvBps). Null when no target is configured for this facility."},"collateralTokens":{"type":"array","description":"Every token ever enabled as collateral on the Escrow, with its current on-chain amount and USD value. May be empty if EnableCollateral events have not been ingested for this Escrow.","items":{"type":"object","required":["address","amount","decimals","usdValue"],"properties":{"address":{"type":"string","description":"Collateral token address (ERC-20)."},"amount":{"type":"string","nullable":true,"description":"Current on-chain collateral amount (raw uint256; divide by `decimals` to get human-readable value). Null if the on-chain `getCollateralData` read failed."},"decimals":{"type":"integer","nullable":true,"description":"Decimals of the collateral token itself (for rendering `amount`). Null if ERC-20 metadata could not be fetched."},"usdValue":{"type":"string","nullable":true,"description":"USD value of the current collateral amount as a human-readable decimal string (e.g. \"1234.56\"), up to 6 decimal places with trailing zeros trimmed. Null if amount, price, or decimals is unavailable."}}}}}},"totals":{"type":"object","nullable":true,"description":"v3 only. Facility-level aggregates for the facility's single asset: native-unit amounts plus `creditLimitUsd` (the total credit limit in USD). Only included when expand includes \"totals\". Null for v1/v2 facilities — their credit lines can use different tokens, so a single-asset total (and one `decimals`) is not meaningful (use the USD totals on GET /v3/credit-facilities/{id}/credit-lines instead). Also null for a v3 facility when the on-chain read is unavailable; use protocolVersion to distinguish the two cases.","required":["totalCommitment","totalDrawn","drawnRate","undrawnRate","token","decimals","creditLimitUsd"],"properties":{"totalCommitment":{"type":"string","nullable":true,"description":"The facility's total committed credit across its active credit lines, raw uint256 — divide by 10^decimals for a human-readable value. Closed lines no longer count toward the commitment."},"creditLimitUsd":{"type":"string","nullable":true,"description":"The facility's total credit limit in USD — totalCommitment priced in `token` at request time, as a human-readable decimal string. Null when totalCommitment is null, decimals is unavailable, or the token is unpriced. (For v1/v2, use creditLimitUsd on GET /v3/credit-facilities/{id}/credit-lines instead.)"},"totalDrawn":{"type":"string","nullable":true,"description":"The facility's total drawn principal across its credit lines, raw uint256 — divide by 10^decimals for a human-readable value."},"drawnRate":{"type":"string","nullable":true,"description":"Facility-default draw rate in basis points (DRAWN_RATE_BPS) — interest on drawn principal. Individual commitments may override this; see each credit line's drawRate for the effective per-line rate. Null if the facility exposes no per-facility rate getter (e.g. TIERED)."},"undrawnRate":{"type":"string","nullable":true,"description":"Facility-default undrawn rate in basis points (UNDRAWN_RATE_BPS) — interest on the undrawn commitment. Individual commitments may override this; see each credit line's facilityRate for the effective per-line rate. Null if the facility exposes no per-facility rate getter (e.g. TIERED)."},"token":{"type":"string","nullable":true,"description":"The single ERC-20 asset every credit line in the facility is denominated in — the unit of totalCommitment and totalDrawn."},"decimals":{"type":"integer","nullable":true,"description":"Decimals of the facility asset (token), for formatting the raw amounts above."}}}}},"Organization":{"type":"object","required":["id","name","slug"],"properties":{"id":{"type":"string","format":"uuid","description":"Organization unique identifier"},"name":{"type":"string","maxLength":255,"description":"Organization display name"},"slug":{"type":"string","maxLength":100,"description":"URL-friendly identifier"},"header":{"type":"string","nullable":true,"description":"Short tagline or headline for the organization profile"},"description":{"type":"string","nullable":true,"description":"Brief summary of the organization"},"overview":{"type":"string","nullable":true,"description":"Long-form organization description (may contain Markdown)"},"links":{"type":"array","description":"Organization links and image assets. Labels starting with \"#\" are image assets (e.g. \"#logo\", \"#header\"); all others are external links (e.g. \"Twitter\", \"Website\").","items":{"type":"object","required":["id","label","url"],"properties":{"id":{"type":"string","format":"uuid","description":"Link unique identifier"},"label":{"type":"string","description":"Link type. \"#logo\" and \"#header\" denote image assets; other values (e.g. \"Twitter\", \"Website\") denote external links."},"linkText":{"type":"string","nullable":true,"description":"Display text for external links (e.g. \"@raincards\", \"rain.xyz\")"},"iconUrl":{"type":"string","nullable":true,"description":"Icon image URL for external links"},"url":{"type":"string","description":"Target URL (image URL for asset links, destination URL for external links)"}}}}}},"ErrorResponse":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"integer"}}}}},"paths":{"/v3/credit-facilities/{id}":{"get":{"operationId":"getCreditFacility","summary":"Get credit facility by ID","tags":["Credit Facilities"],"description":"Get a single Credit Facility by ID. Authentication is required.","parameters":[{"schema":{"type":"array","style":"form","explode":false,"items":{"type":"string","enum":["related-addresses","fees","organization","counts","status","collateral","totals"]}},"in":"query","name":"expand","required":false,"description":"Comma-separated list of fields to expand. Valid values: \"related-addresses\" (fetches on-chain addresses: spigot, borrower, admin, spigotOperator, escrow, servicing + commitmentToken (v3 only)), \"fees\" (fetches fee configuration: originationFee, swapFee + servicingFee (v2 only), drawFee + repayFee (v3 only)), \"organization\" (includes full organization object with links), \"counts\" (fetches activeCreditLines and openProposals), \"status\" (fetches on-chain contract status), \"collateral\" (fetches on-chain collateral state: maxLtvBps, collateralValue, totalOutstandingDebt, ltvBps, collateralTokens[]), \"totals\" (v3 only. fetches facility-level native-unit aggregates: totalCommitment, totalDrawn, drawnRate, undrawnRate, token, decimals. Null for v1/v2 facilities.)."},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true,"description":"Credit Facility ID. Example: 550e8400-e29b-41d4-a716-446655440000"}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditFacility"}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```

## Get credit facility credit lines

> Get credit lines for a Credit Facility. Authentication is required.

```json
{"openapi":"3.0.3","info":{"title":"Credit Coop API","version":"3.0.0"},"tags":[{"name":"Credit Facilities","description":"Credit facility management"}],"servers":[{"url":"https://api.creditcoop.xyz"}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]},{"OAuth2":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"API key in the format: cc_xxx_yyy (for customer API routes)"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Clerk authentication token (session JWT or Clerk OAuth access token) used by Credit Coop"},"OAuth2":{"type":"oauth2","flows":{"authorizationCode":{"authorizationUrl":"https://clerk.creditcoop.xyz/oauth/authorize","tokenUrl":"https://clerk.creditcoop.xyz/oauth/token","scopes":{"openid":"OpenID Connect","email":"User email","profile":"User profile"}}},"description":"Credit Coop OAuth"}},"schemas":{"CreditLine":{"type":"object","required":["lineTokenId"],"properties":{"lineTokenId":{"type":"string","description":"Credit line token ID"},"deposit":{"type":"string","nullable":true,"description":"Deposit amount (raw uint256 — divide by 10^decimals to get human-readable value)"},"creditLimit":{"type":"string","nullable":true,"description":"Credit limit (raw uint256 — divide by 10^decimals to get human-readable value). For open lines: equals current deposit. For closed lines: deposit from the most recent AddCredit or IncreaseCredit event."},"principal":{"type":"string","nullable":true,"description":"Principal amount borrowed (raw uint256 — divide by 10^decimals to get human-readable value)"},"interestBalance":{"type":"string","nullable":true,"description":"Total interest held by the credit line: the sum of interestAccrued and interestRepaid (raw uint256 — divide by 10^decimals to get human-readable value). v3: equals interestAccrued (repaid proceeds are reported via the claimable field)."},"interestAccrued":{"type":"string","nullable":true,"description":"Interest accrued and owed by the borrower but not yet repaid (raw uint256 — divide by 10^decimals to get human-readable value). v3: equals interestBalance."},"interestRepaid":{"type":"string","nullable":true,"description":"Interest already repaid into the credit line and held for the lender to claim/withdraw (raw uint256 — divide by 10^decimals to get human-readable value). Null for v3 — repaid proceeds are reported in aggregate (principal + interest) via the claimable field."},"token":{"type":"string","nullable":true,"description":"Token address for this credit line"},"decimals":{"type":"integer","nullable":true,"description":"Token decimals"},"isOpen":{"type":"boolean","nullable":true,"description":"Whether the credit line is open"},"isRestricted":{"type":"boolean","nullable":true,"description":"Whether the credit line is restricted. Null for v3 (no equivalent)."},"earlyWithdrawalFee":{"type":"string","nullable":true,"description":"Early withdrawal fee in basis points. Null for v3 (no equivalent)."},"deadline":{"type":"string","format":"date-time","nullable":true,"description":"Credit line deadline"},"drawRate":{"type":"string","nullable":true,"description":"Draw rate in basis points (interest rate on borrowed principal)"},"facilityRate":{"type":"string","nullable":true,"description":"Facility rate in basis points (interest rate on unused deposit)"},"apyPct":{"type":"number","nullable":true,"description":"Computed APY as a percentage (e.g. 5.0 = 5.0%). Weighted average of drawRate on principal and facilityRate on unused deposit."},"createdTxHash":{"type":"string","nullable":true,"description":"Transaction hash of the AddCredit event that created this line"},"createdBlockNumber":{"type":"integer","nullable":true,"description":"Block number when this credit line was created"},"createdAt":{"type":"string","format":"date-time","nullable":true,"description":"Timestamp when this credit line was created. May be null for refinanced commitments."},"commitmentValue":{"type":"string","nullable":true,"description":"v3 only. Canonical par value of the commitment (drawn + interestOwed + claimable + undrawn residual), raw uint256. Null for v2. As of the last on-chain accrual checkpoint."},"claimable":{"type":"string","nullable":true,"description":"v3 only. Repaid/closed proceeds currently claimable by the commitment owner, raw uint256. Null for v2."},"facilityType":{"type":"string","nullable":true,"description":"v3 only. Facility type (\"RCF\" | \"TLA\" | \"DDTL\" | \"TIERED\"). Null for v2."},"isDefaulted":{"type":"boolean","nullable":true,"description":"v3 only. Cross-default (impairment) flag for the position's borrower. Null for v2."},"priority":{"type":"string","nullable":true,"description":"v3 only. Repayment-queue seniority of this commitment (raw uint256; the on-chain terms.priority). Sort by it client-side if you need a strict seniority ordering — the array is not guaranteed to be priority-sorted. Closed lines report `0` (on-chain storage is cleared on close), so drop closed lines before sorting. Null for v1/v2."},"fees":{"type":"object","nullable":true,"description":"Only included when expand=fees is specified. Null if fetching failed.","required":["originationFees"],"properties":{"originationFees":{"type":"string","nullable":true,"description":"Origination fees for this credit line (raw uint256 — divide by 10^decimals to get human-readable value). Null if unavailable."}}},"error":{"type":"string","nullable":true,"description":"Error message if fetching this credit line failed. Other fields will be null."}}},"ErrorResponse":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"integer"}}}}},"paths":{"/v3/credit-facilities/{id}/credit-lines":{"get":{"operationId":"getCreditFacilityCreditLines","summary":"Get credit facility credit lines","tags":["Credit Facilities"],"description":"Get credit lines for a Credit Facility. Authentication is required.","parameters":[{"schema":{"type":"array","style":"form","explode":false,"items":{"type":"string","enum":["related-addresses","fees"]}},"in":"query","name":"expand","required":false,"description":"Comma-separated list of fields to expand. Valid values: \"related-addresses\" (includes relatedAddresses object with lender, vault, vaultCurator on each credit line), \"fees\" (includes fees object with originationFees on each credit line)."},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true,"description":"Credit Facility ID. Example: 550e8400-e29b-41d4-a716-446655440000"}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","required":["facilityId","facilityAddress","networkId","activeCount","totalCount","creditLines","totals"],"properties":{"facilityId":{"type":"string","description":"Credit Facility UUID"},"facilityAddress":{"type":"string","description":"Credit facility contract address"},"networkId":{"type":"string","description":"CAIP-2 network identifier (e.g. eip155:8453)"},"activeCount":{"type":"integer","description":"Number of active credit lines"},"totalCount":{"type":"integer","description":"Total number of credit lines"},"relatedAddresses":{"type":"object","nullable":true,"description":"Facility-level on-chain addresses (distinct from each credit line's own relatedAddresses). Only included when expand includes \"related-addresses\".","required":["commitmentToken"],"properties":{"commitmentToken":{"type":"string","nullable":true,"description":"v3 only. The ERC-721 CommitmentToken singleton — the NFT contract representing every commitment/credit line in the facility (ownerOf(lineTokenId) is the lender). Facility-wide: the same contract for every line. Null for v1/v2 facilities."}}},"fees":{"type":"object","nullable":true,"description":"Fee configuration for the credit facility. Null if fees could not be fetched.","required":["originationFee","swapFee","servicingFee","drawFee","repayFee"],"properties":{"originationFee":{"type":"string","nullable":true,"description":"Origination fee (basis points). Present on v2 and v3."},"swapFee":{"type":"string","nullable":true,"description":"v2 only. Swap fee (basis points). Null for v3."},"servicingFee":{"type":"string","nullable":true,"description":"v2 only. Servicing fee (basis points). Null for v3."},"drawFee":{"type":"string","nullable":true,"description":"v3 only. Per-draw fee (basis points, FEE_DRAW). Null for v1/v2."},"repayFee":{"type":"string","nullable":true,"description":"v3 only. Per-repay fee (basis points, FEE_REPAY). Null for v1/v2."}}},"creditLines":{"type":"array","description":"Credit lines ordered by repayment queue position (first item is repaid first)","items":{"allOf":[{"$ref":"#/components/schemas/CreditLine"},{"type":"object","properties":{"relatedAddresses":{"type":"object","nullable":true,"description":"Related addresses for this credit line. Only included when expand=related-addresses is specified. Contains lender, vault, and vaultCurator addresses. Null if fetching failed.","required":["lender"],"properties":{"lender":{"type":"string","description":"Lender address (owner of the credit line NFT)"},"vault":{"type":"string","nullable":true,"description":"Lending vault address associated with the lender"},"vaultCurator":{"type":"string","nullable":true,"description":"Vault curator address for the lender"}}}}}]}},"totals":{"type":"object","required":["depositUsd","principalUsd","interestAccruedUsd","interestRepaidUsd","interestBalanceUsd","creditLimitUsd"],"description":"Aggregated totals in USD. depositUsd/principalUsd/interestAccruedUsd/interestRepaidUsd/interestBalanceUsd cover all non-errored credit lines (open + closed) — closed lines can still hold non-zero balances on-chain. creditLimitUsd covers OPEN lines only because closed-line creditLimit is the historical authorised credit at close, not an active obligation. apyPct is the USD-deposit-weighted average across open lines. Any USD field is null if a contributing line lacks a USD price.","properties":{"depositUsd":{"type":"string","nullable":true,"description":"Sum across all non-errored lines (open + closed) of deposit converted to USD."},"principalUsd":{"type":"string","nullable":true,"description":"Sum across all non-errored lines (open + closed) of outstanding principal converted to USD."},"interestAccruedUsd":{"type":"string","nullable":true,"description":"Sum across all non-errored lines (open + closed) of accrued interest converted to USD."},"interestRepaidUsd":{"type":"string","nullable":true,"description":"Sum across all non-errored lines (open + closed) of repaid interest converted to USD."},"interestBalanceUsd":{"type":"string","nullable":true,"description":"Sum across all non-errored lines (open + closed) of interest balance converted to USD. Open lines: accrued + repaid. Closed lines: repaid only."},"creditLimitUsd":{"type":"string","nullable":true,"description":"Sum across OPEN credit lines only of creditLimit converted to USD. Closed lines are excluded because their creditLimit is the historical authorised credit at close, not an active obligation."},"apyPct":{"type":"number","nullable":true,"description":"USD-deposit-weighted average APY across open lines (e.g. 5.0 = 5.0%). For multi-token facilities the weighting is in USD so each line contributes proportionally to its USD exposure. Falls back to raw-deposit-weighted APY (with drawRate fallback) when no open line has a priced non-zero deposit. Null if no APY can be derived."}}}}}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```

## Get credit facility proposals

> Get mutual consent proposals for a Credit Facility. Authentication is required.

```json
{"openapi":"3.0.3","info":{"title":"Credit Coop API","version":"3.0.0"},"tags":[{"name":"Credit Facilities","description":"Credit facility management"}],"servers":[{"url":"https://api.creditcoop.xyz"}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]},{"OAuth2":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"API key in the format: cc_xxx_yyy (for customer API routes)"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Clerk authentication token (session JWT or Clerk OAuth access token) used by Credit Coop"},"OAuth2":{"type":"oauth2","flows":{"authorizationCode":{"authorizationUrl":"https://clerk.creditcoop.xyz/oauth/authorize","tokenUrl":"https://clerk.creditcoop.xyz/oauth/token","scopes":{"openid":"OpenID Connect","email":"User email","profile":"User profile"}}},"description":"Credit Coop OAuth"}},"schemas":{"ErrorResponse":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"integer"}}}}},"paths":{"/v3/credit-facilities/{id}/proposals":{"get":{"operationId":"getCreditFacilityProposals","summary":"Get credit facility proposals","tags":["Credit Facilities"],"description":"Get mutual consent proposals for a Credit Facility. Authentication is required.","parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true,"description":"Credit Facility ID. Example: 550e8400-e29b-41d4-a716-446655440000"}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","required":["facilityId","facilityAddress","networkId","open","closed","revokedAllEvents"],"properties":{"facilityId":{"type":"string","description":"Credit Facility UUID"},"facilityAddress":{"type":"string","description":"Credit facility contract address"},"networkId":{"type":"string","description":"CAIP-2 network identifier (e.g. eip155:8453)"},"open":{"type":"array","description":"Proposals that are still open (pending acceptance)","items":{"type":"object","required":["proposalId","taker","nonce","proposalType","status","registeredAt","registeredTxHash","registeredBlockNumber"],"properties":{"proposalId":{"type":"string","description":"Unique proposal identifier (bytes32)"},"taker":{"type":"string","description":"Address that needs to accept the proposal"},"nonce":{"type":"string","description":"Nonce at time of registration"},"msgData":{"type":"string","nullable":true,"description":"Raw hex-encoded function call data from the proposal"},"proposalType":{"type":"string","enum":["new_credit","refinance","set_fees","unknown"],"description":"Type of proposal: new_credit for new credit lines, refinance for modifications, set_fees for fee changes, unknown if ABI missing or function is not recognized"},"parameters":{"oneOf":[{"title":"CreditProposalParameters","type":"object","description":"Credit proposal parameters (new_credit or refinance)","required":["lender","amount","drawRate","facilityRate","deadline"],"properties":{"lender":{"type":"string","description":"Lender address"},"vaultCurator":{"type":"string","nullable":true,"description":"Vault curator (manager) address for the lender"},"vault":{"type":"string","nullable":true,"description":"Lending vault address for the lender (CreditStrategy)"},"token":{"type":"string","nullable":true,"description":"Token address"},"amount":{"type":"string","description":"Credit amount (raw uint256 — divide by the token's decimals to get human-readable value)"},"drawRate":{"type":"string","description":"Draw rate in basis points"},"facilityRate":{"type":"string","description":"Facility rate in basis points"},"deadline":{"type":"string","format":"date-time","description":"Expiration"},"isRestricted":{"type":"boolean","description":"Whether credit is restricted (new_credit only)"},"earlyWithdrawalFee":{"type":"string","description":"Early withdrawal fee in basis points (new_credit only)"},"lineTokenId":{"type":"string","description":"Existing credit line token ID (refinance only)"},"desiredNonce":{"type":"string","description":"Nonce the proposer required at acceptance, decoded from msgData (new_credit and refinance only)"}}},{"title":"SetFeesProposalParameters","type":"object","description":"Fee change parameters (set_fees)","required":["originationFee","swapFee","servicingFee"],"properties":{"originationFee":{"type":"string","description":"Origination fee in basis points"},"swapFee":{"type":"string","description":"Swap fee in basis points"},"servicingFee":{"type":"string","description":"Servicing fee in basis points"}}},{"type":"null"}],"description":"Decoded proposal terms. Shape depends on proposalType: credit parameters for new_credit/refinance, fee parameters for set_fees, null for unknown."},"status":{"type":"string","enum":["pending"],"description":"Proposal status (always pending for open proposals)"},"registeredAt":{"type":"string","format":"date-time"},"registeredTxHash":{"type":"string"},"registeredBlockNumber":{"type":"integer"}}}},"closed":{"type":"array","description":"Proposals that have been closed (accepted, revoked, or revoked_all)","items":{"type":"object","required":["proposalId","taker","nonce","proposalType","status","registeredAt","registeredTxHash","registeredBlockNumber","closedAt","closedTxHash","closedBlockNumber"],"properties":{"proposalId":{"type":"string","description":"Unique proposal identifier (bytes32)"},"taker":{"type":"string","description":"Address that needed to accept the proposal"},"nonce":{"type":"string","description":"Nonce at time of registration"},"msgData":{"type":"string","nullable":true,"description":"Raw hex-encoded function call data from the proposal"},"proposalType":{"type":"string","enum":["new_credit","refinance","set_fees","unknown"],"description":"Type of proposal: new_credit for new credit lines, refinance for modifications, set_fees for fee changes, unknown if ABI missing or function is not recognized"},"parameters":{"oneOf":[{"title":"CreditProposalParameters","type":"object","description":"Credit proposal parameters (new_credit or refinance)","required":["lender","amount","drawRate","facilityRate","deadline"],"properties":{"lender":{"type":"string","description":"Lender address"},"vaultCurator":{"type":"string","nullable":true,"description":"Vault curator (manager) address for the lender"},"vault":{"type":"string","nullable":true,"description":"Lending vault address for the lender (CreditStrategy)"},"token":{"type":"string","nullable":true,"description":"Token address"},"amount":{"type":"string","description":"Credit amount (raw uint256 — divide by the token's decimals to get human-readable value)"},"drawRate":{"type":"string","description":"Draw rate in basis points"},"facilityRate":{"type":"string","description":"Facility rate in basis points"},"deadline":{"type":"string","format":"date-time","description":"Expiration"},"isRestricted":{"type":"boolean","description":"Whether credit is restricted (new_credit only)"},"earlyWithdrawalFee":{"type":"string","description":"Early withdrawal fee in basis points (new_credit only)"},"lineTokenId":{"type":"string","description":"Existing credit line token ID (refinance only)"},"desiredNonce":{"type":"string","description":"Nonce the proposer required at acceptance, decoded from msgData (new_credit and refinance only)"}}},{"title":"SetFeesProposalParameters","type":"object","description":"Fee change parameters (set_fees)","required":["originationFee","swapFee","servicingFee"],"properties":{"originationFee":{"type":"string","description":"Origination fee in basis points"},"swapFee":{"type":"string","description":"Swap fee in basis points"},"servicingFee":{"type":"string","description":"Servicing fee in basis points"}}},{"type":"null"}],"description":"Decoded proposal terms. Shape depends on proposalType: credit parameters for new_credit/refinance, fee parameters for set_fees, null for unknown."},"status":{"type":"string","enum":["accepted","revoked","revoked_all"],"description":"How the proposal was closed"},"registeredAt":{"type":"string","format":"date-time"},"registeredTxHash":{"type":"string"},"registeredBlockNumber":{"type":"integer"},"closedAt":{"type":"string","format":"date-time"},"closedTxHash":{"type":"string"},"closedBlockNumber":{"type":"integer"}}}},"revokedAllEvents":{"type":"array","description":"All RevokedAll events that cleared proposals","items":{"type":"object","required":["newNonce","timestamp","txHash","blockNumber"],"properties":{"newNonce":{"type":"string","description":"New nonce after revocation"},"timestamp":{"type":"string","format":"date-time"},"txHash":{"type":"string"},"blockNumber":{"type":"integer"}}}}}}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.creditcoop.xyz/developer-api-docs/credit-facilities.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
