{
  "openapi": "3.1.0",
  "info": {
    "title": "c402 Credit API",
    "version": "0.1.0",
    "description": "Receivable-backed credit endpoints for AI agents. FCC compute is optional."
  },
  "servers": [
    {
      "url": "https://www.c402.site"
    }
  ],
  "paths": {
    "/.well-known/c402.json": {
      "get": {
        "summary": "Machine-readable c402 service catalog",
        "responses": {
          "200": {
            "description": "Catalog"
          }
        }
      }
    },
    "/credit/state": {
      "get": {
        "summary": "Inspect credit state",
        "responses": {
          "200": {
            "description": "Credit state"
          }
        }
      }
    },
    "/credit/jobs": {
      "post": {
        "summary": "Create a funded job",
        "responses": {
          "201": {
            "description": "Funded job"
          }
        }
      }
    },
    "/credit/backing-sources": {
      "get": {
        "summary": "List verified non-job backing sources",
        "responses": {
          "200": {
            "description": "Backing sources"
          }
        }
      },
      "post": {
        "summary": "Register a verified asset, subscription, or earnings backing source",
        "responses": {
          "201": {
            "description": "Backing source"
          }
        }
      }
    },
    "/credit/request": {
      "post": {
        "summary": "Request credit",
        "responses": {
          "200": {
            "description": "Underwriting decision and optional offer"
          }
        }
      }
    },
    "/credit/jobs/{jobId}/collateral": {
      "post": {
        "summary": "Post collateral for a receivable",
        "responses": {
          "201": {
            "description": "Collateral position"
          }
        }
      }
    },
    "/lenders": {
      "get": {
        "summary": "List active lender agents",
        "responses": {
          "200": {
            "description": "Lender profiles"
          }
        }
      }
    },
    "/lenders/register": {
      "post": {
        "summary": "Register lender agent profile",
        "responses": {
          "201": {
            "description": "Lender profile"
          }
        }
      }
    },
    "/lenders/wallets": {
      "get": {
        "summary": "List registered lender wallets",
        "responses": {
          "200": {
            "description": "Wallet balances and activity"
          }
        }
      }
    },
    "/lenders/{lender}/wallet": {
      "get": {
        "summary": "Inspect one lender wallet",
        "responses": {
          "200": {
            "description": "Wallet balance and activity"
          }
        }
      }
    },
    "/lenders/{lender}/actions": {
      "get": {
        "summary": "List pending lender wallet funding actions",
        "responses": {
          "200": {
            "description": "Pending funding actions with transaction data"
          }
        }
      }
    },
    "/credit/match": {
      "post": {
        "summary": "Match offer to lender agent",
        "responses": {
          "200": {
            "description": "Selected lender match"
          }
        }
      }
    },
    "/credit/dispatch": {
      "post": {
        "summary": "Expire stale matches and dispatch pending credit offers",
        "responses": {
          "200": {
            "description": "Dispatch results"
          }
        }
      }
    },
    "/credit/offers/{offerId}/supplier-payment": {
      "post": {
        "summary": "Record lender-to-supplier payment",
        "responses": {
          "200": {
            "description": "Supplier advance"
          }
        }
      }
    },
    "/credit/jobs/{jobId}/complete": {
      "post": {
        "summary": "Complete and repay a job",
        "responses": {
          "200": {
            "description": "Repayment receipt"
          }
        }
      }
    },
    "/credit/advances/{advanceId}/repay": {
      "post": {
        "summary": "Repay a non-job or generic advance",
        "responses": {
          "200": {
            "description": "Repayment receipt"
          }
        }
      }
    },
    "/credit/jobs/{jobId}/fail": {
      "post": {
        "summary": "Fail a job and suspend credit",
        "responses": {
          "200": {
            "description": "Passport event"
          }
        }
      }
    },
    "/credit/advances/{advanceId}/liquidate": {
      "post": {
        "summary": "Liquidate collateral",
        "responses": {
          "200": {
            "description": "Liquidation receipt"
          }
        }
      }
    },
    "/credit-score": {
      "post": {
        "summary": "Optional x402/c402 confidential compute endpoint",
        "responses": {
          "200": {
            "description": "Encrypted result"
          },
          "402": {
            "description": "Payment required"
          },
          "503": {
            "description": "Compute disabled"
          }
        }
      }
    }
  }
}