Step 15: Deploy to run402

Phase: deploy

Context

You have verified app_files and project_id. Time to put the app online.

What to do

Deploy the static site

POST https://run402.com/v1/deployments
Content-Type: application/json

{
  "name": "app-name",
  "project": "{project_id}",
  "files": [
    {
      "file": "index.html",
      "data": "<!DOCTYPE html>...",
      "encoding": "utf-8"
    },
    {
      "file": "style.css",
      "data": "body { ... }",
      "encoding": "utf-8"
    },
    {
      "file": "app.js",
      "data": "const CONFIG = ...",
      "encoding": "utf-8"
    }
  ]
}

This endpoint is x402-gated ($0.05). No API key or auth header is needed — the x402 payment header IS the authorization. Same flow as project creation: first request returns 402, sign payment, retry with x-402-payment header.

Response (201):

{
  "id": "dpl-1709337600000-a1b2c3",
  "name": "app-name",
  "url": "https://dpl-1709337600000-a1b2c3.sites.run402.com",
  "status": "READY",
  "files_count": 3,
  "total_size": 15234
}

Important notes

  • Max 50 MB per deployment. If files exceed this, reduce image sizes or split assets.
  • Immutable deployments — each deploy creates a new URL. Previous deployments stay live.
  • SPA support — paths without file extensions automatically serve index.html.
  • For binary files (images), use "encoding": "base64" and base64-encode the data.

Verify deployment

Check deployment status (free, no auth):

GET https://run402.com/v1/deployments/{deployment_id}

Wait for "status": "READY" before sharing the URL.

Claim a subdomain (optional but recommended)

Give your app a memorable URL like https://myapp.run402.com instead of the raw deployment URL.

POST https://run402.com/v1/subdomains
Content-Type: application/json
Authorization: Bearer {service_key}

{
  "name": "myapp",
  "deployment_id": "{deployment_id}"
}

Response (201):

{
  "name": "myapp",
  "deployment_id": "dpl-1709337600000-a1b2c3",
  "url": "https://myapp.run402.com",
  "deployment_url": "https://dpl-1709337600000-a1b2c3.sites.run402.com",
  "project_id": "prj-abc123",
  "created_at": "2026-03-05T12:00:00Z",
  "updated_at": "2026-03-05T12:00:00Z"
}

Subdomain rules

  • 3-63 characters, lowercase letters, numbers, and hyphens only
  • Must start and end with a letter or number (no leading/trailing hyphens)
  • No consecutive hyphens (--)
  • Reserved words are blocked: api, www, admin, app, dashboard, docs, help, support, cdn, static, dev, staging, test, demo, run402, and others
  • Each subdomain is owned by the project that created it — other projects cannot claim it
  • Free — no x402 payment required, but needs service_key auth

If the user does not want a subdomain, skip this step — the raw deployment URL works fine.

Expected output

  • deployment_id — The deployment identifier
  • deployment_url — The live URL (e.g., https://dpl-xxx.sites.run402.com)
  • subdomain — The claimed subdomain name (if any)
  • subdomain_url — The memorable URL (e.g., https://myapp.run402.com)

Memory directive