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

# Upload a character asset

> Upload an image, video, or audio asset to an active CometAPI asset group for later Seedance requests.

Upload one source to an active asset group. Send the raw access token in the `Authorization` header without a `Bearer` prefix. A real-person group accepts image assets only.

### Upload a file

Use the `file` field for a local source:

```bash theme={null}
curl \
  https://api.cometapi.com/api/asset/assets \
  -H "Authorization: $COMETAPI_ACCESS_TOKEN" \
  -F "group_id=<GROUP_ID>" \
  -F "asset_type=image" \
  -F "file=@/path/to/character.png"
```

### Upload an image URL

Use the JSON form for a source that is available at a public URL:

```bash theme={null}
curl \
  https://api.cometapi.com/api/asset/assets \
  -H "Authorization: $COMETAPI_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "group_id": "<GROUP_ID>",
    "asset_type": "image",
    "url": "https://your-image-host/character.png"
  }'
```

The request must include exactly one source: `file`, `url`, or `data`. The optional `name` field accepts up to 64 characters. Save `data.id` from the response. New assets usually return `data.status=processing`, so use [Retrieve a character asset](https://apidoc.cometapi.com/api/video/seedance/get-character-asset.md) until the status is `active`.

If the group is not active, the API returns `success: false` with a message explaining the group state. Check `success` and `message` for business errors even when the HTTP response is `200`.


## OpenAPI

````yaml api/openapi/video/seedance/post-upload-character-asset.openapi.json POST /api/asset/assets
openapi: 3.1.0
info:
  title: Upload character asset API
  version: 1.0.0
  description: Upload a media asset to an active CometAPI character asset group.
servers:
  - url: https://api.cometapi.com
security:
  - accessTokenAuth: []
paths:
  /api/asset/assets:
    post:
      summary: Upload a character asset
      description: >-
        Upload one image, video, or audio source to an active group. A
        real-person group accepts image assets only. Provide exactly one source
        field.
      operationId: seedance_upload_character_asset
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/UploadAssetMultipart'
            examples:
              file:
                summary: Upload an image file
                value:
                  group_id: ag-example
                  asset_type: image
                  file: <binary image file>
          application/json:
            schema:
              $ref: '#/components/schemas/UploadAssetJSON'
            examples:
              url:
                summary: Upload an image URL
                value:
                  group_id: ag-example
                  asset_type: image
                  url: https://your-image-host/character.png
      responses:
        '200':
          description: Asset accepted for processing.
          content:
            application/json:
              schema:
                type: object
                required:
                  - success
                  - message
                  - data
                properties:
                  success:
                    type: boolean
                    description: Whether the request succeeded.
                  message:
                    type: string
                    description: Status or error message.
                  data:
                    $ref: '#/components/schemas/AssetView'
              examples:
                success:
                  summary: Successful response
                  value:
                    success: true
                    message: ''
                    data: {}
        '400':
          description: The request is invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                message: invalid request body
        '401':
          description: The access token is missing or invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                message: unauthorized
      x-codeSamples:
        - lang: Shell
          label: Character asset request
          source: |-
            curl \
              https://api.cometapi.com/api/asset/assets \
              -H "Authorization: $COMETAPI_ACCESS_TOKEN" \
              -F "group_id=<GROUP_ID>" \
              -F "asset_type=image" \
              -F "file=@/path/to/character.png"
        - lang: Python
          label: Character asset request
          source: |
            import os
            from pathlib import Path
            import requests

            with Path("/path/to/character.png").open("rb") as image:
                response = requests.post(
                    "https://api.cometapi.com/api/asset/assets",
                    headers={"Authorization": os.environ["COMETAPI_ACCESS_TOKEN"]},
                    data={"group_id": "<GROUP_ID>", "asset_type": "image"},
                    files={"file": ("character.png", image, "image/png")},
                    timeout=60,
                )
            response.raise_for_status()
            print(response.json())
        - lang: JavaScript
          label: Character asset request
          source: >
            const form = new FormData();

            form.append("group_id", "<GROUP_ID>");

            form.append("asset_type", "image");

            form.append("file", new Blob([await
            readFile("/path/to/character.png")], { type: "image/png" }),
            "character.png");


            const response = await
            fetch("https://api.cometapi.com/api/asset/assets", {
              method: "POST",
              headers: { Authorization: process.env.COMETAPI_ACCESS_TOKEN },
              body: form,
            });


            if (!response.ok) throw new Error(await response.text());

            console.log(await response.json());
components:
  schemas:
    UploadAssetMultipart:
      type: object
      required:
        - group_id
        - asset_type
      properties:
        group_id:
          type: string
          description: Active CometAPI group ID.
          example: ag-example
        asset_type:
          type: string
          enum:
            - image
            - video
            - audio
          description: Asset media type.
        name:
          type: string
          maxLength: 64
          description: Optional asset name.
        file:
          type: string
          format: binary
          description: Local file source.
        url:
          type: string
          format: uri
          pattern: ^https://
          description: Public HTTPS source URL.
        data:
          type: string
          description: Base64 or data URI source.
      description: 'Provide exactly one source: file, url, or data.'
    UploadAssetJSON:
      type: object
      required:
        - group_id
        - asset_type
      properties:
        group_id:
          type: string
          description: Active CometAPI group ID.
          example: ag-example
        asset_type:
          type: string
          enum:
            - image
            - video
            - audio
          description: Asset media type.
        name:
          type: string
          maxLength: 64
          description: Optional asset name.
        url:
          type: string
          format: uri
          pattern: ^https://
          description: Public HTTPS source URL.
        data:
          type: string
          description: Base64 or data URI source.
      description: 'Provide exactly one source: file, url, or data.'
    AssetView:
      type: object
      required:
        - id
        - group_id
        - asset_type
        - status
        - created_at
      properties:
        id:
          type: string
          description: CometAPI asset ID.
          example: as-example
        group_id:
          type: string
          description: Owning group ID.
          example: ag-example
        name:
          type: string
          description: Optional asset name.
        asset_type:
          type: string
          enum:
            - image
            - video
            - audio
          description: Asset media type.
        status:
          type: string
          enum:
            - processing
            - active
            - failed
          description: Asset processing status.
        fail_reason:
          type: string
          description: Sanitized failure reason when processing fails.
        created_at:
          type: integer
          description: Creation time as a Unix timestamp in seconds.
    ErrorResponse:
      type: object
      required:
        - success
        - message
      properties:
        success:
          type: boolean
          description: Whether the request succeeded.
        message:
          type: string
          description: Description of the request error.
        data:
          type:
            - object
            - array
            - 'null'
          description: Error details when returned.
      additionalProperties: true
  securitySchemes:
    accessTokenAuth:
      type: apiKey
      in: header
      name: Authorization
      description: Raw CometAPI access token. Do not prefix it with Bearer.

````

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