Skip to Content
FrontendAPI Client

API Client

Overview

All backend communication goes through lib/api-client.ts. Never hardcode fetch() calls — the API client handles:

  • URL construction from NEXT_PUBLIC_API_URL
  • Authorization: Bearer <idToken> from localStorage
  • JSON serialization / deserialization
  • Error unwrapping into Error objects with .message and .status

Usage

import { jobAPI, profileAPI } from '@/lib/api-client' // List open jobs with filters const { data } = await jobAPI.list({ status: 'open', platform: 'instagram' }) // Apply to a job await jobAPI.apply(jobId, { cover_note: 'I would love to work on this!' })

Available Modules

ModuleMethods
authAPIcreateSession(), me(), setRole()
profileAPIgetMe(), updateMe(), socialConnect(), getPublic()
jobAPIlist(), create(), apply(), selectCreator(), cancel()
milestoneAPIlist(), submit(), approve(), dispute(), recheck()
applicationAPIlistMine(), withdraw(), reject(), listIncoming()
walletAPIgetBalance(), deposit(), withdraw(), getTransactions()
permissionAPIstore(), getForJob()
faucetAPIdrip()
verificationAPIverify(), settle()
reputationAPIlookup()
oneshotAPIstatus()
demoAPIunlock(), ensureDeals()

If a method isn’t exported from api-client.ts, the endpoint doesn’t exist on the frontend. Add it there first, then use it.

Last updated on