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

# Import Templates from Viggle

> Find template IDs on viggle.ai and import them into the API for rendering

Import pre-made templates from [viggle.ai](https://viggle.ai) instead of uploading your own videos.

* **Video templates** -- single-person scenes for rendering
* **Multi-person templates** -- contain tracked person UUIDs for each person in the video

## Finding template IDs

<Tabs>
  <Tab title="Video templates" icon="user">
    Single-person scenes from the viggle.ai homepage.

    <Steps>
      <Step title="Browse templates on viggle.ai">
        Go to [viggle.ai](https://viggle.ai) and browse the **Hot Picks** section.

        <Frame>
          <img src="https://mintcdn.com/warpenginecanadainc/HLmHbWhDf6Ze1zUy/images/import-guide/step1-hot-picks.png?fit=max&auto=format&n=HLmHbWhDf6Ze1zUy&q=85&s=d705b3e250f39b28c54513d31c6fe0bd" alt="Viggle homepage showing Hot Picks templates" width="2376" height="1664" data-path="images/import-guide/step1-hot-picks.png" />
        </Frame>
      </Step>

      <Step title="Copy the template ID">
        Click the **copy icon** next to the template title.

        <Frame>
          <img src="https://mintcdn.com/warpenginecanadainc/HLmHbWhDf6Ze1zUy/images/import-guide/step2-copy-template-id.png?fit=max&auto=format&n=HLmHbWhDf6Ze1zUy&q=85&s=c00e9c380a590d6be520dfcf169c9aa5" alt="Template detail page with copy ID button" width="2586" height="1664" data-path="images/import-guide/step2-copy-template-id.png" />
        </Frame>
      </Step>
    </Steps>
  </Tab>

  <Tab title="Multi-person templates" icon="users">
    Templates with multiple tracked persons.

    Watch how to use the editor to create a multi-person template:

    <Frame>
      <video src="https://mintcdn.com/warpenginecanadainc/bPgDqEEBsH9_p12K/images/editor.mp4?fit=max&auto=format&n=bPgDqEEBsH9_p12K&q=85&s=a19fc3db7bfb5f202a16e808317245c0" autoPlay muted loop playsInline data-path="images/editor.mp4" />
    </Frame>

    <Steps>
      <Step title="Open Multi-Track">
        Click **Multi-Track** in the left sidebar.

        <Frame>
          <img src="https://mintcdn.com/warpenginecanadainc/HLmHbWhDf6Ze1zUy/images/import-guide/step3-multi-track.png?fit=max&auto=format&n=HLmHbWhDf6Ze1zUy&q=85&s=cd66d0061cc7d21e4384b9060605a43e" alt="Multi-Track page in the sidebar" width="2548" height="1668" data-path="images/import-guide/step3-multi-track.png" />
        </Frame>
      </Step>

      <Step title="Switch to Legacy Editor">
        Click **Editor** under "Legacy Version" in the top-right.

        <Frame>
          <img src="https://mintcdn.com/warpenginecanadainc/HLmHbWhDf6Ze1zUy/images/import-guide/step4-legacy-editor.png?fit=max&auto=format&n=HLmHbWhDf6Ze1zUy&q=85&s=5ee12e88c22c9dd470e30b47678cd12b" alt="Click Legacy Editor button" width="2574" height="1672" data-path="images/import-guide/step4-legacy-editor.png" />
        </Frame>
      </Step>

      <Step title="Create or select a template">
        Click **Create** for a new template, or select from **My Templates**.

        <Frame>
          <img src="https://mintcdn.com/warpenginecanadainc/HLmHbWhDf6Ze1zUy/images/import-guide/step5-create-template.png?fit=max&auto=format&n=HLmHbWhDf6Ze1zUy&q=85&s=11b824fcd26988bf53a43c5cb13b0afb" alt="Legacy editor with Create button" width="2568" height="1676" data-path="images/import-guide/step5-create-template.png" />
        </Frame>
      </Step>

      <Step title="Copy the template ID">
        Click **Copy ID** below the video preview.

        <Frame>
          <img src="https://mintcdn.com/warpenginecanadainc/HLmHbWhDf6Ze1zUy/images/import-guide/step6-copy-id.png?fit=max&auto=format&n=HLmHbWhDf6Ze1zUy&q=85&s=94a5519ef25b9645b0d812dfebcdf9d3" alt="Copy ID button in the template editor" width="2572" height="1774" data-path="images/import-guide/step6-copy-id.png" />
        </Frame>
      </Step>
    </Steps>
  </Tab>
</Tabs>

## Importing via the API

<Tabs>
  <Tab title="Single-person" icon="user">
    <CodeGroup>
      ```python Python theme={null}
      import requests
      API_KEY, BASE = "YOUR_API_KEY", "https://apis.viggle.ai"
      headers = {"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"}

      scene = requests.post(f"{BASE}/api/scenes/import", headers=headers,
          json={"template_uuid": "YOUR_TEMPLATE_UUID", "name": "My Imported Scene"}).json()
      scene_id = scene["scene_id"]
      ```

      ```javascript JavaScript theme={null}
      const API_KEY = "YOUR_API_KEY", BASE = "https://apis.viggle.ai";

      const scene = await fetch(`${BASE}/api/scenes/import`, {
        method: "POST",
        headers: {
          Authorization: `Bearer ${API_KEY}`,
          "Content-Type": "application/json",
        },
        body: JSON.stringify({
          template_uuid: "YOUR_TEMPLATE_UUID",
          name: "My Imported Scene",
        }),
      }).then(r => r.json());
      const sceneId = scene.scene_id;
      ```

      ```bash cURL theme={null}
      curl -X POST "https://apis.viggle.ai/api/scenes/import" \
        -H "Authorization: Bearer YOUR_API_KEY" \
        -H "Content-Type: application/json" \
        -d '{"template_uuid": "YOUR_TEMPLATE_UUID", "name": "My Imported Scene"}'
      ```
    </CodeGroup>

    Render with the imported scene:

    <CodeGroup>
      ```python Python theme={null}
      job = requests.post(f"{BASE}/api/render",
          headers={"Authorization": f"Bearer {API_KEY}"},
          data={"character_id": "YOUR_CHARACTER_ID", "scene_id": scene_id}).json()
      ```

      ```javascript JavaScript theme={null}
      const form = new URLSearchParams();
      form.append("character_id", "YOUR_CHARACTER_ID");
      form.append("scene_id", sceneId);
      const job = await fetch(`${BASE}/api/render`, {
        method: "POST",
        headers: { Authorization: `Bearer ${API_KEY}` },
        body: form,
      }).then(r => r.json());
      ```

      ```bash cURL theme={null}
      curl -X POST "https://apis.viggle.ai/api/render" \
        -H "Authorization: Bearer YOUR_API_KEY" \
        -d "character_id=YOUR_CHARACTER_ID" -d "scene_id=SCENE_ID"
      ```
    </CodeGroup>
  </Tab>

  <Tab title="Multi-person" icon="users">
    <CodeGroup>
      ```python Python theme={null}
      import requests
      API_KEY, BASE = "YOUR_API_KEY", "https://apis.viggle.ai"
      headers = {"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"}

      scene = requests.post(f"{BASE}/api/scenes/import", headers=headers,
          json={"template_uuid": "YOUR_MULTI_TEMPLATE_UUID", "name": "Group Dance"}).json()
      scene_id = scene["scene_id"]

      for person_uuid in scene["character_uuids"]:
          print(f"  Person UUID: {person_uuid}")
      ```

      ```javascript JavaScript theme={null}
      const API_KEY = "YOUR_API_KEY", BASE = "https://apis.viggle.ai";

      const scene = await fetch(`${BASE}/api/scenes/import`, {
        method: "POST",
        headers: {
          Authorization: `Bearer ${API_KEY}`,
          "Content-Type": "application/json",
        },
        body: JSON.stringify({
          template_uuid: "YOUR_MULTI_TEMPLATE_UUID",
          name: "Group Dance",
        }),
      }).then(r => r.json());

      for (const personUuid of scene.character_uuids) {
        console.log(`  Person UUID: ${personUuid}`);
      }
      ```

      ```bash cURL theme={null}
      curl -X POST "https://apis.viggle.ai/api/scenes/import" \
        -H "Authorization: Bearer YOUR_API_KEY" \
        -H "Content-Type: application/json" \
        -d '{"template_uuid": "YOUR_MULTI_TEMPLATE_UUID", "name": "Group Dance"}'
      # Response includes "character_uuids" array with a UUID for each tracked person
      ```
    </CodeGroup>
  </Tab>
</Tabs>

## Tips

<AccordionGroup>
  <Accordion title="Video template vs multi-person template">
    If `character_uuids` is empty, it's a **video template** -- use with `character_id`. If `character_uuids` has entries, the template has multiple tracked persons.
  </Accordion>

  <Accordion title="Reusing imported scenes">
    Once imported, scenes are saved to your account and reusable across renders.
  </Accordion>
</AccordionGroup>
