NodeOps
IN

Deploy Flow

The MPP deploy flow uses HTTP 402 responses to communicate payment requirements. The agent calls the deploy endpoint, handles the 402, pays on-chain, and retries.


Step 1: Request Deploy (Get Quote)

Call POST /agent/deploy without a payment header. The gateway checks your credit balance and active projects:

POST /agent/deploy
Content-Type: application/json
X-Wallet-Address: 0x...
X-Signature: 0x...
X-Timestamp: 1711500000000
X-Nonce: unique-uuid

{
  "uniqueName": "my-app",
  "displayName": "My App",
  "upload": {
    "type": "files",
    "files": [
      { "path": "index.js", "content": "base64..." },
      { "path": "package.json", "content": "base64..." }
    ]
  }
}

Response Cases

Has credits, no active projects - deploys immediately (200):

JSON
1{ "projectId": "uuid", "deploymentId": "uuid", "status": "deploying" }

Has credits, active projects exist - returns 402 with a warning:

JSON
1{
2 "error": "Payment required",
3 "warning": "You have 2 active project(s) sharing credits...",
4 "amount_usd": 0.5,
5 "current_credit_balance_usd": 1.20,
6 "active_projects": 2,
7 "pay_to": "0x7EA5...",
8 "payment_chain": "arbitrum",
9 "token": "usdc",
10 "decimals": 6,
11 "supported_chains": [...]
12}

To deploy using existing credits (reduces runtime of other projects), retry with header X-Use-Existing-Credits: true.

No credits - returns 402 with payment details:

JSON
1{
2 "error": "Payment required",
3 "amount_usd": 0.5,
4 "amount_token": "500000",
5 "current_credit_balance_usd": 0,
6 "active_projects": 0,
7 "pay_to": "0x7EA5...",
8 "payment_chain": "arbitrum",
9 "token": "usdc",
10 "decimals": 6,
11 "supported_chains": [
12 { "chain": "arbitrum", "chain_id": 42161, "tokens": ["usdc", "usdt"] },
13 { "chain": "base", "chain_id": 8453, "tokens": ["usdc", "usdt"] }
14 ]
15}

Step 2: Check Balance

Before paying, verify the wallet has enough tokens:

GET /agent/balance/0xYourWallet?chain=arbitrum
JSON
1{
2 "address": "0x...",
3 "chain": "arbitrum",
4 "balances": [
5 { "token": "usdc", "symbol": "USDC", "balance": "18.000000", "decimals": 6 }
6 ]
7}

If the balance is insufficient, prompt the user to fund the wallet on one of the supported chains.


Step 3: Pay On-Chain

Send an ERC20 transfer to the pay_to address from the 402 response:

TypeScript
1import { createWalletClient, createPublicClient, http } from "viem";
2import { arbitrum } from "viem/chains";
3
4const ERC20_ABI = [{
5 name: "transfer",
6 type: "function",
7 stateMutability: "nonpayable",
8 inputs: [
9 { name: "to", type: "address" },
10 { name: "value", type: "uint256" },
11 ],
12 outputs: [{ name: "", type: "bool" }],
13}] as const;
14
15const txHash = await walletClient.writeContract({
16 address: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831", // USDC on Arbitrum
17 abi: ERC20_ABI,
18 functionName: "transfer",
19 args: [quote.pay_to, BigInt(quote.amount_token)],
20});
21
22await publicClient.waitForTransactionReceipt({ hash: txHash });

Step 4: Deploy with Payment Proof

Retry the deploy request with the transaction hash:

POST /agent/deploy
Content-Type: application/json
X-Payment-Tx: 0xTransactionHash
X-Payment-Chain: arbitrum
X-Payment-Token: usdc
X-Wallet-Address: 0x...
X-Signature: 0x...
X-Timestamp: 1711500000000
X-Nonce: new-unique-uuid

Same body as Step 1. Response:

JSON
1{ "projectId": "uuid", "deploymentId": "uuid", "status": "deploying" }

Step 5: Poll Status

Poll the status endpoint every 5 seconds until the deployment is ready:

GET /agent/deploy/{projectId}/{deploymentId}/status

Possible responses:

StatusMeaning
deployingBuild/deploy in progress
readyLive at endpoint URL
failedDeployment failed with reason
JSON
1{ "status": "ready", "endpoint": "https://my-app.nodeops.network" }

Upload Types

Files - array of base64-encoded files:

JSON
1{
2 "type": "files",
3 "files": [
4 { "path": "index.js", "content": "base64..." },
5 { "path": "package.json", "content": "base64..." }
6 ]
7}

Zip - base64-encoded zip archive:

JSON
1{
2 "type": "zip",
3 "data": "base64-zip-content",
4 "filename": "code.zip"
5}

Exclude from uploads: node_modules/, dist/, build/, .next/, .env, .git/, __pycache__/, venv/

1,00,000+ बिल्डर। एक कार्यक्षेत्र।

उत्पाद अपडेट, बिल्डर कहानियाँ, और उन सुविधाओं तक पहले पहुँच प्राप्त करें जो आपको तेज़ी से शिप करने में मदद करती हैं।

CreateOS एक एकीकृत बुद्धिमान कार्यक्षेत्र है जहाँ विचार अवधारणा से लाइव डिप्लॉयमेंट तक सहजता से आगे बढ़ते हैं, टूल, इन्फ्रास्ट्रक्चर और वर्कफ़्लो में कॉन्टेक्स्ट-स्विचिंग को समाप्त करते हुए CreateOS मार्केटप्लेस पर तुरंत विचारों को मुद्रीकृत करने का अवसर प्रदान करता है।