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

# Code examples

> Go, JavaScript, Python, and cURL examples for every V1 endpoint.

Set `VIGGLE_API_KEY` before using these examples. Replace all sample IDs with the complete IDs returned by your account.

## Credits — `GET /v1/credits`

<CodeGroup>
  ```go Go theme={null}
  req, _ := http.NewRequest("GET", "https://apis.viggle.ai/v1/credits", nil)
  req.Header.Set("Authorization", "Bearer "+os.Getenv("VIGGLE_API_KEY")); resp, _ := http.DefaultClient.Do(req)
  ```

  ```javascript JavaScript theme={null}
  const resp = await fetch("https://apis.viggle.ai/v1/credits", {headers:{Authorization:`Bearer ${process.env.VIGGLE_API_KEY}`}});
  ```

  ```python Python theme={null}
  resp = requests.get("https://apis.viggle.ai/v1/credits", headers={"Authorization": f"Bearer {os.environ['VIGGLE_API_KEY']}"})
  ```

  ```bash cURL theme={null}
  curl "https://apis.viggle.ai/v1/credits" -H "Authorization: Bearer $VIGGLE_API_KEY"
  ```
</CodeGroup>

## Create Character — `POST /v1/characters`

<CodeGroup>
  ```go Go theme={null}
  body := &bytes.Buffer{}; w := multipart.NewWriter(body); f, _ := w.CreateFormFile("image", "character.png"); file, _ := os.Open("character.png"); io.Copy(f, file); w.WriteField("name", "Presenter"); w.Close()
  req, _ := http.NewRequest("POST", "https://apis.viggle.ai/v1/characters", body); req.Header.Set("Authorization", "Bearer "+os.Getenv("VIGGLE_API_KEY")); req.Header.Set("Content-Type", w.FormDataContentType()); resp, _ := http.DefaultClient.Do(req)
  ```

  ```javascript JavaScript theme={null}
  const form = new FormData(); form.append("image", imageFile); form.append("name", "Presenter");
  const resp = await fetch("https://apis.viggle.ai/v1/characters", {method:"POST", headers:{Authorization:`Bearer ${process.env.VIGGLE_API_KEY}`}, body:form});
  ```

  ```python Python theme={null}
  with open("character.png", "rb") as image:
      resp = requests.post("https://apis.viggle.ai/v1/characters", headers={"Authorization": f"Bearer {os.environ['VIGGLE_API_KEY']}"}, files={"image": image}, data={"name": "Presenter"})
  ```

  ```bash cURL theme={null}
  curl -X POST "https://apis.viggle.ai/v1/characters" -H "Authorization: Bearer $VIGGLE_API_KEY" -F "image=@character.png" -F "name=Presenter"
  ```
</CodeGroup>

Add `-F "type=vsplat"` to also extract a 3D vsplat (`all` keeps the render too):

```bash cURL theme={null}
curl -X POST "https://apis.viggle.ai/v1/characters" -H "Authorization: Bearer $VIGGLE_API_KEY" -F "image=@character.png" -F "type=vsplat"
```

## List, get, delete, and export Characters

<CodeGroup>
  ```go Go theme={null}
  req, _ := http.NewRequest("GET", "https://apis.viggle.ai/v1/characters/char_550e8400-e29b-41d4-a716-446655440000", nil); req.Header.Set("Authorization", "Bearer "+os.Getenv("VIGGLE_API_KEY")); resp, _ := http.DefaultClient.Do(req)
  ```

  ```javascript JavaScript theme={null}
  const resp = await fetch(`https://apis.viggle.ai/v1/characters/${characterId}`, {headers:{Authorization:`Bearer ${process.env.VIGGLE_API_KEY}`}});
  ```

  ```python Python theme={null}
  resp = requests.get(f"https://apis.viggle.ai/v1/characters/{character_id}", headers={"Authorization": f"Bearer {os.environ['VIGGLE_API_KEY']}"})
  ```

  ```bash cURL theme={null}
  curl "https://apis.viggle.ai/v1/characters" -H "Authorization: Bearer $VIGGLE_API_KEY"
  curl "https://apis.viggle.ai/v1/characters/char_550e8400-e29b-41d4-a716-446655440000" -H "Authorization: Bearer $VIGGLE_API_KEY"
  curl -X DELETE "https://apis.viggle.ai/v1/characters/char_550e8400-e29b-41d4-a716-446655440000" -H "Authorization: Bearer $VIGGLE_API_KEY"
  curl "https://apis.viggle.ai/v1/characters/char_550e8400-e29b-41d4-a716-446655440000/export?download_type=vsplat" -H "Authorization: Bearer $VIGGLE_API_KEY"
  ```
</CodeGroup>

For list, use `GET /v1/characters`; for deletion, change the request method to `DELETE`. See [Characters](/v1/api-reference/characters) for every request and response field.

## Create Motion (from Video) — `POST /v1/motions`

<CodeGroup>
  ```go Go theme={null}
  body := &bytes.Buffer{}; w := multipart.NewWriter(body); f, _ := w.CreateFormFile("motion_video", "dance.mp4"); file, _ := os.Open("dance.mp4"); io.Copy(f, file); w.WriteField("name", "Dance"); w.Close()
  req, _ := http.NewRequest("POST", "https://apis.viggle.ai/v1/motions", body); req.Header.Set("Authorization", "Bearer "+os.Getenv("VIGGLE_API_KEY")); req.Header.Set("Content-Type", w.FormDataContentType()); resp, _ := http.DefaultClient.Do(req)
  ```

  ```javascript JavaScript theme={null}
  const form = new FormData(); form.append("motion_video", videoFile); form.append("name", "Dance");
  const resp = await fetch("https://apis.viggle.ai/v1/motions", {method:"POST", headers:{Authorization:`Bearer ${process.env.VIGGLE_API_KEY}`}, body:form});
  ```

  ```python Python theme={null}
  with open("dance.mp4", "rb") as video:
      resp = requests.post("https://apis.viggle.ai/v1/motions", headers={"Authorization": f"Bearer {os.environ['VIGGLE_API_KEY']}"}, files={"motion_video": video}, data={"name": "Dance"})
  ```

  ```bash cURL theme={null}
  curl -X POST "https://apis.viggle.ai/v1/motions" -H "Authorization: Bearer $VIGGLE_API_KEY" -F "motion_video=@dance.mp4" -F "name=Dance"
  ```
</CodeGroup>

Add `-F "type=glb"` to also extract a 3D animation.

## Create Motion (from Text) — `POST /v1/motions`

The endpoint is the same, but text-to-motion uses `application/json` instead of multipart form data.

<CodeGroup>
  ```javascript JavaScript theme={null}
  const resp = await fetch("https://apis.viggle.ai/v1/motions", {method:"POST", headers:{Authorization:`Bearer ${process.env.VIGGLE_API_KEY}`, "Content-Type":"application/json"}, body:JSON.stringify({text:"a person doing a cartwheel", duration_seconds:5})});
  ```

  ```python Python theme={null}
  resp = requests.post("https://apis.viggle.ai/v1/motions", headers={"Authorization": f"Bearer {os.environ['VIGGLE_API_KEY']}"}, json={"text":"a person doing a cartwheel", "duration_seconds":5})
  ```

  ```bash cURL theme={null}
  curl -X POST "https://apis.viggle.ai/v1/motions" -H "Authorization: Bearer $VIGGLE_API_KEY" -H "Content-Type: application/json" -d '{"text":"a person doing a cartwheel","duration_seconds":5}'
  ```
</CodeGroup>

## Import Motion — `POST /v1/motions/import`

<CodeGroup>
  ```go Go theme={null}
  body := strings.NewReader(`{"template_id":"YOUR_TEMPLATE_ID","name":"Campaign dance"}`); req, _ := http.NewRequest("POST", "https://apis.viggle.ai/v1/motions/import", body); req.Header.Set("Authorization", "Bearer "+os.Getenv("VIGGLE_API_KEY")); req.Header.Set("Content-Type", "application/json"); resp, _ := http.DefaultClient.Do(req)
  ```

  ```javascript JavaScript theme={null}
  const resp = await fetch("https://apis.viggle.ai/v1/motions/import", {method:"POST", headers:{Authorization:`Bearer ${process.env.VIGGLE_API_KEY}`, "Content-Type":"application/json"}, body:JSON.stringify({template_id:"YOUR_TEMPLATE_ID", name:"Campaign dance"})});
  ```

  ```python Python theme={null}
  resp = requests.post("https://apis.viggle.ai/v1/motions/import", headers={"Authorization": f"Bearer {os.environ['VIGGLE_API_KEY']}"}, json={"template_id":"YOUR_TEMPLATE_ID", "name":"Campaign dance"})
  ```

  ```bash cURL theme={null}
  curl -X POST "https://apis.viggle.ai/v1/motions/import" -H "Authorization: Bearer $VIGGLE_API_KEY" -H "Content-Type: application/json" -d '{"template_id":"YOUR_TEMPLATE_ID","name":"Campaign dance"}'
  ```
</CodeGroup>

## List, get, delete, and export Motions

<CodeGroup>
  ```go Go theme={null}
  req, _ := http.NewRequest("GET", "https://apis.viggle.ai/v1/motions/mot_550e8400-e29b-41d4-a716-446655440000", nil); req.Header.Set("Authorization", "Bearer "+os.Getenv("VIGGLE_API_KEY")); resp, _ := http.DefaultClient.Do(req)
  ```

  ```javascript JavaScript theme={null}
  const resp = await fetch(`https://apis.viggle.ai/v1/motions/${motionId}`, {headers:{Authorization:`Bearer ${process.env.VIGGLE_API_KEY}`}});
  ```

  ```python Python theme={null}
  resp = requests.get(f"https://apis.viggle.ai/v1/motions/{motion_id}", headers={"Authorization": f"Bearer {os.environ['VIGGLE_API_KEY']}"})
  ```

  ```bash cURL theme={null}
  curl "https://apis.viggle.ai/v1/motions" -H "Authorization: Bearer $VIGGLE_API_KEY"
  curl "https://apis.viggle.ai/v1/motions/mot_550e8400-e29b-41d4-a716-446655440000" -H "Authorization: Bearer $VIGGLE_API_KEY"
  curl -X DELETE "https://apis.viggle.ai/v1/motions/mot_550e8400-e29b-41d4-a716-446655440000" -H "Authorization: Bearer $VIGGLE_API_KEY"
  curl "https://apis.viggle.ai/v1/motions/mot_550e8400-e29b-41d4-a716-446655440000/export?download_type=glb" -H "Authorization: Bearer $VIGGLE_API_KEY"
  ```
</CodeGroup>

## Create, list, get, and download a Render

<CodeGroup>
  ```go Go theme={null}
  body := &bytes.Buffer{}; w := multipart.NewWriter(body); w.WriteField("character_id", "char_550e8400-e29b-41d4-a716-446655440000"); w.WriteField("motion_id", "mot_550e8400-e29b-41d4-a716-446655440000"); w.Close()
  req, _ := http.NewRequest("POST", "https://apis.viggle.ai/v1/renders", body); req.Header.Set("Authorization", "Bearer "+os.Getenv("VIGGLE_API_KEY")); req.Header.Set("Content-Type", w.FormDataContentType()); resp, _ := http.DefaultClient.Do(req)
  ```

  ```javascript JavaScript theme={null}
  const form = new FormData(); form.append("character_id", characterId); form.append("motion_id", motionId);
  const resp = await fetch("https://apis.viggle.ai/v1/renders", {method:"POST", headers:{Authorization:`Bearer ${process.env.VIGGLE_API_KEY}`}, body:form});
  ```

  ```python Python theme={null}
  resp = requests.post("https://apis.viggle.ai/v1/renders", headers={"Authorization": f"Bearer {os.environ['VIGGLE_API_KEY']}"}, data={"character_id": character_id, "motion_id": motion_id})
  ```

  ```bash cURL theme={null}
  curl -X POST "https://apis.viggle.ai/v1/renders" -H "Authorization: Bearer $VIGGLE_API_KEY" -F "character_id=char_550e8400-e29b-41d4-a716-446655440000" -F "motion_id=mot_550e8400-e29b-41d4-a716-446655440000"
  curl "https://apis.viggle.ai/v1/videos?status=ready&limit=20" -H "Authorization: Bearer $VIGGLE_API_KEY"
  curl "https://apis.viggle.ai/v1/videos/render_8f50b2c2c2b84ae0" -H "Authorization: Bearer $VIGGLE_API_KEY"
  curl -L "https://apis.viggle.ai/v1/renders/render_8f50b2c2c2b84ae0/download" -H "Authorization: Bearer $VIGGLE_API_KEY" -o output.mp4
  ```
</CodeGroup>

Listing and status checks go through `GET /v1/videos` / `GET /v1/videos/{video_id}` — see [List Videos](/v1/api-reference/videos/list) and [Get Video](/v1/api-reference/videos/get). The equivalent `GET /v1/renders` and `GET /v1/renders/{render_id}` are retired (`405`).

There is no cancel endpoint. See [Renders](/v1/api-reference/renders) for parameter combinations and response fields.

## Create a Render from a prepared draft

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://apis.viggle.ai/v1/renders/prepare" \
    -H "Authorization: Bearer $VIGGLE_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"character":{"kind":"asset","asset_id":"char_550e8400-e29b-41d4-a716-446655440000"},"motion":{"kind":"asset","asset_id":"mot_550e8400-e29b-41d4-a716-446655440000"}}'

  curl -X POST "https://apis.viggle.ai/v1/renders" \
    -H "Authorization: Bearer $VIGGLE_API_KEY" \
    -H "Content-Type: application/json" \
    -H "Idempotency-Key: $(uuidgen)" \
    -d '{"draft_id":"draft_abc123"}'
  ```

  ```python Python theme={null}
  import os, uuid, requests

  headers = {"Authorization": f"Bearer {os.environ['VIGGLE_API_KEY']}"}
  draft = requests.post(
      "https://apis.viggle.ai/v1/renders/prepare",
      headers=headers,
      json={
          "character": {"kind": "asset", "asset_id": "char_550e8400-e29b-41d4-a716-446655440000"},
          "motion": {"kind": "asset", "asset_id": "mot_550e8400-e29b-41d4-a716-446655440000"},
      },
  ).json()

  render = requests.post(
      "https://apis.viggle.ai/v1/renders",
      headers={**headers, "Idempotency-Key": str(uuid.uuid4())},
      json={"draft_id": draft["draft_id"]},
  )
  render.raise_for_status()
  ```
</CodeGroup>

When either source is `kind: "upload"`, `PUT` the bytes to each `uploads[].url` from the prepare response before calling `POST /v1/renders`. See [Prepare Render](/v1/api-reference/renders/prepare) for the full flow.

## Watch a Render over Server-Sent Events

<CodeGroup>
  ```bash cURL theme={null}
  curl -N "https://apis.viggle.ai/v1/renders/render_8f50b2c2c2b84ae0/events" \
    -H "Authorization: Bearer $VIGGLE_API_KEY" \
    -H "Accept: text/event-stream"
  ```
</CodeGroup>

See [Watch Render](/v1/api-reference/renders/events) for the event vocabulary and reconnect semantics.

## Generate a Video — `POST /v1/videos`

Text-to-video, first-frame-to-video, first+last-frame-to-video, reference-video/image generation, and character-animation generation all share this endpoint — which mode runs depends on which fields you send.

<CodeGroup>
  ```bash cURL (text-to-video) theme={null}
  curl "https://apis.viggle.ai/v1/videos" \
    -H "Authorization: Bearer $VIGGLE_API_KEY" \
    -F prompt="a paper airplane gliding through a sunlit office" \
    -F quality=low \
    -F duration_s=5
  ```

  ```bash cURL (first-frame-to-video) theme={null}
  curl "https://apis.viggle.ai/v1/videos" \
    -H "Authorization: Bearer $VIGGLE_API_KEY" \
    -F prompt="camera slowly zooms out" \
    -F quality=high \
    -F first_frame_image_url=https://example.test/first.png
  ```

  ```bash cURL (first+last-frame-to-video) theme={null}
  curl "https://apis.viggle.ai/v1/videos" \
    -H "Authorization: Bearer $VIGGLE_API_KEY" \
    -F prompt="camera pans across the room" \
    -F quality=low \
    -F first_frame_image_url=https://example.test/first.png \
    -F last_frame_image_url=https://example.test/last.png
  ```

  ```bash cURL (reference-video/image) theme={null}
  curl "https://apis.viggle.ai/v1/videos" \
    -H "Authorization: Bearer $VIGGLE_API_KEY" \
    -F prompt="keep the same outfit and walk forward" \
    -F quality=high \
    -F reference_video_url=https://example.test/reference.mp4 \
    -F reference_image_url=https://example.test/ref1.png
  ```

  ```bash cURL (character-animation) theme={null}
  curl "https://apis.viggle.ai/v1/videos" \
    -H "Authorization: Bearer $VIGGLE_API_KEY" \
    -F driving_video_url=https://example.test/driving.mp4 \
    -F character_image_url=https://example.test/char1.png
  ```

  ```python Python theme={null}
  import os, requests
  resp = requests.post(
      "https://apis.viggle.ai/v1/videos",
      headers={"Authorization": f"Bearer {os.environ['VIGGLE_API_KEY']}"},
      data={"prompt": "camera slowly zooms out", "quality": "high"},
      files={"first_frame_image": open("first.png", "rb")},
  )
  resp.raise_for_status()
  video = resp.json()
  ```
</CodeGroup>

All five modes answer `200` with the same `{id, status, progress, created_at}` acceptance shape. See [Generate Video (from Text)](/v1/api-reference/videos/create-from-text), [Generate Video (from First Frame and/or Text)](/v1/api-reference/videos/create-from-first-frame), [Generate Video (from First-Last Frames and/or Text)](/v1/api-reference/videos/create-from-first-last-frame), [Generate Video (from Reference Video/Image)](/v1/api-reference/videos/create-from-reference-video), and [Using Viggle-Animate](/v1/api-reference/videos/create-from-character-animation) for the full field reference and common validation errors.

## Endpoint-by-endpoint request examples

The following compact examples show the exact HTTP method, path, and request shape for every endpoint. In the Go snippets, `client` is an `http.Client`; in JavaScript, `apiKey` is your API key; in Python, `headers` is `{"Authorization": "Bearer ..."}`.

### `GET /v1/characters`

<CodeGroup>
  ```go Go theme={null}
  req, _ := http.NewRequest("GET", base+"/characters", nil); req.Header.Set("Authorization", "Bearer "+apiKey); resp, _ := client.Do(req)
  ```

  ```javascript JavaScript theme={null}
  const resp = await fetch(`${base}/characters`, {headers:{Authorization:`Bearer ${apiKey}`}});
  ```

  ```python Python theme={null}
  resp = requests.get(f"{base}/characters", headers=headers)
  ```

  ```bash cURL theme={null}
  curl "$BASE/characters" -H "Authorization: Bearer $VIGGLE_API_KEY"
  ```
</CodeGroup>

### `GET /v1/characters/{character_id}`

<CodeGroup>
  ```go Go theme={null}
  req, _ := http.NewRequest("GET", base+"/characters/"+characterID, nil); req.Header.Set("Authorization", "Bearer "+apiKey); resp, _ := client.Do(req)
  ```

  ```javascript JavaScript theme={null}
  const resp = await fetch(`${base}/characters/${characterId}`, {headers:{Authorization:`Bearer ${apiKey}`}});
  ```

  ```python Python theme={null}
  resp = requests.get(f"{base}/characters/{character_id}", headers=headers)
  ```

  ```bash cURL theme={null}
  curl "$BASE/characters/$CHARACTER_ID" -H "Authorization: Bearer $VIGGLE_API_KEY"
  ```
</CodeGroup>

### `DELETE /v1/characters/{character_id}`

<CodeGroup>
  ```go Go theme={null}
  req, _ := http.NewRequest("DELETE", base+"/characters/"+characterID, nil); req.Header.Set("Authorization", "Bearer "+apiKey); resp, _ := client.Do(req)
  ```

  ```javascript JavaScript theme={null}
  const resp = await fetch(`${base}/characters/${characterId}`, {method:"DELETE", headers:{Authorization:`Bearer ${apiKey}`}});
  ```

  ```python Python theme={null}
  resp = requests.delete(f"{base}/characters/{character_id}", headers=headers)
  ```

  ```bash cURL theme={null}
  curl -X DELETE "$BASE/characters/$CHARACTER_ID" -H "Authorization: Bearer $VIGGLE_API_KEY"
  ```
</CodeGroup>

### `GET /v1/characters/{character_id}/export`

<CodeGroup>
  ```go Go theme={null}
  req, _ := http.NewRequest("GET", base+"/characters/"+characterID+"/export?download_type=vsplat", nil); req.Header.Set("Authorization", "Bearer "+apiKey); resp, _ := client.Do(req)
  ```

  ```javascript JavaScript theme={null}
  const resp = await fetch(`${base}/characters/${characterId}/export?download_type=vsplat`, {headers:{Authorization:`Bearer ${apiKey}`}});
  ```

  ```python Python theme={null}
  resp = requests.get(f"{base}/characters/{character_id}/export", params={"download_type": "vsplat"}, headers=headers)
  ```

  ```bash cURL theme={null}
  curl "$BASE/characters/$CHARACTER_ID/export?download_type=vsplat" -H "Authorization: Bearer $VIGGLE_API_KEY"
  ```
</CodeGroup>

### `GET /v1/motions`

<CodeGroup>
  ```go Go theme={null}
  req, _ := http.NewRequest("GET", base+"/motions", nil); req.Header.Set("Authorization", "Bearer "+apiKey); resp, _ := client.Do(req)
  ```

  ```javascript JavaScript theme={null}
  const resp = await fetch(`${base}/motions`, {headers:{Authorization:`Bearer ${apiKey}`}});
  ```

  ```python Python theme={null}
  resp = requests.get(f"{base}/motions", headers=headers)
  ```

  ```bash cURL theme={null}
  curl "$BASE/motions" -H "Authorization: Bearer $VIGGLE_API_KEY"
  ```
</CodeGroup>

### `GET /v1/motions/{motion_id}`

<CodeGroup>
  ```go Go theme={null}
  req, _ := http.NewRequest("GET", base+"/motions/"+motionID, nil); req.Header.Set("Authorization", "Bearer "+apiKey); resp, _ := client.Do(req)
  ```

  ```javascript JavaScript theme={null}
  const resp = await fetch(`${base}/motions/${motionId}`, {headers:{Authorization:`Bearer ${apiKey}`}});
  ```

  ```python Python theme={null}
  resp = requests.get(f"{base}/motions/{motion_id}", headers=headers)
  ```

  ```bash cURL theme={null}
  curl "$BASE/motions/$MOTION_ID" -H "Authorization: Bearer $VIGGLE_API_KEY"
  ```
</CodeGroup>

### `DELETE /v1/motions/{motion_id}`

<CodeGroup>
  ```go Go theme={null}
  req, _ := http.NewRequest("DELETE", base+"/motions/"+motionID, nil); req.Header.Set("Authorization", "Bearer "+apiKey); resp, _ := client.Do(req)
  ```

  ```javascript JavaScript theme={null}
  const resp = await fetch(`${base}/motions/${motionId}`, {method:"DELETE", headers:{Authorization:`Bearer ${apiKey}`}});
  ```

  ```python Python theme={null}
  resp = requests.delete(f"{base}/motions/{motion_id}", headers=headers)
  ```

  ```bash cURL theme={null}
  curl -X DELETE "$BASE/motions/$MOTION_ID" -H "Authorization: Bearer $VIGGLE_API_KEY"
  ```
</CodeGroup>

### `GET /v1/motions/{motion_id}/export`

<CodeGroup>
  ```go Go theme={null}
  req, _ := http.NewRequest("GET", base+"/motions/"+motionID+"/export?download_type=glb", nil); req.Header.Set("Authorization", "Bearer "+apiKey); resp, _ := client.Do(req)
  ```

  ```javascript JavaScript theme={null}
  const resp = await fetch(`${base}/motions/${motionId}/export?download_type=glb`, {headers:{Authorization:`Bearer ${apiKey}`}});
  ```

  ```python Python theme={null}
  resp = requests.get(f"{base}/motions/{motion_id}/export", params={"download_type": "glb"}, headers=headers)
  ```

  ```bash cURL theme={null}
  curl "$BASE/motions/$MOTION_ID/export?download_type=glb" -H "Authorization: Bearer $VIGGLE_API_KEY"
  ```
</CodeGroup>

### `GET /v1/videos`

Replaces the retired `GET /v1/renders` (now `405 Method Not Allowed`). Lists Renders, H3 generations, and character-animation generations merged into one feed.

<CodeGroup>
  ```go Go theme={null}
  req, _ := http.NewRequest("GET", base+"/videos?status=ready&limit=20", nil); req.Header.Set("Authorization", "Bearer "+apiKey); resp, _ := client.Do(req)
  ```

  ```javascript JavaScript theme={null}
  const resp = await fetch(`${base}/videos?status=ready&limit=20`, {headers:{Authorization:`Bearer ${apiKey}`}});
  ```

  ```python Python theme={null}
  resp = requests.get(f"{base}/videos", params={"status": "ready", "limit": 20}, headers=headers)
  ```

  ```bash cURL theme={null}
  curl "$BASE/videos?status=ready&limit=20" -H "Authorization: Bearer $VIGGLE_API_KEY"
  ```
</CodeGroup>

### `GET /v1/videos/{video_id}`

Replaces the retired `GET /v1/renders/{render_id}` (now `405 Method Not Allowed`). Accepts a `render_` or `vid_` prefixed ID.

<CodeGroup>
  ```go Go theme={null}
  req, _ := http.NewRequest("GET", base+"/videos/"+videoID, nil); req.Header.Set("Authorization", "Bearer "+apiKey); resp, _ := client.Do(req)
  ```

  ```javascript JavaScript theme={null}
  const resp = await fetch(`${base}/videos/${videoId}`, {headers:{Authorization:`Bearer ${apiKey}`}});
  ```

  ```python Python theme={null}
  resp = requests.get(f"{base}/videos/{video_id}", headers=headers)
  ```

  ```bash cURL theme={null}
  curl "$BASE/videos/$VIDEO_ID" -H "Authorization: Bearer $VIGGLE_API_KEY"
  ```
</CodeGroup>

### `GET /v1/renders/{render_id}/events`

<CodeGroup>
  ```go Go theme={null}
  req, _ := http.NewRequest("GET", base+"/renders/"+renderID+"/events", nil); req.Header.Set("Authorization", "Bearer "+apiKey); req.Header.Set("Accept", "text/event-stream"); resp, _ := client.Do(req)
  ```

  ```bash cURL theme={null}
  curl -N "$BASE/renders/$RENDER_ID/events" -H "Authorization: Bearer $VIGGLE_API_KEY" -H "Accept: text/event-stream"
  ```
</CodeGroup>

### `GET /v1/renders/{render_id}/download`

<CodeGroup>
  ```go Go theme={null}
  req, _ := http.NewRequest("GET", base+"/renders/"+renderID+"/download", nil); req.Header.Set("Authorization", "Bearer "+apiKey); resp, _ := client.Do(req)
  ```

  ```javascript JavaScript theme={null}
  const resp = await fetch(`${base}/renders/${renderId}/download`, {headers:{Authorization:`Bearer ${apiKey}`}});
  ```

  ```python Python theme={null}
  resp = requests.get(f"{base}/renders/{render_id}/download", headers=headers, allow_redirects=True)
  ```

  ```bash cURL theme={null}
  curl -L "$BASE/renders/$RENDER_ID/download" -H "Authorization: Bearer $VIGGLE_API_KEY" -o output.mp4
  ```
</CodeGroup>


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