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

# Create a Genjutsu task

Select one of the three modes. Read the [limits and billing rules](https://docs.gengen.farm/api-reference/higgsfield/genjutsu/overview.md) before submitting. Submit once and retrieve the returned task ID. An interrupted submission can have an uncertain outcome; do not automatically submit another task.

For pending tasks, poll the returned ID. The successful task detail includes `usage` with billable seconds and the applicable price row. See [usage fields](https://docs.gengen.farm/api-reference/higgsfield/genjutsu/retrieve-task.md#usage).


## OpenAPI

````yaml openapi/genjutsu-video.yaml POST /contents/generations/tasks
openapi: 3.1.0
info:
  title: Genjutsu video API
  version: 1.0.0
servers:
  - url: https://gengen.farm/v1
security:
  - bearerAuth: []
paths:
  /contents/generations/tasks:
    post:
      summary: Create a Genjutsu task
      operationId: createGenjutsuTask
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateGenjutsuTask'
      responses:
        '200':
          description: Task accepted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VideoTask'
              example:
                id: higgsfieldgenjutsu:12345678-1234-4234-8234-123456789abc
                model: higgsfield-genjutsu
                status: queued
                outputs:
                  videos: []
                  images: []
        '400':
          description: Invalid mode, media, or controls.
        '401':
          description: Invalid API key.
        '402':
          description: Insufficient wallet balance.
        '429':
          description: Rate limited.
        '502':
          description: >-
            Upstream outcome could not be confirmed; do not automatically
            resubmit.
        '503':
          description: Provider unavailable.
components:
  schemas:
    CreateGenjutsuTask:
      oneOf:
        - type: object
          additionalProperties: false
          required:
            - model
            - mode
            - assets
          properties:
            model:
              type: string
              const: higgsfield-genjutsu
            mode:
              type: string
              const: motion_transfer
            prompt:
              type: string
              maxLength: 10000
              default: ''
            assets:
              type: object
              additionalProperties: false
              required:
                - sourceVideo
                - referenceImages
              properties:
                sourceVideo:
                  type: string
                  format: uri
                  pattern: ^https://
                  description: >-
                    At least 4 seconds, at most 200 MiB. Only first 30 seconds
                    processed.
                referenceImages:
                  type: array
                  minItems: 1
                  maxItems: 8
                  items:
                    type: string
                    format: uri
                    pattern: ^https://
            controls:
              type: object
              additionalProperties: false
              required: []
              properties:
                resolution:
                  type: string
                  enum:
                    - 480p
                    - 720p
                    - 1080p
                  default: 720p
        - type: object
          additionalProperties: false
          required:
            - model
            - mode
            - assets
          properties:
            model:
              type: string
              const: higgsfield-genjutsu
            mode:
              type: string
              const: object_swap
            prompt:
              type: string
              maxLength: 10000
              default: ''
            assets:
              type: object
              additionalProperties: false
              required:
                - sourceVideo
                - referenceImages
              properties:
                sourceVideo:
                  type: string
                  format: uri
                  pattern: ^https://
                  description: >-
                    At least 4 seconds, at most 200 MiB. Only first 30 seconds
                    processed.
                referenceImages:
                  type: array
                  minItems: 1
                  maxItems: 8
                  items:
                    type: string
                    format: uri
                    pattern: ^https://
            controls:
              type: object
              additionalProperties: false
              required: []
              properties:
                resolution:
                  type: string
                  enum:
                    - 480p
                    - 720p
                    - 1080p
                  default: 720p
        - type: object
          additionalProperties: false
          required:
            - model
            - mode
            - assets
            - controls
          properties:
            model:
              type: string
              const: higgsfield-genjutsu
            mode:
              type: string
              const: restyle
            prompt:
              type: string
              maxLength: 10000
              default: ''
            assets:
              type: object
              additionalProperties: false
              required:
                - sourceVideo
              properties:
                sourceVideo:
                  type: string
                  format: uri
                  pattern: ^https://
                  description: >-
                    At least 4 seconds, at most 200 MiB. Only first 30 seconds
                    processed.
                referenceImages:
                  type: array
                  minItems: 0
                  maxItems: 5
                  items:
                    type: string
                    format: uri
                    pattern: ^https://
            controls:
              type: object
              additionalProperties: false
              required:
                - presetId
              properties:
                resolution:
                  type: string
                  enum:
                    - 480p
                    - 720p
                    - 1080p
                  default: 720p
                presetId:
                  type: string
                  format: uuid
                  description: A current ID from GET /video/genjutsu/styles.
    VideoTask:
      type: object
      required:
        - id
        - model
        - status
        - outputs
      properties:
        id:
          type: string
          example: higgsfieldgenjutsu:12345678-1234-4234-8234-123456789abc
        model:
          type: string
          const: higgsfield-genjutsu
        status:
          type: string
          enum:
            - queued
            - running
            - succeeded
            - failed
            - cancelled
        outputs:
          type: object
          required:
            - videos
            - images
          properties:
            videos:
              type: array
              items:
                type: string
                format: uri
            images:
              type: array
              maxItems: 0
              items:
                type: string
        usage:
          type: object
          description: >-
            Successful task detail. Billable seconds are the source video
            duration clipped to 30 seconds and rounded up. Mode and resolution
            select the price row.
          required:
            - priceRowId
            - resolution
            - billableSeconds
            - inputVideoDurationSeconds
            - processedDurationSeconds
            - mode
          properties:
            priceRowId:
              type: string
              description: Stable customer price row in GET /api/public/pricing.
            resolution:
              type: string
              description: Resolution tier used for pricing, such as 720p.
            billableSeconds:
              type: number
              description: Seconds to multiply by the selected per-second rate.
            inputVideoDurationSeconds:
              type: number
              description: Input video seconds used for billing.
            processedDurationSeconds:
              type: number
              description: Source video seconds processed before whole-second rounding.
            mode:
              type: string
              description: Source processing mode used to select the rate.
        failureReason:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

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