# 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-14).

Creates an upload session for a ZIP artifact and returns a pre-signed upload URL bound to the project owner, enabling subsequent file upload for deployment.

## Facts

- Endpoint: POST https://api.x402-hosting.com/v1/uploads
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/x402-hosting-upload-session-initializer-3fe0f5af
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_38-aYUExvGFB0NEv637f9

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-3fe0f5af -d '<json body>'
```

Example prompt: Start an upload session on x402-hosting for my project artifact called 'my-app.zip', which is 4823040 bytes, has SHA-256 hash a3f1c2d4e5b67890abcdef1234567890abcdef1234567890abcdef1234567890ab, and is a zip file — I need the upload URL so I can push the file before deploying.

## When to prefer this

Use this endpoint as the mandatory first step when deploying a project via x402-hosting — before you can upload a ZIP build artifact or trigger a deployment, you must obtain a valid upload session and pre-signed URL from this endpoint. It is idempotent via the Idempotency-Key header, so it is safe to retry on network failure. Prefer this over any generic S3 or storage upload initiation when your target platform is x402-hosting and you intend to pay per-call in USDC via the x402 protocol.

## Known failure modes

- Missing required query parameters (name, size, sha256, contentType) returns a 400 validation error
- Invalid SHA-256 format (not 64 lowercase hex chars) causes a 400 schema rejection
- contentType other than 'application/zip' is rejected with a 400 constant violation
- Missing or malformed Idempotency-Key UUID header may cause duplicate session creation or a 400 error
- Expired upload URL if the agent waits past the expiresAt timestamp before uploading
- Payment failure via x402 (insufficient USDC balance or failed on-chain authorization) returns a 402 Payment Required

## How this service works

Create an upload session for a new hosted Next.js site. Call this first when deploying a new project: it returns a presigned artifact upload URL, and the paying wallet becomes the project owner.

## Output

Returns a JSON object containing: a UUID upload session ID, a UUID operation ID for tracking, a pre-signed uploadUrl to PUT the ZIP file to, the object storage key, an expiry timestamp (ISO 8601) after which the session lapses, and any required headers to include when performing the upload.

## 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
    },
    "queryParams": {
     "type": "object",
     "required": [
      "name",
      "size",
      "sha256",
      "contentType"
     ],
     "properties": {
      "name": {
       "type": "string",
       "maxLength": 80,
       "minLength": 1
      },
      "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
    }
   },
   "additionalProperties": false
  }
 },
 "additionalProperties": false
}
```

## 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-3fe0f5af/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)
