Manage Tasks
API integration guide for creating and removing project tasks
Manage Tasks
Managing tasks allows project managers to add new tasks and remove existing ones within a project. Tasks define units of work that contributors can commit to, complete, and earn rewards for. No new tokens are minted — tasks use existing treasury-tokens established during project creation. Task escrow holds the reward amount for each active task.
Summary
| Property | Value |
|---|---|
| System | Project |
| Role | Manager |
| Type Key | tasks_manage |
| Build Endpoint | POST /api/v2/tx/project/manager/tasks/manage |
| DB Sync | Yes |
| Service Fee | 0 ADA |
| Est. Wallet Cost | ~0.43 ADA + optional treasury deposit |
The estimated wallet cost covers the transaction fee plus any optional treasury deposit. Task escrow holds the reward amount specified in each task definition. New tasks confirmed on-chain are matched to the database by content hash and set to ON_CHAIN status; removed tasks are set to CANCELLED.
Build Transaction
Endpoint
POST /api/v2/tx/project/manager/tasks/manage
Request Body
{
"alias": "projectmanager",
"project_id": "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4",
"contributor_state_id": "b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5",
"tasks_to_add": [
{
"project_content": "Build the contributor onboarding flow",
"expiration_time": 1735689600000,
"lovelace_amount": 50000000,
"native_assets": []
}
],
"tasks_to_remove": [],
"deposit_value": [["lovelace", 100000000]],
"initiator_data": {
"usedAddresses": ["addr1qx2fxv2umyhttkxyxp8x0dlpdt3k6cwng5pxj3jhsydzer3n0d3vllmyqwsx5wktcd8cc3sq835lu7drv2xwl2wywfgse35a3x"],
"changeAddress": "addr1qx2fxv2umyhttkxyxp8x0dlpdt3k6cwng5pxj3jhsydzer3n0d3vllmyqwsx5wktcd8cc3sq835lu7drv2xwl2wywfgse35a3x"
}
}| Field | Type | Required | Description |
|---|---|---|---|
alias | string (Alias) | Yes | The manager's access token alias. Must be a current manager of the project. |
project_id | string (GYMintingPolicyId) | Yes | 56-character hex policy ID returned from project creation. |
contributor_state_id | string (GYMintingPolicyId) | Yes | Prerequisite credential policy ID. Contributors must hold a token from this policy to commit to tasks. |
tasks_to_add | TaskDefinition[] | Yes | Array of task definitions. Each contains: project_content (string — task description), expiration_time (integer — millisecond UTC timestamp), lovelace_amount (integer — reward in lovelace), native_assets (array — additional reward tokens). Pass [] if only removing. |
tasks_to_remove | array | Yes | Tasks to remove, matching existing task parameters. Pass [] if only adding. |
deposit_value | array | No | Optional treasury deposit as [[unit, amount]] pairs to fund task rewards. |
initiator_data | WalletData | No | Object containing usedAddresses (string[]) and changeAddress (string). If omitted, the Gateway resolves wallet data from the authenticated session. |
Response
{
"unsigned_tx": "84a800..."
}The response contains the unsigned transaction CBOR, ready for the user's wallet to sign.
Register Transaction
After the user signs and submits the transaction, register it with the state machine:
POST /api/v2/tx/register
{
"tx_hash": "64-char hex hash from wallet.submitTx()",
"tx_type": "tasks_manage"
}No metadata is required. On confirmation, the state machine matches new on-chain tasks to database records by content hash. Managers can create tasks as drafts in the database first; when the on-chain transaction confirms, the state machine matches by hash and updates the status to ON_CHAIN. Removed tasks are set to CANCELLED.
Related API Endpoints
| Endpoint | Description |
|---|---|
GET /api/v2/projects/{project_id}/tasks | Fetch all tasks for a project, including their on-chain status |
Example: Full Lifecycle
const API_URL = "https://api.andamio.io";
// 1. Build
const buildRes = await fetch(`${API_URL}/api/v2/tx/project/manager/tasks/manage`, {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": API_KEY,
"Authorization": `Bearer ${userJwt}`,
},
body: JSON.stringify({
alias: "projectmanager",
project_id: projectId,
contributor_state_id: contributorStateId,
tasks_to_add: [
{
project_content: "Build the contributor onboarding flow",
expiration_time: 1735689600000,
lovelace_amount: 50000000,
native_assets: [],
},
],
tasks_to_remove: [],
deposit_value: [["lovelace", 100000000]],
initiator_data: {
usedAddresses: [walletAddress],
changeAddress: walletAddress,
},
}),
});
const { unsigned_tx } = await buildRes.json();
// 2. Sign
const signedTx = await wallet.signTx(unsigned_tx);
// 3. Submit
const txHash = await wallet.submitTx(signedTx);
// 4. Register
await fetch(`${API_URL}/api/v2/tx/register`, {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": API_KEY,
"Authorization": `Bearer ${userJwt}`,
},
body: JSON.stringify({
tx_hash: txHash,
tx_type: "tasks_manage",
}),
});
// 5. Monitor (SSE)
const events = new EventSource(
`${API_URL}/api/v2/tx/stream/${txHash}`
);
events.addEventListener("state_change", (e) => {
const data = JSON.parse(e.data);
console.log(`State: ${data.old_state} → ${data.new_state}`);
});
events.addEventListener("complete", (e) => {
const data = JSON.parse(e.data);
console.log(`Final: ${data.final_state}`);
events.close();
});See Also
- Transaction State Machine -- Lifecycle overview
- Manager: Assess Tasks -- Assess contributor submissions
- Contributor: Commit to Task -- How contributors pick up tasks