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

# Kling V2.1 Master

Generate videos from a source image using the `kling/v2-1-master-image-to-video` model.

## Authentication

All API requests require a Bearer Token.

```http theme={null}
Authorization: Bearer YOUR_API_KEY
```

## Create a Video Generation Task

Submit an image-to-video generation task using the endpoint below.

```http theme={null}
POST /api/v1/jobs/createTask
```

### Request Body

| Field   | Type   | Required | Description                                     |
| ------- | ------ | -------- | ----------------------------------------------- |
| `model` | string | Yes      | The model used for video generation.            |
| `input` | object | Yes      | Input parameters for the video generation task. |

<ParamField body="model" type="string" required>
  Must be `kling/v2-1-master-image-to-video`.
</ParamField>

<ParamField body="input" type="object" required>
  ## Input Parameters

  The `input` object contains the parameters used to generate the video.

  <ParamField body="prompt" type="string" required>
    The `prompt` describes the video you want to generate.

    **Maximum length:** `5000` characters.
  </ParamField>

  ### Source Image

  <ParamField body="image_url" type="string" required>
    The `image_url` must contain the URL of an uploaded image.

    Supported image formats:

    * `image/jpeg`
    * `image/png`

    Maximum file size: `10 MB`
  </ParamField>

  <ParamField body="duration" type="string">
    Use `duration` to specify the length of the generated video.

    Supported values:

    * `"5"`
    * `"10"`

    Default value: `"5"`
  </ParamField>

  <ParamField body="negative_prompt" type="string">
    Use `negative_prompt` to exclude specific elements or qualities from the generated video.

    **Maximum length:** `500` characters.
  </ParamField>

  <ParamField body="cfg_scale" type="string">
    The `cfg_scale` parameter controls how closely the model follows your prompt.

    | Setting | Value |
    | ------- | ----- |
    | Minimum | `0`   |
    | Maximum | `1`   |
    | Step    | `0.1` |
    | Default | `0.5` |
  </ParamField>
</ParamField>

## Example Request

```json theme={null}
{
  "model": "kling/v2-1-master-image-to-video",
  "input": {
    "prompt": "A team of paratroopers descends into enemy territory, as they pass through clouds, the camera switches to a slow pan above the battlefield lighting up with...",
    "image_url": "https://demo.com/1755256297923.png",
    "duration": "5",
    "negative_prompt": "blur, distort, and low quality",
    "cfg_scale": 0.5
  }
}
```

## Response

### Successful Response

A successful request returns a task ID.

<ResponseField name="code" type="number">
  Response status code.
</ResponseField>

<ResponseField name="msg" type="string">
  Response message. Contains the error description when the request fails.

  **Example:** `success`
</ResponseField>

<ResponseField name="data" type="object" required>
  The task data object containing task id.

  <ResponseField name="taskId" type="string" required>
    The unique identifier for this task.

    **Example:** `task_123456`
  </ResponseField>
</ResponseField>

Use the returned `taskId` with the Get Task Details endpoint to check task progress and retrieve the generation results.

<Card title="Get Task Details" icon="search" href="/get-task-detail">
  Learn how to query task status and retrieve generation results.
</Card>

### Error Response

```json theme={null}
{
  "code": 500,
  "msg": "Server Error - An unexpected error occurred while processing the request",
  "data": null
}
```

## API Response Codes

| Code  | Status               | Description                                                        |
| ----- | -------------------- | ------------------------------------------------------------------ |
| `200` | Success              | Request processed successfully.                                    |
| `401` | Unauthorized         | Authentication credentials are missing or invalid.                 |
| `402` | Insufficient Credits | The account does not have enough credits to perform the operation. |
| `404` | Not Found            | The requested resource or endpoint does not exist.                 |
| `422` | Validation Error     | Request parameters failed validation checks.                       |
| `429` | Rate Limited         | The request limit has been exceeded for this resource.             |
| `433` | Request Limit        | Sub-key usage exceeds the allowed limit.                           |
| `455` | Service Unavailable  | The system is currently undergoing maintenance.                    |
| `500` | Server Error         | An unexpected error occurred while processing the request.         |
| `501` | Generation Failed    | The content generation task failed.                                |
| `505` | Feature Disabled     | The requested feature is currently disabled.                       |
