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

# Assets für virtuelle Avatare

>  - API zur Einreichung privater Assets virtueller Avatare
- Unterstützt Stapeleinreichung, bis zu 20 Assets pro Anfrage
- Erstellt oder nutzt Asset-Gruppen automatisch; gibt eine Task-ID für die Statusabfrage zurück
- Genehmigte Assets können direkt in der Videogenerierung mit Seedance 2.0 verwendet werden 

<RequestExample>
  ```bash cURL (Batch submit · new group) theme={null}
  curl --request POST \
    --url https://api.apimart.ai/v1/seedance2/private-avatar \
    --header 'Authorization: Bearer <token>' \
    --header 'Content-Type: application/json' \
    --data '{
      "group": {
        "name": "virtual-avatar-group",
        "description": "demo group"
      },
      "project_name": "default",
      "asset_type": "Image",
      "assets": [
        {
          "url": "https://example.com/avatar-a.png",
          "name": "avatar-a"
        },
        {
          "url": "https://example.com/avatar-b.png",
          "name": "avatar-b"
        }
      ]
    }'
  ```

  ```bash cURL (Use existing group) theme={null}
  curl --request POST \
    --url https://api.apimart.ai/v1/seedance2/private-avatar \
    --header 'Authorization: Bearer <token>' \
    --header 'Content-Type: application/json' \
    --data '{
      "group_id": "group_xxx",
      "project_name": "default",
      "asset_type": "Image",
      "assets": [
        {
          "url": "https://example.com/avatar-a.png",
          "name": "avatar-a"
        }
      ]
    }'
  ```

  ```python Python theme={null}
  import requests

  url = "https://api.apimart.ai/v1/seedance2/private-avatar"

  payload = {
      "group": {
          "name": "virtual-avatar-group",
          "description": "demo group"
      },
      "project_name": "default",
      "asset_type": "Image",
      "assets": [
          {
              "url": "https://example.com/avatar-a.png",
              "name": "avatar-a"
          },
          {
              "url": "https://example.com/avatar-b.png",
              "name": "avatar-b"
          }
      ]
  }

  headers = {
      "Authorization": "Bearer <token>",
      "Content-Type": "application/json"
  }

  response = requests.post(url, json=payload, headers=headers)

  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const url = "https://api.apimart.ai/v1/seedance2/private-avatar";

  const payload = {
    group: {
      name: "virtual-avatar-group",
      description: "demo group"
    },
    project_name: "default",
    asset_type: "Image",
    assets: [
      {
        url: "https://example.com/avatar-a.png",
        name: "avatar-a"
      },
      {
        url: "https://example.com/avatar-b.png",
        name: "avatar-b"
      }
    ]
  };

  const headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
  };

  fetch(url, {
    method: "POST",
    headers: headers,
    body: JSON.stringify(payload)
  })
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "code": 200,
    "data": {
      "id": "task_01K...",
      "object": "seedance.avatar.asset.task",
      "status": "processing",
      "progress": 10,
      "model": "doubao-seedance-2.0"
    }
  }
  ```

  ```json 400 theme={null}
  {
    "error": {
      "code": 400,
      "message": "Invalid request parameters",
      "type": "invalid_request_error"
    }
  }
  ```

  ```json 401 theme={null}
  {
    "error": {
      "code": 401,
      "message": "Authentication failed. Please check your API key.",
      "type": "authentication_error"
    }
  }
  ```

  ```json 402 theme={null}
  {
    "error": {
      "code": 402,
      "message": "Insufficient account balance. Please top up and try again.",
      "type": "payment_required"
    }
  }
  ```

  ```json 429 theme={null}
  {
    "error": {
      "code": 429,
      "message": "Too many requests. Please try again later.",
      "type": "rate_limit_error"
    }
  }
  ```

  ```json 500 theme={null}
  {
    "error": {
      "code": 500,
      "message": "Internal server error. Please try again later.",
      "type": "server_error"
    }
  }
  ```
</ResponseExample>

## Authentifizierung

<ParamField header="Authorization" type="string" required>
  Alle Anfragen erfordern eine Bearer-Token-Authentifizierung

  Holen Sie Ihren API Key:

  Besuchen Sie die [Seite zur API-Key-Verwaltung](https://apimart.ai/keys), um Ihren API Key zu erhalten

  Fügen Sie den folgenden Header zu jeder Anfrage hinzu:

  ```
  Authorization: Bearer YOUR_API_KEY
  ```
</ParamField>

## Anfrageparameter

<ParamField body="group" type="object">
  Informationen zur Asset-Gruppe

  Wenn `group_id` nicht angegeben ist, erstellt der Server automatisch eine `AIGC`-Asset-Gruppe basierend auf diesem Feld

  <Expandable title="Felder">
    <ParamField body="name" type="string">
      Name der Asset-Gruppe
    </ParamField>

    <ParamField body="description" type="string">
      Beschreibung der Asset-Gruppe
    </ParamField>
  </Expandable>

  Beispiel:

  ```json theme={null}
  {
    "group": {
      "name": "virtual-avatar-group",
      "description": "demo group"
    }
  }
  ```

  <Warning>
    Schließt sich mit `group_id` gegenseitig aus — geben Sie nicht beide gleichzeitig an
  </Warning>
</ParamField>

<ParamField body="group_id" type="string">
  ID einer bestehenden Asset-Gruppe

  Wenn angegeben, wird die Gruppenerstellung übersprungen und die Assets werden direkt an die angegebene Gruppe gesendet

  <Warning>
    Schließt sich mit `group` gegenseitig aus — geben Sie nicht beide gleichzeitig an
  </Warning>
</ParamField>

<ParamField body="project_name" type="string" default="default">
  Projektname

  Standard: `default`
</ParamField>

<ParamField body="asset_type" type="string" default="Image">
  Asset-Typ

  Optionen:

  * `Image` — Bild-Asset (Standard)
  * `Video` — Video-Asset
  * `Audio` — Audio-Asset

  Standard: `Image`
</ParamField>

<ParamField body="assets" type="array">
  Asset-Liste, unterstützt die Einreichung mehrerer Assets in einer Anfrage

  <Warning>
    Maximal **20** Assets pro Einreichung
  </Warning>

  <Expandable title="Felder">
    <ParamField body="url" type="string" required>
      Asset-URL — muss öffentlich zugänglich sein
    </ParamField>

    <ParamField body="name" type="string" required>
      Asset-Name
    </ParamField>
  </Expandable>

  Beispiel:

  ```json theme={null}
  {
    "assets": [
      {
        "url": "https://example.com/avatar-a.png",
        "name": "avatar-a"
      },
      {
        "url": "https://example.com/avatar-b.png",
        "name": "avatar-b"
      }
    ]
  }
  ```
</ParamField>

<ParamField body="url" type="string">
  Kurzform für ein einzelnes Asset: Asset-URL

  <Warning>
    Verwenden Sie entweder das Array `assets` oder dieses Feld — nicht beide. Geeignet zum Einreichen eines einzelnen Assets.
  </Warning>
</ParamField>

<ParamField body="name" type="string">
  Kurzform für ein einzelnes Asset: Asset-Name

  <Warning>
    Verwenden Sie entweder das Array `assets` oder dieses Feld — nicht beide. Geeignet zum Einreichen eines einzelnen Assets.
  </Warning>
</ParamField>

## Antwort

<ResponseField name="code" type="integer">
  Antwortstatuscode, 200 bei Erfolg
</ResponseField>

<ResponseField name="data" type="object">
  Aufgabeninformationen

  <Expandable title="Felder">
    <ResponseField name="id" type="string">
      Lokale Aufgaben-ID, wird zum Abfragen des Prüfstatus der Assets verwendet
    </ResponseField>

    <ResponseField name="object" type="string">
      Aufgabenobjekttyp, immer `seedance.avatar.asset.task`
    </ResponseField>

    <ResponseField name="status" type="string">
      Anfänglicher Aufgabenstatus, `processing` nach der Einreichung
    </ResponseField>

    <ResponseField name="progress" type="integer">
      Aufgabenfortschritt (0 \~ 100)
    </ResponseField>

    <ResponseField name="model" type="string">
      Verwendeter Modellname
    </ResponseField>
  </Expandable>
</ResponseField>

## Beispiele

### Beispiel 1: Stapeleinreichung (Gruppe automatisch erstellen)

Wenn `group_id` nicht angegeben ist, erstellt der Server vor der Einreichung automatisch eine `AIGC`-Asset-Gruppe.

```json theme={null}
{
  "group": {
    "name": "virtual-avatar-group",
    "description": "demo group"
  },
  "project_name": "default",
  "asset_type": "Image",
  "assets": [
    {
      "url": "https://example.com/avatar-a.png",
      "name": "avatar-a"
    },
    {
      "url": "https://example.com/avatar-b.png",
      "name": "avatar-b"
    }
  ]
}
```

### Beispiel 2: Assets zu einer bestehenden Gruppe hinzufügen

Geben Sie `group_id` an, um die Gruppenerstellung zu überspringen und direkt einzureichen.

```json theme={null}
{
  "group_id": "group_xxx",
  "project_name": "default",
  "asset_type": "Image",
  "assets": [
    {
      "url": "https://example.com/avatar-a.png",
      "name": "avatar-a"
    }
  ]
}
```

### Beispiel 3: Kurzform für ein einzelnes Asset

Verwenden Sie für ein einzelnes Asset direkt die Felder `url` und `name` auf oberster Ebene.

```json theme={null}
{
  "group_id": "group_xxx",
  "url": "https://example.com/avatar.png",
  "asset_type": "Image",
  "name": "avatar-1"
}
```

## Prüfergebnis abfragen

Die Asset-Einreichung ist eine asynchrone Aufgabe. Verwenden Sie den Endpunkt [Aufgabenstatus abrufen](/de/api-reference/tasks/status) zur Abfrage:

```http theme={null}
GET /v1/tasks/{id}
```

### Alle genehmigt

```json theme={null}
{
  "code": 200,
  "data": {
    "id": "task_01K...",
    "status": "completed",
    "progress": 100,
    "result": {
      "assets": [
        {
          "asset_id": "asset_a",
          "asset_url": "asset://asset_a",
          "status": "Active"
        },
        {
          "asset_id": "asset_b",
          "asset_url": "asset://asset_b",
          "status": "Active"
        }
      ],
      "usable_assets": [
        {
          "asset_id": "asset_a",
          "asset_url": "asset://asset_a",
          "status": "Active"
        },
        {
          "asset_id": "asset_b",
          "asset_url": "asset://asset_b",
          "status": "Active"
        }
      ],
      "failed_assets": []
    }
  }
}
```

### Teilweiser Fehler

Wenn ein Asset die Prüfung nicht besteht, wird der Aufgabenstatus zu `failed`. Erfolgreich genehmigte Assets bleiben nutzbar und erscheinen in `result.usable_assets`.

```json theme={null}
{
  "code": 200,
  "data": {
    "id": "task_01K...",
    "status": "failed",
    "progress": 100,
    "result": {
      "assets": [
        {
          "asset_id": "asset_a",
          "asset_url": "asset://asset_a",
          "status": "Active"
        },
        {
          "asset_id": "asset_b",
          "asset_url": "asset://asset_b",
          "status": "Failed"
        }
      ],
      "usable_assets": [
        {
          "asset_id": "asset_a",
          "asset_url": "asset://asset_a",
          "status": "Active"
        }
      ],
      "failed_assets": [
        {
          "asset_id": "asset_b",
          "asset_url": "asset://asset_b",
          "status": "Failed"
        }
      ]
    },
    "error": {
      "code": "task_failed",
      "message": "Some assets failed review"
    }
  }
}
```

<Note>
  * `result.usable_assets[].asset_url` kann direkt in der Videogenerierung mit Seedance 2.0 verwendet werden
  * Assets in `result.failed_assets` müssen ersetzt oder erneut eingereicht werden
  * Aufgaben mit nur einem Asset geben aus Kompatibilitätsgründen auch `result.asset_url` zurück
</Note>

## Verwendung genehmigter Assets

Übergeben Sie die `asset://...`-URL direkt an den Endpunkt [Videogenerierung mit Seedance 2.0](/de/api-reference/videos/doubao-seedance-2-0/generation):

```json theme={null}
{
  "model": "doubao-seedance-2.0",
  "prompt": "The character walks naturally along a city street",
  "image_urls": ["asset://asset_a"],
  "duration": 5,
  "resolution": "720p"
}
```

<Note>
  Sobald der Server das Präfix `asset://` erkennt, reicht er die Generierungsaufgabe direkt ein, ohne eine erneute Asset-Prüfung auszulösen.
</Note>
