# Train Photo Avatar Group

Initiates the training process for a photo avatar group. This endpoint builds an AI model for the specified avatar group. The trained model enables consistent avatar generation across multiple looks of the same subject. 

<Callout icon="📘" theme="info">
  **Note:**

  * Scroll down to the **Response** section below and expand the status code(s) to view the detailed response schema.
  * Refer to the **RESPONSE** section on the right and choose an example to see how the API response appears for each status code.
</Callout>

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "heygen-api",
    "version": "4.0.8"
  },
  "servers": [
    {
      "url": "https://api.heygen.com"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "apiKey",
        "name": "x-api-key",
        "in": "header",
        "x-default": "<your-api-key>"
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/v2/photo_avatar/train": {
      "post": {
        "summary": "Train photo avatar group",
        "description": "Train a photo avatar group.",
        "operationId": "train-photo-avatar-group",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "group_id": {
                    "type": "string",
                    "description": "Unique identifier of the avatar group.  Can be retrieved from the <a href=\"https://docs.heygen.com/reference/create-photo-avatar-group\" target=\"_blank\">Create Photo Avatar Group</a> endpoint."
                  }
                },
                "required": [
                  "group_id"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Training process initiated successfully - Expand to view the detailed response schema.",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": {
                      "error": null,
                      "data": {
                        "code": 100,
                        "data": {
                          "num_of_photar": 4,
                          "num_of_instant_avatar": 0,
                          "num_of_studio_avatar": 0,
                          "flow_id": "46b0c8af19ea12eabbd86a3cc8abeb17"
                        },
                        "msg": null,
                        "message": null
                      }
                    }
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "Displays error message when the request fails; null if the request is successful."
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "integer",
                          "description": "Status code indicating the result of the API request. A 100 indicates a successful response. Other codes might indicate different types of errors. Refer to the <a href=\"https://docs.heygen.com/reference/errors\" target=\"_blank\">Error Responses</a> for more details. "
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "num_of_photar": {
                              "type": "integer",
                              "description": "Number of photo avatars included in the avatar group. "
                            },
                            "num_of_instant_avatar": {
                              "type": "integer",
                              "description": "Number of instant avatars included in the avatar group. "
                            },
                            "num_of_studio_avatar": {
                              "type": "integer",
                              "description": "Number of studio (both public and custom) avatars included in the avatar group. "
                            },
                            "flow_id": {
                              "type": "string",
                              "description": "Unique identifier of the training process. "
                            }
                          },
                          "description": "Contains specific details about the photo avatar training job. "
                        }
                      },
                      "description": "Contains information about the training process. "
                    },
                    "msg": {
                      "type": "string",
                      "description": "Legacy field for messages. This field is deprecated."
                    },
                    "message": {
                      "type": "string",
                      "description": "New field for messages. Contains human-readable messages explaining the status of the request. In case of errors, it returns an explanation."
                    }
                  }
                }
              }
            }
          }
        },
        "deprecated": false
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true
}
```