Contract creation is triggered after a successful Stripe payment. See Payments endpoints for the payment initiation flow.
Contract status lifecycle
| Status | Description |
|---|---|
Pending | Contract created, waiting for freelancer approval |
Started | Freelancer approved the contract |
Ongoing | Work is in progress |
Completed | Work is complete and fund release has been approved |
Canceled | Contract was canceled by either party |
POST /api/client/create-contract/:jobId
Create a contract for a job after payment has been processed. The authenticated client’s ID is taken from the JWT. Auth required: Yes —client role
Path parameters
MongoDB ObjectId of the job this contract is for.
Request body
MongoDB ObjectId of the freelancer being hired.
Contract value in INR. Should match the
rate of the job.Response
Confirmation that the contract was created.
The newly created contract document.
cURL
DELETE /api/client/cancel-contract/:contractId
Cancel a contract. Both the client and the freelancer can initiate cancellation. Canceling a contract while escrow is funded will trigger the refund flow. Auth required: Yes —client or freelancer role
Path parameters
MongoDB ObjectId of the contract to cancel.
Response
Confirmation that the contract was canceled.
cURL
GET /api/client/is-created/:jobId/:clientId
Check whether a contract already exists for a given job and client. Use this to prevent duplicate contract creation. Auth required: NoPath parameters
MongoDB ObjectId of the job.
MongoDB ObjectId of the client.
Response
The existing contract document if one exists, or
null if no contract has been created yet.cURL
GET /api/client/get-contracts/:clientId
Retrieve all contracts belonging to a specific client. Auth required: NoPath parameters
MongoDB ObjectId of the client.
Response
Total number of contracts returned.
Array of contract documents with populated
jobId, freelancerId, and clientId references.cURL
GET /api/client/all-contracts
Return all contracts across all users. Intended for admin dashboards and oversight tooling. Auth required: No (no middleware applied, but intended for admin use)Response
Array of all contract documents across the platform.
cURL
PATCH /api/client/release-fund/:contractId
Request that the escrowed funds be released to the freelancer. This setsreleaseFundStatus to Requested. An admin must then approve the release via the escrow endpoints.
Auth required: Yes — client role
Path parameters
MongoDB ObjectId of the contract.
Response
Confirmation that the fund release request was recorded.
Submitting a release request does not immediately transfer funds. The request enters a
Requested state and must be approved by an admin through PUT /api/admin/escrow/release-fund/:contractId.cURL
POST /api/freelancer/contract/approve-contract/:contractId/:freelancerId
Freelancer accepts the contract, moving its status fromPending to Started.
Auth required: Yes — freelancer role
Path parameters
MongoDB ObjectId of the contract.
MongoDB ObjectId of the freelancer approving the contract.
Response
Confirmation message and the updated contract document.cURL
GET /api/freelancer/contract/get-contracts/:freelancerId
Retrieve all contracts for a specific freelancer. Auth required: NoPath parameters
MongoDB ObjectId of the freelancer.
Response
Array of contract documents associated with the freelancer.cURL
GET /api/freelancer/contract/view-contract/:contractId
Retrieve full details for a single contract including populated references. Auth required: NoPath parameters
MongoDB ObjectId of the contract.
Response
The full contract document with populatedjobId, clientId, and freelancerId.
cURL
PUT /api/freelancer/contract/update-status/:contractId
Update the working status of a contract (e.g., move fromStarted to Ongoing, or mark as Completed).
Auth required: Yes — freelancer role
Path parameters
MongoDB ObjectId of the contract.
Request body
New status value. One of
Started, Ongoing, Completed, or Canceled.Response
The updated contract document.cURL
GET /api/freelancer/contract/completed-works/:freelancerId
Retrieve all contracts with statusCompleted for a given freelancer. Useful for portfolio and earnings history views.
Auth required: No
Path parameters
MongoDB ObjectId of the freelancer.
Response
Array of completed contract documents.cURL
