{
  "components": {
    "schemas": {
      "BHumanApiError": {
        "properties": {
          "code": {
            "example": 401,
            "type": "integer"
          },
          "result": {
            "properties": {
              "error": {
                "type": "string"
              }
            },
            "type": "object"
          }
        },
        "title": "BHumanApiError",
        "type": "object"
      },
      "BHumanGenerationAccepted": {
        "properties": {
          "code": {
            "example": 200,
            "type": "integer"
          },
          "result": {
            "description": "Generated video IDs accepted for processing.",
            "items": {
              "format": "uuid",
              "type": "string"
            },
            "type": "array"
          }
        },
        "title": "BHumanGenerationAccepted",
        "type": "object"
      },
      "GeneratedVideo": {
        "example": {
          "campaign_id": null,
          "created_at": "1970-01-01T00:00:00",
          "gif": null,
          "id": "00000000-0000-0000-0000-000000000000",
          "message": null,
          "share_url": null,
          "status": "",
          "thumbnail": null,
          "url": null,
          "video_instance_id": null,
          "whatsapp_video_url": null
        },
        "properties": {
          "campaign_id": {},
          "created_at": {
            "type": "string"
          },
          "gif": {},
          "id": {
            "type": "string"
          },
          "message": {},
          "share_url": {},
          "status": {
            "type": "string"
          },
          "thumbnail": {},
          "url": {},
          "video_instance_id": {},
          "whatsapp_video_url": {}
        },
        "title": "GeneratedVideo",
        "type": "object"
      },
      "PInput": {
        "example": {
          "assets": [
            [
              "https://example.com/listing-photo.jpg",
              "https://example.com/market-chart.png"
            ]
          ],
          "background_missing_policy": "fail_video",
          "backgrounds": [
            {
              "config": {
                "audio": false,
                "blend": 0.1,
                "brightness": 1.0,
                "color": "00ff00",
                "mode": "none",
                "position": "bottom-right",
                "scale": 0.42,
                "similarity": 0.1
              },
              "end": 5.5,
              "kind": "link",
              "name": "listing_photo",
              "start": 2.0
            }
          ],
          "callback_url": "https://example.com/bhuman-callback",
          "campaign_id": "00000000-0000-0000-0000-000000000000",
          "enable_lipsync": true,
          "generation_mode": "keep_original",
          "names": [
            [
              "Michael"
            ]
          ],
          "variables": [
            "name"
          ]
        },
        "properties": {
          "assets": {
            "items": {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "type": "array"
          },
          "background_missing_policy": {
            "type": "string"
          },
          "backgrounds": {
            "items": {
              "properties": {
                "config": {
                  "properties": {
                    "audio": {
                      "type": "boolean"
                    },
                    "blend": {
                      "type": "number"
                    },
                    "brightness": {
                      "type": "number"
                    },
                    "color": {
                      "type": "string"
                    },
                    "mode": {
                      "type": "string"
                    },
                    "position": {
                      "type": "string"
                    },
                    "scale": {
                      "type": "number"
                    },
                    "similarity": {
                      "type": "number"
                    }
                  },
                  "type": "object"
                },
                "end": {
                  "type": "number"
                },
                "kind": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "start": {
                  "type": "number"
                }
              },
              "type": "object"
            },
            "type": "array"
          },
          "callback_url": {
            "type": "string"
          },
          "campaign_id": {
            "type": "string"
          },
          "enable_lipsync": {
            "type": "boolean"
          },
          "generation_mode": {
            "description": "Public video result choice. keep_original changes personalized sections and preserves the rest of the source video. full_script selects Smoothest result and rebuilds the full video. Public generation endpoints default a missing or blank value to keep_original; clients should still send this field explicitly. Keep Original supports up to 100 personalized sections, each no longer than 10 seconds.",
            "enum": [
              "keep_original",
              "full_script"
            ],
            "example": "keep_original",
            "type": "string"
          },
          "names": {
            "description": "One value row per recipient, with one entry per variable in the same order. Blank or null spoken cells use the saved variable fallback; values without a saved fallback are required. Send only replacement words without surrounding fixed template words.",
            "items": {
              "items": {
                "type": "string",
                "nullable": true
              },
              "type": "array"
            },
            "type": "array"
          },
          "variables": {
            "description": "Ordered template variable names. Each names row must provide values in this same order.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "video_quality": {
            "type": "string",
            "enum": [
              "standard",
              "premium"
            ],
            "description": "Optional full_script quality: standard is 480p at 1x video credits; premium is 720p at 2x video credits."
          }
        },
        "type": "object",
        "required": [
          "campaign_id",
          "variables",
          "names"
        ]
      },
      "PabblyInput": {
        "example": {
          "callback_url": "https://example.com/bhuman-callback",
          "campaign_id": "00000000-0000-0000-0000-000000000000",
          "generation_mode": "keep_original",
          "variables": {
            "listing_photo": "https://example.com/listing-photo.jpg",
            "name": "Michael"
          }
        },
        "properties": {
          "callback_url": {
            "type": "string"
          },
          "campaign_id": {
            "type": "string"
          },
          "generation_mode": {
            "description": "Use keep_original to preserve the source video or full_script for Smoothest result. Missing or blank values default to keep_original.",
            "enum": [
              "keep_original",
              "full_script"
            ],
            "type": "string"
          },
          "variables": {
            "description": "Template variable object. Omitted, blank or null spoken values use the saved fallback; values without a saved fallback are required. Background variables still require media values. Send only replacement words without surrounding fixed template words.",
            "properties": {
              "listing_photo": {
                "type": "string"
              },
              "name": {
                "type": "string",
                "nullable": true
              }
            },
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "nullable": true
            },
            "nullable": true
          },
          "video_quality": {
            "type": "string",
            "enum": [
              "standard",
              "premium"
            ],
            "description": "Optional full_script quality: standard is 480p at 1x video credits; premium is 720p at 2x video credits."
          }
        },
        "type": "object",
        "required": [
          "campaign_id"
        ]
      },
      "PipelineCompletionCallback": {
        "description": "Body posted to callback_url when a structured campaign render finishes.",
        "properties": {
          "campaign_id": {
            "format": "uuid",
            "type": "string"
          },
          "campaign_result_id": {
            "nullable": true,
            "type": "integer"
          },
          "gif": {
            "format": "uri",
            "type": "string"
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "status": {
            "example": "success",
            "type": "string"
          },
          "thumbnail": {
            "format": "uri",
            "type": "string"
          },
          "url": {
            "description": "Share page URL for the generated video.",
            "format": "uri",
            "type": "string"
          },
          "video_url": {
            "format": "uri",
            "type": "string"
          }
        },
        "title": "PipelineCompletionCallback",
        "type": "object"
      },
      "TSInput": {
        "example": {
          "assets": [
            [
              "https://example.com/listing-photo.jpg"
            ]
          ],
          "backgrounds": [
            {
              "config": {
                "audio": false,
                "blend": 0.1,
                "brightness": 1.0,
                "color": "00ff00",
                "mode": "none",
                "position": "bottom-right",
                "scale": 0.42,
                "similarity": 0.1
              },
              "end": 5.5,
              "kind": "link",
              "name": "listing_photo",
              "start": 2.0
            }
          ],
          "callback_url": "https://example.com/bhuman-callback",
          "enable_lipsync": true,
          "enable_subtitles": false,
          "generation_mode": "keep_original",
          "names": [
            [
              "Erada"
            ]
          ],
          "variables": [
            "name"
          ],
          "video_instance_id": "00000000-0000-0000-0000-000000000000"
        },
        "properties": {
          "assets": {
            "items": {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "type": "array"
          },
          "backgrounds": {
            "items": {
              "properties": {
                "config": {
                  "properties": {
                    "audio": {
                      "type": "boolean"
                    },
                    "blend": {
                      "type": "number"
                    },
                    "brightness": {
                      "type": "number"
                    },
                    "color": {
                      "type": "string"
                    },
                    "mode": {
                      "type": "string"
                    },
                    "position": {
                      "type": "string"
                    },
                    "scale": {
                      "type": "number"
                    },
                    "similarity": {
                      "type": "number"
                    }
                  },
                  "type": "object"
                },
                "end": {
                  "type": "number"
                },
                "kind": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "start": {
                  "type": "number"
                }
              },
              "type": "object"
            },
            "type": "array"
          },
          "callback_url": {
            "type": "string"
          },
          "enable_lipsync": {
            "type": "boolean"
          },
          "enable_subtitles": {
            "type": "boolean"
          },
          "generation_mode": {
            "description": "Public video result choice. keep_original changes personalized sections and preserves the rest of the source video. full_script selects Smoothest result and rebuilds the full video. Public generation endpoints default a missing or blank value to keep_original; clients should still send this field explicitly. Keep Original supports up to 100 personalized sections, each no longer than 10 seconds.",
            "enum": [
              "keep_original",
              "full_script"
            ],
            "example": "keep_original",
            "type": "string"
          },
          "names": {
            "description": "One value row per recipient, with one entry per variable in the same order. Blank or null spoken cells use the saved variable fallback; values without a saved fallback are required. Send only replacement words without surrounding fixed template words.",
            "items": {
              "items": {
                "type": "string",
                "nullable": true
              },
              "type": "array"
            },
            "type": "array"
          },
          "variables": {
            "description": "Ordered template variable names. Each names row must provide values in this same order.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "video_instance_id": {
            "type": "string"
          },
          "video_quality": {
            "type": "string",
            "enum": [
              "standard",
              "premium"
            ],
            "description": "Optional full_script quality: standard is 480p at 1x video credits; premium is 720p at 2x video credits."
          }
        },
        "type": "object",
        "required": [
          "video_instance_id",
          "variables",
          "names"
        ]
      }
    },
    "securitySchemes": {
      "BasicAuth": {
        "description": "Integration credentials. Use client_id as the username and client_secret as the password. This is the recommended auth mode for GoHighLevel Custom Webhook actions.",
        "scheme": "basic",
        "type": "http"
      },
      "Bearer": {
        "bearerFormat": "JWT",
        "description": "First-party BHuman user access token.",
        "scheme": "bearer",
        "type": "http"
      }
    }
  },
  "info": {
    "title": "BHuman Customer API",
    "version": "1.0.0",
    "description": "Customer integration reference. Personalized video remains in beta. New production REST credential provisioning is on hold pending release qualification. See https://www.bhuman.ai/docs/api for access, costs, callbacks and safe retry guidance."
  },
  "openapi": "3.0.0",
  "paths": {
    "/api/ai_studio/pipeline/campaign": {
      "post": {
        "description": "Recommended endpoint for CRM and GoHighLevel integrations. Send a campaign_id, ordered variables, one names row per recipient, and an explicit generation_mode. Each names value must contain only the text replacing that variable, never the surrounding template sentence. Authenticate with Basic Auth for integrations or Bearer JWT for first-party clients. The API returns generated video IDs immediately; callback_url receives PipelineCompletionCallback when rendering completes.",
        "operationId": "campaign_to_pipeline",
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "assets": [
                  [
                    "https://example.com/listing-photo.jpg"
                  ]
                ],
                "backgrounds": [
                  {
                    "config": {
                      "brightness": 1.0,
                      "mode": "none",
                      "position": "bottom-right",
                      "scale": 0.42
                    },
                    "end": 5.5,
                    "kind": "link",
                    "name": "listing_photo",
                    "start": 2.0
                  }
                ],
                "callback_url": "https://example.com/bhuman-callback",
                "campaign_id": "00000000-0000-0000-0000-000000000000",
                "enable_lipsync": true,
                "generation_mode": "keep_original",
                "names": [
                  [
                    "Erada"
                  ]
                ],
                "variables": [
                  "name"
                ]
              },
              "schema": {
                "$ref": "#/components/schemas/PInput"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "code": 200,
                  "result": [
                    "00000000-0000-0000-0000-000000000000"
                  ]
                },
                "schema": {
                  "$ref": "#/components/schemas/BHumanGenerationAccepted"
                }
              }
            },
            "description": "Generation request accepted."
          },
          "400": {
            "content": {
              "application/json": {
                "example": {
                  "code": 400,
                  "result": {
                    "error": "Missing variables parameters."
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/BHumanApiError"
                }
              }
            },
            "description": "Invalid request body, campaign configuration, or variable mapping."
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "invalidCredentials": {
                    "value": {
                      "code": 401,
                      "result": {
                        "error": "Invalid credentials."
                      }
                    }
                  },
                  "missingAuthorization": {
                    "value": {
                      "code": 401,
                      "result": {
                        "error": "Missing authorization."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/BHumanApiError"
                }
              }
            },
            "description": "Missing or invalid authorization."
          }
        },
        "security": [
          {
            "BasicAuth": []
          },
          {
            "Bearer": []
          }
        ],
        "summary": "Generate campaign videos",
        "tags": [
          "Videos"
        ]
      }
    },
    "/api/ai_studio/pipeline/pabbly": {
      "post": {
        "description": "Generate videos using a campaign ID and a map of variable names to replacement-only values. Missing generation_mode defaults to keep_original. Use full_script explicitly to regenerate the full spoken script.",
        "operationId": "pabbly_to_pipeline",
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "callback_url": "https://example.com/bhuman-callback",
                "campaign_id": "00000000-0000-0000-0000-000000000000",
                "generation_mode": "keep_original",
                "variables": {
                  "name": "Erada"
                }
              },
              "schema": {
                "$ref": "#/components/schemas/PabblyInput"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "code": 200,
                  "result": [
                    "00000000-0000-0000-0000-000000000000"
                  ]
                },
                "schema": {
                  "$ref": "#/components/schemas/BHumanGenerationAccepted"
                }
              }
            },
            "description": "Generation request accepted."
          },
          "400": {
            "content": {
              "application/json": {
                "example": {
                  "code": 400,
                  "result": {
                    "error": "Missing variables parameters."
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/BHumanApiError"
                }
              }
            },
            "description": "Invalid request body, campaign configuration, or variable mapping."
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "invalidCredentials": {
                    "value": {
                      "code": 401,
                      "result": {
                        "error": "Invalid credentials."
                      }
                    }
                  },
                  "missingAuthorization": {
                    "value": {
                      "code": 401,
                      "result": {
                        "error": "Missing authorization."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/BHumanApiError"
                }
              }
            },
            "description": "Missing or invalid authorization."
          }
        },
        "security": [
          {
            "BasicAuth": []
          },
          {
            "Bearer": []
          }
        ],
        "summary": "Generate videos from a simple integration payload",
        "tags": [
          "Videos"
        ]
      }
    },
    "/api/ai_studio/pipeline/zapier": {
      "post": {
        "description": "Structured automation endpoint using the same request shape as the campaign pipeline. A missing or blank generation_mode defaults to keep_original; send full_script explicitly for Smoothest result. Each names value must contain only the replacement text, such as 'Erada', not a complete phrase such as 'Hi Erada, welcome to ...'. Authenticate with Basic Auth for integrations or Bearer JWT for first-party clients.",
        "operationId": "zapier_to_pipeline",
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "callback_url": "https://example.com/bhuman-callback",
                "campaign_id": "00000000-0000-0000-0000-000000000000",
                "generation_mode": "keep_original",
                "names": [
                  [
                    "Erada"
                  ]
                ],
                "variables": [
                  "name"
                ]
              },
              "schema": {
                "$ref": "#/components/schemas/PInput"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "code": 200,
                  "result": [
                    "00000000-0000-0000-0000-000000000000"
                  ]
                },
                "schema": {
                  "$ref": "#/components/schemas/BHumanGenerationAccepted"
                }
              }
            },
            "description": "Generation request accepted."
          },
          "400": {
            "content": {
              "application/json": {
                "example": {
                  "code": 400,
                  "result": {
                    "error": "Missing variables parameters."
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/BHumanApiError"
                }
              }
            },
            "description": "Invalid request body, campaign configuration, or variable mapping."
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "invalidCredentials": {
                    "value": {
                      "code": 401,
                      "result": {
                        "error": "Invalid credentials."
                      }
                    }
                  },
                  "missingAuthorization": {
                    "value": {
                      "code": 401,
                      "result": {
                        "error": "Missing authorization."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/BHumanApiError"
                }
              }
            },
            "description": "Missing or invalid authorization."
          }
        },
        "security": [
          {
            "BasicAuth": []
          },
          {
            "Bearer": []
          }
        ],
        "summary": "Generate videos from a structured automation payload",
        "tags": [
          "Videos"
        ]
      }
    },
    "/api/ai_studio/try_sample": {
      "post": {
        "description": "Generate directly from an AI Studio video instance. A missing or blank generation_mode defaults to keep_original; send full_script explicitly for Smoothest result. Every names value must contain only replacement text, and every row must match the variables array width.",
        "operationId": "process_try_sample",
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "callback_url": "https://example.com/bhuman-callback",
                "generation_mode": "keep_original",
                "names": [
                  [
                    "Erada"
                  ]
                ],
                "variables": [
                  "name"
                ],
                "video_instance_id": "00000000-0000-0000-0000-000000000000"
              },
              "schema": {
                "$ref": "#/components/schemas/TSInput"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "code": 200,
                  "result": [
                    "00000000-0000-0000-0000-000000000000"
                  ]
                },
                "schema": {
                  "$ref": "#/components/schemas/BHumanGenerationAccepted"
                }
              }
            },
            "description": "Generation request accepted."
          },
          "400": {
            "content": {
              "application/json": {
                "example": {
                  "code": 400,
                  "result": {
                    "error": "Missing variables parameters."
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/BHumanApiError"
                }
              }
            },
            "description": "Invalid request body, campaign configuration, or variable mapping."
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "invalidCredentials": {
                    "value": {
                      "code": 401,
                      "result": {
                        "error": "Invalid credentials."
                      }
                    }
                  },
                  "missingAuthorization": {
                    "value": {
                      "code": 401,
                      "result": {
                        "error": "Missing authorization."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/BHumanApiError"
                }
              }
            },
            "description": "Missing or invalid authorization."
          }
        },
        "security": [
          {
            "BasicAuth": []
          },
          {
            "Bearer": []
          }
        ],
        "summary": "Generate videos from a video instance",
        "tags": [
          "Videos"
        ]
      }
    },
    "/api/ai_studio/generated_video_by_id": {
      "get": {
        "description": "Returns a result by its generated video ID. Possession of the ID grants access; keep IDs and returned media URLs private.",
        "operationId": "get_generated_video_by_id",
        "parameters": [
          {
            "in": "query",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer"
                    },
                    "result": {
                      "$ref": "#/components/schemas/GeneratedVideo"
                    }
                  },
                  "required": [
                    "code",
                    "result"
                  ]
                }
              }
            },
            "description": "Current status and available media."
          }
        },
        "summary": "Get an individual video result",
        "tags": [
          "Videos"
        ],
        "security": []
      }
    }
  },
  "servers": [
    {
      "url": "https://studio.bhuman.ai"
    }
  ]
}
