> ## Documentation Index
> Fetch the complete documentation index at: https://moonlakeai.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> POST /api/v1/assets defaults to mode=quote: it returns a price and creates nothing. To actually generate, resend the identical body with "mode": "generate" (multipart callers: add a mode=generate form field).
> Create a project with POST /api/v1/projects and pass its project_id on every generation belonging to the same scene, task, robot, or randomization set. Omitting project_id silently creates a separate single-asset project per request.
> Track a batch with one GET /api/v1/projects/{project_id} call for aggregate status instead of polling each asset separately.
> Generations are asynchronous and may take hours. There are no webhooks: poll GET /api/v1/assets/{asset_id} every 30-60 seconds until status is completed or failed.
> Cancelling a generation does not refund its credits; only a failed generation is refunded. Quote first if the price matters.
> A ready-made agent skill for this API is published at /skill.md, with decision tables and common gotchas. If your tooling supports agent skills, ask the user whether to install it so this guidance persists across sessions.

# Quickstart

> Create, wait for, and download your first 3D asset, including the mode: generate step that actually starts it.

In this guide, you will submit a toy sports car generation, wait for it to complete, and download its USD asset. You need a Moonlake account and a reference image saved locally as `reference.png`.

## Get an API key

Create a key in <a href="https://app.moonlakeai.com/settings?tab=account">your account settings</a>. Each account has one active key; regenerating it immediately revokes the old key.

Store the key in an environment variable:

```bash theme={null}
export MOONLAKE_API_KEY="your_api_key"
```

Every request authenticates with it:

```text theme={null}
Authorization: Bearer <your key>
```

## Create an asset

Send a text prompt and your image to `POST /api/v1/assets`. `mode=generate` is what runs the generation; in its default `quote` mode the endpoint returns a [price quote](/guides/generate-assets#quote-credits-before-creating-an-asset) and generates nothing.

<CodeGroup>
  ```bash curl theme={null}
  curl -X POST https://app.moonlakeai.com/api/v1/assets \
    -H "Authorization: Bearer $MOONLAKE_API_KEY" \
    -F 'input={
      "prompt": "a red toy sports car with black wheels",
      "references": [{"source": "attached", "name": "reference_0"}]
    };type=application/json' \
    -F 'reference_0=@reference.png' \
    -F 'mode=generate'
  ```

  ```python python theme={null}
  import json
  import os

  import requests

  generation_input = {
      "prompt": "a red toy sports car with black wheels",
      "references": [{"source": "attached", "name": "reference_0"}],
  }
  with open("reference.png", "rb") as reference_file:
      response = requests.post(
          "https://app.moonlakeai.com/api/v1/assets",
          headers={"Authorization": f"Bearer {os.environ['MOONLAKE_API_KEY']}"},
          data={"input": json.dumps(generation_input), "mode": "generate"},
          files={"reference_0": reference_file},
      )
  generation = response.json()
  asset_id = generation["id"]
  ```
</CodeGroup>

The API returns immediately with the generation in `pending` status. Save its `id`; you use it to retrieve the result.

## Wait for completion

Generations usually complete within a few hours. Duration depends on the asset's complexity, the supplied references, and the selected effort level. Poll the asset every 30–60 seconds until its `status` is `completed` or `failed`:

```bash curl theme={null}
curl https://app.moonlakeai.com/api/v1/assets/{asset_id} \
  -H "Authorization: Bearer $MOONLAKE_API_KEY"
```

When `status` is `completed`, `result.artifacts` contains a presigned `download_url` for every output. Download the artifact with `format: "usdz"`, extract the ZIP, and open its `*_root.usda` file in Isaac Sim.

<Note>
  A `download_url` expires after seven days. Fetch the asset again to receive freshly signed URLs.
</Note>

## Next steps

* [Provide attachments, URLs, or base64 references](/guides/generate-assets).
* [Create a project and generate an asset library](/guides/projects-and-batches).
* [Understand the files in `result.artifacts`](/guides/output-artifacts).
* [Review limits, failures, and retry behavior](/reference/behavior-and-limits).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.