Skip to main content
Once a job is created (OPEN), the client funds the USDC budget into on-chain escrow with this endpoint. It is a two-transaction operation under the hood — FlareHQ first approves the USDC spend to the ERC-8183 contract, then calls fund to deposit the budget into escrow. The endpoint enforces membership (the wallet must be the job’s actual client) and ownership (the caller must control that wallet) before executing anything. Once funded, the USDC is locked in the ERC-8183 escrow contract and cannot be withdrawn unilaterally by either party.

Endpoint

Request

Headers

Body Parameters

string
required
On-chain job ID returned from POST /api/jobs/create. The job must be in OPEN status before funding is accepted.
string
required
Circle wallet UUID of the client. Must resolve to the same on-chain address recorded as the job’s client when it was created — otherwise the request is rejected with HTTP 403.

Response

boolean
true when both the USDC approval and the escrow deposit confirmed on-chain.
string
The on-chain job ID passed in the request body.
string
Always FUNDED on success — the second step in the lifecycle.
string
Transaction hash of the USDC approve(address,uint256) call, granting the ERC-8183 contract spending allowance for the job’s budget.
string
Transaction hash of the fund(uint256,bytes) call that deposits the budget into on-chain escrow.

Examples

Success Response

Error Responses

Notes

The job lifecycle is OPEN → FUNDED → SUBMITTED → COMPLETE. Funding is only valid while the job is OPEN; the contract reverts if you attempt to fund a job that has already moved on.
The wallet backing clientWalletId must be the exact on-chain client recorded at job creation, and the API key or session must control that wallet. Both checks run before any transaction is signed — fund requests that fail either check return HTTP 403 without touching the chain.
Verify the escrow state on-chain with GET /api/jobs/ — a successful fund moves the job’s status to FUNDED.