Back to Docs

API Reference

Complete reference for the Myrlin API endpoints.

Authentication

All API requests require authentication via an API key passed in the X-API-Key header.

curl https://api.myrlin.io/v1/generate \
  -H "X-API-Key: myrl_your_key_here"

Create API keys in your Settings page.

POST/v1/generate

Start a new 3D asset generation. Each generation costs 7 tokens (~$0.70).

Request Body

ParameterTypeRequiredDescription
promptstringRequiredText description of the asset to generate
workflowstringOptional"text_to_3d" (default) or "image_to_3d"
stylestringOptionalStyle preset. Default: "hytale"
output_formatstringOptional"glb", "blockymodel", or "both" (default)
reference_image_base64stringOptionalBase64 encoded image for image_to_3d workflow
voxel_sizenumberOptionalVoxel resolution: 0.1 (32px classic), 0.067 (48px default), 0.05 (64px HD)
api_versionintOptionalSet to 2 to enable v2 features like target_size. Default: 1
target_sizeobjectOptionalV2 only. Target dimensions in Hytale units. {"x": 65} for uniform scale, or {"x": 65, "y": 12, "z": 3} for per-axis. Max 512 per axis.

Example Request

{
  "prompt": "A steampunk pistol with brass gears and copper pipes",
  "workflow": "text_to_3d",
  "style": "hytale",
  "output_format": "both"
}

V2 Example: Target Dimensions

Set api_version to 2 and provide target_size to control the output model dimensions in Hytale units. The model is rescaled after voxelization to match your target. Omitting target_size preserves default behavior.

{
  "prompt": "A Persian scimitar sword for Hytale",
  "style": "hytale",
  "api_version": 2,
  "target_size": {"x": 65}
}

Response

{
  "id": "gen_abc123def456",
  "status": "pending",
  "progress": 0,
  "glb_url": null,
  "blockymodel_url": null,
  "texture_url": null,
  "tokens_charged": 7,
  "created_at": "2024-01-15T10:30:00Z"
}
GET/v1/generations/:id

Get the status and results of a generation. Poll this endpoint until status is "complete" or "failed".

Response

{
  "id": "gen_abc123def456",
  "status": "complete",
  "progress": 100,
  "glb_url": "https://storage.myrlin.ai/...",
  "blockymodel_url": "https://storage.myrlin.ai/...",
  "texture_url": "https://storage.myrlin.ai/...",
  "tokens_charged": 7,
  "created_at": "2024-01-15T10:30:00Z",
  "completed_at": "2024-01-15T10:32:15Z"
}

Status Values

pendingGeneration queued, waiting to start
generatingGeneration in progress
completeGeneration finished, URLs available
failedGeneration failed, check error field
GET/v1/balance

Get your current token balance and account information.

Response

{
  "balance": 150,
  "lifetime_purchased": 500,
  "lifetime_spent": 350,
  "lifetime_bonus": 0
}
GET/v1/usage

Get your API usage history for the current API key.

Query Parameters

ParameterTypeRequiredDescription
limitintegerOptionalNumber of records to return (default: 50, max: 100)
hoursintegerOptionalFilter to last N hours (default: 24)

Response

{
  "usage": [
    {
      "id": "usg_123",
      "endpoint": "/v1/generate",
      "workflow_mode": "text_to_3d",
      "tokens_charged": 7,
      "success": true,
      "created_at": "2024-01-15T10:30:00Z"
    }
  ],
  "stats": {
    "total_requests": 47,
    "successful_requests": 45,
    "failed_requests": 2,
    "total_tokens": 235,
    "avg_response_time_ms": 125000
  }
}

Error Codes

401

Unauthorized

Invalid or missing API key, or key has been revoked.

402

Payment Required

Insufficient token balance. Purchase more tokens to continue.

404

Not Found

The requested resource (generation, etc.) was not found.

429

Too Many Requests

Rate limit exceeded. Check the Retry-After header.

500

Internal Server Error

Something went wrong on our end. Please retry or contact support.

Error Response Format

{
  "detail": "Insufficient token balance. Need 7 tokens, have 2."
}

Rate Limits

API requests are rate limited per API key to ensure fair usage.

WindowLimit
Per Minute10 requests
Per Hour100 requests
Per Day1,000 requests

Rate Limit Exceeded

When you exceed a rate limit, you'll receive a 429 response with a Retry-After header indicating how many seconds to wait.