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

# Prepare a render



## OpenAPI

````yaml /openapi.yaml post /v1/renders/prepare
openapi: 3.0.3
info:
  title: Viggle API
  description: >
    The Viggle API generates AI video (Viggle H3, Viggle Remake, Video

    Remix), images (Viggle Image), 2x video upscaling (FlashVSR), and JST-2

    3D characters, motions, and scenes. Every job is asynchronous: create it,

    then poll (or, for renders, watch) until it reaches a terminal status.


    Base URL: `https://apis.viggle.ai`. Authenticate every request with

    `Authorization: Bearer <API key>`. Usage is billed in credits

    (1 credit = $0.01). Guides and pricing:
    https://docs.viggle.ai/v1/introduction
  version: 2.0.0
  contact:
    name: Viggle Support
    url: https://viggle.ai
servers:
  - url: https://apis.viggle.ai
    description: Production server
security:
  - bearerAuth: []
tags:
  - name: Renders
    description: >-
      Video Remix (JST-1). Prepare inputs, create renders, watch progress,
      cancel, and download results. Read render status through `GET
      /v1/videos/{video_id}`.
  - name: Credits
    description: Read the credit balance available to the calling API key.
  - name: Characters
    description: |
      Create, list, inspect, and delete reusable character assets. `type`
      selects whether creation also extracts a 3D vsplat; export its
      download URL separately once ready.
  - name: Motions
    description: |
      Create, list, inspect, and delete reusable motion assets, and import one
      from an official motion template. `type` selects whether creation also
      extracts or generates a 3D animation; export its download URL
      separately once ready.
  - name: Videos
    description: |
      Generate a Viggle H3 video from text, frames, or references (`vid_`
      prefix) or a Viggle Remake video from a driving video and character
      images (`anim_` prefix), upscale a video 2x with FlashVSR (`vsr_`
      prefix), and read the unified view over every video the calling API
      key created — H3 generations, Remake generations, and Video Remix
      renders (`render_` prefix) — merged into one resource.
  - name: Images
    description: |
      Viggle Image — generate 1–6 PNG images from a text prompt,
      optionally guided by up to 8 reference images
      (`img_` prefix), and retrieve them by ID.
  - name: Scenes
    description: |
      Scene model — build a 3D Gaussian-splat scene (`.spz`) from a text
      prompt or a 360° panorama, generate new posed views of it, and
      reconstruct it from those views. Every operation is an asynchronous
      task (`scn_` prefix) read back by ID. Every run costs 1 credit per
      view, and a panorama counts as 6 views. Credits are refunded in full
      unless the task finishes `ready`.
paths:
  /v1/renders/prepare:
    post:
      tags:
        - Renders
      summary: Prepare a render
      operationId: prepareRender
      parameters:
        - $ref: '#/components/parameters/RequestId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PrepareRenderRequest'
      responses:
        '200':
          description: Draft and any uploads required before render creation.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PrepareRenderResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/V1Unauthorized'
        '404':
          description: >-
            A saved character or motion named in the draft doesn't exist, was
            deleted, or can't be used by this account. Code
            `CHARACTER_NOT_FOUND` or `MOTION_NOT_FOUND`.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
components:
  parameters:
    RequestId:
      name: X-Request-Id
      in: header
      required: false
      description: >-
        Optional caller-supplied correlation ID, echoed as sent in the response
        header. Omit it and the service generates one. Use it for tracing and
        support.
      schema:
        type: string
        minLength: 1
  schemas:
    PrepareRenderRequest:
      type: object
      additionalProperties: false
      required:
        - character
        - motion
      properties:
        character:
          description: >-
            Character input for the render. Choose exactly one source
            form—direct upload metadata, a public HTTPS URL, or a reusable asset
            ID.
          allOf:
            - $ref: '#/components/schemas/CharacterSource'
        motion:
          description: >-
            Motion input for the render. Choose a direct upload, public HTTPS
            URL, or reusable Motion ID. To use a Viggle motion template, import
            it with `POST /v1/motions/import` first and pass the resulting
            Motion ID.
          allOf:
            - $ref: '#/components/schemas/MotionSource'
        output:
          description: >-
            Optional output settings. Omitted fields use the service defaults
            described by `RenderOutputOptions`.
          allOf:
            - $ref: '#/components/schemas/RenderOutputOptions'
    PrepareRenderResponse:
      type: object
      additionalProperties: false
      required:
        - draft_id
        - state
        - uploads
      properties:
        draft_id:
          type: string
          description: >-
            Opaque prepared-render draft identifier. Pass it unchanged to `POST
            /v1/renders` after completing any required uploads.
          minLength: 1
        state:
          type: string
          description: >-
            Whether media uploads must be completed before creation.
            `ready_to_create` means the draft can be submitted immediately.
          enum:
            - awaiting_uploads
            - ready_to_create
        uploads:
          type: array
          description: >-
            Direct-upload plans for inputs declared with `kind: upload`; empty
            when every source is already available to the service.
          items:
            $ref: '#/components/schemas/UploadPlan'
    ErrorResponse:
      type: object
      additionalProperties: false
      required:
        - error
      properties:
        error:
          description: >-
            Error payload containing the stable code, message, retry guidance,
            correlation ID, and error-specific details.
          allOf:
            - $ref: '#/components/schemas/ErrorBody'
    CharacterSource:
      oneOf:
        - $ref: '#/components/schemas/UploadSource'
        - $ref: '#/components/schemas/UrlSource'
        - $ref: '#/components/schemas/AssetSource'
    MotionSource:
      oneOf:
        - $ref: '#/components/schemas/UploadSource'
        - $ref: '#/components/schemas/UrlSource'
        - $ref: '#/components/schemas/AssetSource'
    RenderOutputOptions:
      type: object
      additionalProperties: false
      properties:
        background_mode:
          description: >
            Controls how the background is produced. `original` preserves or
            reconstructs the source background; `green` and `white` are
            translated to the pipeline's solid mode with the matching colour;
            `transparent` requests a separate alpha/mask output for compositing.
          type: string
          enum:
            - original
            - green
            - white
            - transparent
        aspect_ratio:
          description: >
            Only `source` is served today. The render pipeline does not reframe
            yet, so any other value is rejected rather than silently ignored.
          type: string
          enum:
            - source
            - '16:9'
            - '9:16'
            - '1:1'
    UploadPlan:
      type: object
      additionalProperties: false
      required:
        - slot
        - upload_handle
        - method
        - url
        - required_headers
        - expires_at
      properties:
        slot:
          type: string
          description: >-
            Input slot this upload satisfies. Upload the corresponding character
            image or motion video to the supplied URL.
          enum:
            - character
            - motion
        upload_handle:
          type: string
          description: Opaque identifier for this planned upload.
          minLength: 1
        method:
          type: string
          description: HTTP method required for the direct upload; currently always `PUT`.
          enum:
            - PUT
        url:
          type: string
          format: uri
          description: >-
            Presigned URL, valid for 1 hour, to which the media bytes must be
            uploaded directly.
        required_headers:
          type: object
          description: >-
            Exact HTTP headers that must be included with the direct upload,
            commonly including the declared content type.
          additionalProperties:
            type: string
        expires_at:
          type: string
          format: date-time
          description: >-
            ISO 8601 expiration time of the presigned upload URL. Prepare a new
            draft if the upload cannot finish before this time.
    ErrorBody:
      type: object
      additionalProperties: false
      required:
        - code
        - message
        - retryable
        - request_id
        - details
        - remediation
      properties:
        code:
          description: >-
            Stable, machine-readable error code. Use it for programmatic
            handling instead of parsing `message`.
          allOf:
            - $ref: '#/components/schemas/ErrorCode'
        message:
          type: string
          description: >-
            Human-readable explanation suitable for logs or presentation to a
            developer.
        retryable:
          type: boolean
          description: >-
            Whether retrying the operation without changing its input may
            succeed. True for HTTP 408, 429, and 5xx responses.
        request_id:
          type: string
          description: >-
            Correlation identifier for tracing and support. Include it when
            reporting the failure.
        details:
          type: object
          description: Error-specific structured context; available keys depend on `code`.
          additionalProperties: true
        remediation:
          description: Suggested recovery action and optional retry delay.
          allOf:
            - $ref: '#/components/schemas/ErrorRemediation'
    UploadSource:
      type: object
      additionalProperties: false
      required:
        - kind
        - filename
        - content_type
        - bytes
      properties:
        kind:
          type: string
          description: >-
            Source discriminator. Set to `upload` when the media will be
            uploaded through the returned direct-upload plan.
          enum:
            - upload
        filename:
          type: string
          description: >-
            Original filename, including its extension, used to identify and
            validate the uploaded media.
          minLength: 1
        content_type:
          type: string
          description: >-
            MIME type of the file to upload, such as `image/png` or `video/mp4`;
            it must match the upload request header.
          minLength: 1
        bytes:
          type: integer
          format: int64
          description: >-
            Exact file size in bytes. The uploaded object's size is checked
            against this declaration.
          minimum: 1
        sha256:
          type: string
          description: >-
            Optional SHA-256 digest of the exact upload bytes, encoded as 64
            lowercase hexadecimal characters. When supplied, the service
            verifies it before creating the render.
          pattern: ^[0-9a-f]{64}$
    UrlSource:
      type: object
      additionalProperties: false
      required:
        - kind
        - url
      properties:
        kind:
          type: string
          description: >-
            Source discriminator. Set to `url` when Viggle should fetch the
            media from a remote HTTPS address.
          enum:
            - url
        url:
          type: string
          format: uri
          description: >-
            Publicly reachable HTTPS URL of the source media. The URL must
            remain accessible while the render is being prepared.
          pattern: ^https://
    AssetSource:
      type: object
      additionalProperties: false
      required:
        - kind
        - asset_id
      properties:
        kind:
          type: string
          description: >-
            Source discriminator. Set to `asset` to reuse a character or motion
            already stored in the caller's account.
          enum:
            - asset
        asset_id:
          type: string
          description: >-
            ID of a ready reusable asset. Use a Character ID for the character
            slot and a Motion ID for the motion slot.
          minLength: 1
    ErrorCode:
      description: |
        Error codes the API emits, in the synchronous error envelope and in
        the `error` object of a failed job. Clients should tolerate codes not
        listed here. Asynchronous failures that have no public mapping
        surface as `PROCESSING_FAILED`.
      type: string
      enum:
        - INVALID_REQUEST
        - UNAUTHENTICATED
        - INVALID_CREDENTIAL
        - INSUFFICIENT_CREDITS
        - RENDER_NOT_FOUND
        - CHARACTER_NOT_FOUND
        - MOTION_NOT_FOUND
        - DRAFT_NOT_FOUND
        - NOT_FOUND
        - RESULT_EXPIRED
        - IDEMPOTENCY_KEY_REUSED
        - ID_ALREADY_EXISTS
        - UPLOAD_TIMEOUT
        - CONTENT_POLICY_VIOLATION
        - RATE_LIMITED
        - SERVICE_BUSY
        - INTERNAL_ERROR
        - IMAGE_REQUIRED
        - MOTION_VIDEO_REQUIRED
        - UNSUPPORTED_MEDIA
        - VIDEO_TOO_LONG
        - VIDEO_TOO_LARGE
        - VIDEO_RESOLUTION_TOO_HIGH
        - VIDEO_UNREADABLE
        - VIDEO_DIMENSIONS_MUST_BE_EVEN
        - VIDEO_INACCESSIBLE
        - NO_HUMANS_DETECTED
        - MOTION_NOT_READY
        - MOTION_MODEL_MISMATCH
        - INVALID_BACKGROUND_MODE
        - ALL_WORKERS_BUSY
        - WORKER_STOPPED
        - TASK_FAILED
        - PROCESSING_FAILED
    ErrorRemediation:
      type: object
      additionalProperties: false
      required:
        - action
        - retry_after_ms
      properties:
        action:
          type: string
          enum:
            - none
            - retry
          description: >-
            Suggested next action. Synchronous errors always carry `none`; a
            failed job's `error` carries `retry` when the failure is retryable.
        retry_after_ms:
          type: integer
          description: >-
            Recommended delay in milliseconds before retrying; null when no
            timed retry is advised.
          nullable: true
          format: int64
          minimum: 0
  headers:
    RequestId:
      description: Stable request identifier for support and tracing.
      schema:
        type: string
  responses:
    BadRequest:
      description: Invalid request.
      headers:
        X-Request-Id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    V1Unauthorized:
      description: Missing or invalid API key. Code `UNAUTHENTICATED`.
      headers:
        X-Request-Id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    InternalServerError:
      description: Unexpected server error.
      headers:
        X-Request-Id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    ServiceUnavailable:
      description: Service temporarily unavailable.
      headers:
        Retry-After:
          schema:
            type: integer
            minimum: 0
        X-Request-Id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key
      description: |
        Send your API key as `Authorization: Bearer <API key>`. Keys begin
        with `sk-`. A missing or invalid key answers `401 UNAUTHENTICATED`.
        Never expose an API key in browser code.

````

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