Upload Module
Uploads a new HDP module to the registry. This endpoint accepts multipart form data containing the compiled module, source files, ABI, and metadata. The creator user is automatically inferred from the API key. This endpoint requires authentication.Endpoint
Authentication
This endpoint requires authentication using an API key:Request Body (Multipart Form Data)
| Field | Type | Required | Description |
|---|---|---|---|
| module | file (JSON) | Yes | The compiled contract class JSON file |
| name | string | Yes | Module name |
| compiler_version | string | No | Compiler version (extracted from module if not provided) |
| version | string | Yes | Semantic version (e.g., “1.0.0”) |
| description | string | No | Module description |
| tags | string | No | Comma-separated tags |
| license | string | No | License identifier |
| version_changelog | string | No | Changelog for this version |
| source_files | string (JSON) | No | JSON object mapping file paths to content: {"src/lib.cairo": "content", ...} |
| abi | string (JSON) | No | Module ABI as JSON |
| scarb_toml | string | No | Scarb.toml file content |
Example Request
Response
Success Response (201 Created)
Error Response (400 Bad Request)
Error Response (401 Unauthorized)
Response Fields
| Field | Type | Description |
|---|---|---|
| id | string | The unique module ID (ULID) |
| programHash | string | The program hash of the uploaded module |
| compilerVersion | string | The compiler version used |
| createdAt | string | ISO 8601 timestamp of module creation |
| message | string | Success message |
Version Management
- Each module can have multiple versions
- Version numbers must be unique per module (semantic versioning recommended)
- The uploaded version becomes the latest version for the module
- If a version already exists for the module, the upload will fail with a 400 error
Storage
- Compiled programs are stored in S3 (if configured) or in the database as fallback
- Source code is always stored in the database
- Scarb.toml is stored in the database for reference
Notes
- Authentication is required for this endpoint
- The creator user is automatically inferred from the API key
- The module must be a Cairo 1 compiled program (Cairo 0 is not supported)
- The compiler version is extracted from the module if not provided
- Source files should be provided as a JSON object mapping relative paths to file contents
- The ABI should be provided as a JSON string
- Duplicate versions for the same module are not allowed

