> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flarehq.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Complete Job — POST /api/jobs/complete

> POST /api/jobs/complete — evaluator verifies the deliverable, hashes a reason, and releases escrowed USDC to the provider via complete(uint256,bytes32,bytes).

The evaluator reviews the submitted deliverable and — if it meets the job's requirements — calls this endpoint to release payment. FlareHQ verifies that the wallet is the job's actual evaluator and that the caller controls it, hashes the approval reason with `keccak256`, and calls `complete(uint256,bytes32,bytes)` on the ERC-8183 contract. The contract releases the escrowed USDC directly to the provider's SCA wallet in the same transaction that sets the job status to `COMPLETED`.

## Endpoint

```
POST https://flarehq.xyz/api/jobs/complete
```

## Request

### Headers

| Header | Value |
| - | - |
| `x-api-key` | `fhq_sec_test_...` — required. A merchant or service API key. |
| `Content-Type` | `application/json` — required |

### Body Parameters

<ParamField body="jobId" type="string" required>
  On-chain job ID. Must be in `SUBMITTED` status before completion is accepted.
</ParamField>

<ParamField body="evaluatorWalletId" type="string" required>
  Circle wallet UUID of the evaluator. Must resolve to the same on-chain address recorded as the job's `evaluator` when it was created — otherwise the request is rejected with `HTTP 403`.
</ParamField>

<ParamField body="reason" type="string" default="deliverable-approved">
  Optional human-readable reason for approval. Defaults to `"deliverable-approved"`. Hashed with `keccak256` and stored on-chain as the completion proof.
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  `true` when the `complete` transaction confirmed on-chain and payment was released.
</ResponseField>

<ResponseField name="jobId" type="string">
  The on-chain job ID passed in the request body.
</ResponseField>

<ResponseField name="status" type="string">
  Always `COMPLETED` on success — the terminal step in the lifecycle.
</ResponseField>

<ResponseField name="txHash" type="string">
  Transaction hash of the `complete` call. Payment is released atomically in this transaction — the provider's SCA wallet balance increases immediately. Verify on [Arc Explorer](https://explorer.arc.io).
</ResponseField>

## Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://flarehq.xyz/api/jobs/complete \
    -H "x-api-key: fhq_sec_test_..." \
    -H "Content-Type: application/json" \
    -d '{
      "jobId": "42",
      "evaluatorWalletId": "8d5f2e7a-11bb-4c33-8d44-9f0a1c2b3d4e",
      "reason": "deliverable-approved"
    }'
  ```

  ```js Node.js (fetch) theme={null}
  const res = await fetch('https://flarehq.xyz/api/jobs/complete', {
    method: 'POST',
    headers: {
      'x-api-key': 'fhq_sec_test_...',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      jobId: '42',
      evaluatorWalletId: '8d5f2e7a-11bb-4c33-8d44-9f0a1c2b3d4e',
      reason: 'deliverable-approved',
    }),
  });

  const { success, status, txHash } = await res.json();
  // Payment of the job's budget is now released to the provider
  ```
</CodeGroup>

### Success Response

```json theme={null}
{
  "success": true,
  "jobId": "42",
  "status": "COMPLETED",
  "txHash": "0xcompleteabc..."
}
```

### Error Responses

```json theme={null}
{
  "success": false,
  "error": "Authentication required. Provide a valid x-api-key or log in."
}
```

```json theme={null}
{
  "error": "Job not found"
}
```

```json theme={null}
{
  "error": "evaluatorWalletId does not resolve to this job's evaluator."
}
```

```json theme={null}
{
  "error": "You do not control this job's evaluator wallet."
}
```

## Notes

<Note>
  The job lifecycle is **OPEN → FUNDED → SUBMITTED → COMPLETE**. Completion is only valid while the job is `SUBMITTED`; the contract reverts if you attempt to complete a job that has not been submitted. If the evaluator rejects the deliverable instead, the job takes the dispute path (`REJECTED`) rather than `COMPLETE`.
</Note>

<Warning>
  Only the wallet recorded as the job's `evaluator` can complete, and the caller must control that wallet. Complete requests that fail either check return `HTTP 403` without touching the chain.
</Warning>

<Tip>
  Payment release is atomic with the status transition — there is no separate payout step. Confirm the provider received USDC by checking the provider SCA balance or the job's final state via [GET /api/jobs/{jobId}](/api-reference/jobs/detail).
</Tip>
