# x402-hosting Upload Session Initializer

> x402-hosting Upload Session Initializer is a paid API for AI agents from api.x402-hosting.com, paid per call via x402, $0.01/call, status unknown (last checked 2026-09-09).

Creates a pre-signed upload session for a Next.js project ZIP file, returning a URL and metadata needed to upload the build artifact for deployment.

## Facts

- Endpoint: POST https://api.x402-hosting.com/v1/projects/%7Bid%7D/uploads
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-09
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/x402-hosting-upload-session-initializer-5a5b2378
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_Uoe55gFlq1oFk5kJi7CS3

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability x402-hosting-upload-session-initializer-5a5b2378 -d '<json body>'
```

Example prompt: Upload my Next.js build ZIP to x402-hosting for project ID a1b2c3d4-e5f6-4789-ab01-cdef01234567 — the ZIP is 4200000 bytes, its SHA-256 hash is 3a7bd3e2360a3d29aa625b9643ddaad2c2d5c3f5e7b1e9f0a4c6d8e2f1b0c9d8, and I'm ready to pay with USDC.

## When to prefer this

Use this endpoint when you need to deploy or update a Next.js project on x402-hosting and must first stage the build artifact before triggering deployment. This is the required first step in the upload-then-deploy flow — prefer it over alternatives when you need prepaid, USDC-based hosting with x402 protocol support and want a simple one-command deployment loop for AI agents.

## Known failure modes

- Invalid project UUID in path returns 404 or 400
- SHA-256 hash mismatch or wrong format returns 422 validation error
- Unsupported content type (anything other than application/zip) returns 400
- Missing or malformed Idempotency-Key header returns 400
- File size of 0 or negative returns 400
- x402 payment not completed or insufficient USDC balance returns 402 Payment Required
- Expired or reused upload URL after expiresAt results in upload rejection downstream
- Project not found or unauthorized access returns 403

## How this service works

Prepaid full-stack Next.js hosting operated by agents. One CLI command builds and deploys your app to a production URL; pay per project-day in USDC over the x402 protocol. No account, no dashboard.

## Output

Returns a JSON object containing a pre-signed uploadUrl for direct PUT of the ZIP, an uploadId and operationId (both UUIDs) to track the upload, an objectKey representing the storage path, an expiresAt timestamp after which the URL is invalid, and any required request headers (e.g. Content-Type) to include when uploading.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input",
  "output"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method",
    "queryParams"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "POST"
     ],
     "type": "string"
    },
    "headers": {
     "type": "object",
     "required": [
      "Idempotency-Key"
     ],
     "properties": {
      "Idempotency-Key": {
       "type": "string",
       "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
      }
     },
     "additionalProperties": true
    },
    "pathParams": {
     "type": "object",
     "required": [
      "id"
     ],
     "properties": {
      "id": {
       "type": "string",
       "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
      }
     },
     "additionalProperties": false
    },
    "queryParams": {
     "type": "object",
     "required": [
      "size",
      "sha256",
      "contentType"
     ],
     "properties": {
      "size": {
       "type": "integer",
       "minimum": 1
      },
      "sha256": {
       "type": "string",
       "pattern": "^[0-9a-f]{64}$"
      },
      "contentType": {
       "type": "string",
       "const": "application/zip"
      }
     },
     "additionalProperties": false
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type",
    "example"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "json"
    },
    "example": {
     "type": "object",
     "required": [
      "uploadId",
      "objectKey",
      "uploadUrl",
      "expiresAt",
      "headers",
      "operationId"
     ],
     "properties": {
      "headers": {
       "type": "object",
       "additionalProperties": {
        "type": "string"
       }
      },
      "uploadId": {
       "type": "string",
       "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
      },
      "expiresAt": {
       "type": "string"
      },
      "objectKey": {
       "type": "string"
      },
      "uploadUrl": {
       "type": "string"
      },
      "operationId": {
       "type": "string",
       "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
      }
     },
     "additionalProperties": false
    }
   },
 
… (truncated)
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "headers": {
   "content-type": "application/zip"
  },
  "uploadId": "00000000-0000-4000-8000-000000000001",
  "expiresAt": "2026-08-24T19:00:00.000Z",
  "objectKey": "uploads/00000000-0000-4000-8000-000000000001/artifact.zip",
  "uploadUrl": "https://uploads.example.com/artifact.zip",
  "operationId": "00000000-0000-4000-8000-000000000001"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/x402-hosting-upload-session-initializer-5a5b2378/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.x402-hosting.com](https://www.zero.xyz/host/api.x402-hosting.com/llms.txt)
