UNITHdocs
Sign inarrow_forward

This document describes how to use the API to replace the background of a Digital Human with a static image. This feature allows for greater customization and flexibility in how Digital Humans are presented.

info

The ability to change backgrounds is currently available for a select group of head visuals only. To find the head visual ID you'd like to use, please refer to the table below.

Overview

The process of changing the background involves several steps, including identifying head visual ID with repleceable background, uploading an image, triggering the background replacement and finally creating and configuring a head visual.

Process flow:

The following endpoints are used in the background replacement process:

1. Identify a head visual ID with replaceable background

We've created head visuals with associated assets that allow easy background replacement. Please identify the head visual ID you would like to replace background to using the folowing table:

NameAvatarHead Visual ID
Amy
::Image[]{src="https://api.archbee.com/api/optimize/wYtgycOm4l6BLYK3BHUSM/bubo3xL0-7Wj4zpLKDKDG_image.png" size="20" width="746" height="709" position="center"}
7a2379c8-1c53-4d1e-9fe4-b9af7f3b6534
Ava
::Image[]{src="https://api.archbee.com/api/optimize/wYtgycOm4l6BLYK3BHUSM/SIWxrFdeaPxMVnaQ4o3IZ_image.png" size="20" width="763" height="714" position="center"}
e5c6f5d6-6e6e-4ce5-872d-159bcf2255d9
Hal
::Image[]{src="https://api.archbee.com/api/optimize/wYtgycOm4l6BLYK3BHUSM/6HTMnYABib1xoWtCFELt3_image.png" size="20" width="778" height="720" position="center"}
7af4cbe9-8702-4af8-9c55-e90cee6bfe02
Jo
::Image[]{src="https://api.archbee.com/api/optimize/wYtgycOm4l6BLYK3BHUSM/DJwXv0IyP-JsLouiSa55m_image.png" size="20" width="716" height="719" position="center"}
f0a341dd-206d-4786-849b-be587a8335dc
Kai 1
::Image[]{src="https://api.archbee.com/api/optimize/wYtgycOm4l6BLYK3BHUSM/8gIylmbEAtidMV2Ooud7n_image.png" size="20" width="803" height="715" position="center"}
8810c132-3c67-4b6f-8990-8b822c82e450
Kai 2
::Image[]{src="https://api.archbee.com/api/optimize/wYtgycOm4l6BLYK3BHUSM/RNJFWYp6j7TMM4aMlD8pC_image.png" size="20" width="705" height="692" position="center"}
41fa882a-2c0c-400a-bce0-c7b45dd3ac85
Kai 3
::Image[]{src="https://api.archbee.com/api/optimize/wYtgycOm4l6BLYK3BHUSM/vlpgPhMYZJPwp74yFoB7O_image.png" size="20" width="813" height="714" position="center"}
f15bcc91-6f7b-4db5-a39c-8cc55d0c9a8a
Lev 1
::Image[]{src="https://api.archbee.com/api/optimize/wYtgycOm4l6BLYK3BHUSM/x2Fh18gr7hhHAOTfmkROF_image.png" size="20" width="700" height="680" position="center"}
605bc559-687a-47cb-b31a-4701c322d8ff
Lev 2
::Image[]{src="https://api.archbee.com/api/optimize/wYtgycOm4l6BLYK3BHUSM/o6fDBKcX1_mBCThSElbT0_image.png" size="20" width="725" height="713" position="center"}
aaa009b7-a54b-472b-922d-51e089390d70
Noa 1
::Image[]{src="https://api.archbee.com/api/optimize/wYtgycOm4l6BLYK3BHUSM/RUQk2rUWZpWEGiw5RO8wn_image.png" size="20" width="740" height="718" position="center"}
17eaa273-bfa0-4f1b-82ad-dcb4a21a9903
Noa 2
::Image[]{src="https://api.archbee.com/api/optimize/wYtgycOm4l6BLYK3BHUSM/89esuFcS2yjMU86EynPsM_image.png" size="20" width="773" height="720" position="center"}
b799fe4e-f051-4b3a-87bd-f103b9b8649c
Pia
::Image[]{src="https://api.archbee.com/api/optimize/wYtgycOm4l6BLYK3BHUSM/4qYCVPYar_R6iV2Phm6xf_image.png" size="20" width="749" height="711" position="center"}
3fb6c88a-b568-4cea-adf2-7d4156fd3ded

If you are interested in creating a completely new head visual with replaceable background, please contact us.

2. Upload Replacement Image

  • Endpoint: /image/upload
  • Method: POST
  • Description: Uploads the static image that will be used to replace the background.
  • Request Body: (multipart/form-data)
code
curl -X 'POST' \
  'https://platform-api.unith.ai/image/upload' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer yourBearerToken \
  -H 'Content-Type: multipart/form-data' \
  -F 'file=@dolphinWallpaper.jpg;type=image/jpeg'
  • Response:
    • token: A temporary token for the uploaded image.
  • Error Handling:
    • Invalid file type (.png, .jpg, .jpeg are allowed).
    • File size exceeds the maximum allowed limit.

3. Replace Background

  • Endpoint: /head_visual/replace-background
  • Method: POST
  • Description: Initiates the background replacement process.
  • Request Body:
code
curl -X 'POST' \
  'https://platform-api.unith.ai/head_visual/replace-background' \
  -H 'accept: application/json' \
  -H 'x-head-image-token-id: imageToken \
  -H 'Authorization: Bearer yourBearerToken \
  -H 'Content-Type: application/json' \
  -d '{
  "id": "yourHeadVisualId"
}'
  • Parameters:
    • x-head-image-token-id (header)(string, required): The token of the uploaded replacement image.
    • id: The ID of one of the head visuals from the table above.
  • Response:
    • A JSON object containing the URL of the new idle video with the replaced background. For example:
  • Error Handling: Handle errors related to the background replacement, including:
    • Invalid head visual ID.
    • Invalid image token.

4. Upload new video with replaced background

  • Endpoint: /video/upload
  • Method: POST
  • Description: Upload the new video with replaced background.
  • Request Body: (multipart/form-data)
code
curl -X 'POST' \
  'https://platform-api.unith.ai/video/upload' \
  -H 'accept: application/json' \
  -H 'Authorization: yourBearerToken \
  -H 'Content-Type: multipart/form-data' \
  -F 'file=@yourVideo.mp4;type=video/mp4'
  • Response:
    • token: A temporary token for the uploaded video. This token is used in subsequent steps.
  • Error Handling:
    • Invalid file type (.mp4 allowed).
    • File size exceeds the maximum allowed limit.

5. Create Head Visual with new replaced background.

  • Endpoint: /head_visual/create
  • Method: POST
  • Description: Creates a new head visual using the video with replaced background.
  • Request Body:
code
curl -X 'POST' \
  'https://platform-api.unith.ai/head_visual/create' \
  -H 'accept: application/json' \
  -H 'x-head-video-token-id: yourVideoToken' \
  -H 'Authorization: Bearer yourBearerToken' \
  -H 'Content-Type: application/json' \
  -d '{
  "update": false,
  "detector_version": "v2",
  "detector_threshold": -0.2,
  "mode": "default",
  "cut_timestamp": 0.1,
  "debug": false
}'
  • Parameters:
    • Include all the required parameters for the /head_visual/create endpoint.
    • detector_version (string): You may or may not need to include it here, depending on your logic.
  • Response:
    • A JSON object containing the details of the newly created head visual, including its unique ID.
  • Error Handling:
    • Invalid video token.
    • Ensure cut_timestamp is provided when the processor mode is two_loops.

6. Save Head Visual.

  • Endpoint: /head_visual/save
  • Method: POST
  • Description: Saves the newly created head visual.
  • Request Body:
code
curl -X 'POST' \
  'https://platform-api.unith.ai/head_visual/save' \
  -H 'accept: application/json' \
  -H 'Authorization: yourBearerToken' \
  -H 'Content-Type: application/json' \
  -d '{
  "id": "yourHeadVisualID",
  "name": "headVisualName",
  "gender": "FEMALE",
  "type": "TALK"
}'
  • Parameters:
    • Include all the required parameters for the /head_visual/save endpoint.
  • Response:
    • A JSON object indicating the head visual has been saved.
  • Error Handling:
    • Ensure the task exist for a given head_visual_id.
    • Check the task status is IN_PROGRESS.

7. Assign new head visual ID to your organization

  • Endpoint: /head_visual/assign-organisation
  • Method: PUT
  • Description: Assigns the newly created head visual toy our organization
  • Request Body:
code
curl -X 'PUT' \
  'https://platform-api.unith.ai/head_visual/assign-organisation' \
  -H 'accept: */*' \
  -H 'Authorization: Bearer yourBearerToken \
  -H 'Content-Type: application/json' \
  -d '{
  "id": "yourHeadVisualId",
  "orgIds": [
    "yourOrgId"
  ]
}'
  • Parameters:
    • Include all the required parameters for the /head_visual/assign-organisation endpoint.
  • Response:
    • A JSON object indicating the head visual has been assigned.
  • Error Handling:
    • Ensure the task exist for a given head_visual_id and org_id.

Other Considerations

  • Asynchronous Processing: Background replacement involves synchronous processing. Head visual creation, preprocessing of the video etc.
scheduleLast updated Feb 10, 2026