pafcore.site

Spend endpoints

All need x-session-id and enough credits.

Method Path Credits
POST /v1/scans/:id/verify 1
POST /v1/findings/:scanId/:index/experiment 1 (same as verify)
POST /v1/scans/:id/deliverable/image 1
POST /v1/scans/:id/deliverable/paste 1
POST /v1/scans/:id/locate 1
POST /v1/verify-change 2

Example lab test:

curl -s -X POST "$API/v1/scans/$SCAN/verify" \
  -H "content-type: application/json" \
  -H "x-session-id: $SID" \
  -d '{"findingIndex":0}'

Answers 202 with the run id:

{ "id": "…", "status": "pending", "credits": 19, "cost": 1 }

Asking twice

If that finding is already pending or running for you, the same call hands back the run that is going and charges nothing:

{ "id": "…", "status": "running", "cost": 0, "alreadyRunning": true }

Check cost rather than assuming every accepted call took a credit. A retry after a dropped connection is safe.

When it fails

A run that fails gives the credit back. CANNOT VERIFY is not a failure: the measurement ran and that was its answer, so it is charged.