We provide extensive APIs for Persona, so you can make your clone do anything you can imagine. Here's a list of available APIs.
The base URL is persona.bhuman.ai/persona/ unless otherwise specified
Authentication is done with the header --header 'Authorization: Client Secret'
Your Client Secret key can be found in Settings > API
Create a new Persona
POST /api/admin/add_voice
- Description: Adds a new voice profile for a persona.
Request Body:
jsonCopy code{
"voice_data": {
"language": "en",
"tone": "friendly",
"pitch": "medium",
"sample_audio": "base64_encoded_audio"
}
}
Response Example:
jsonCopy code{
"status": "success",
"message": "Voice profile added successfully",
"voice_id": "12345"
}
Schema:
- language: String, required, language code.
- tone: String, required, tone description.
- pitch: String, required, pitch level.
- sample_audio: String, required, base64 encoded audio.
GET /persona/voice/{embed_name}
Description: Retrieves the training URL for a specified embed.
Response Example
jsonCopy code{
"training_url": "https://example.com/training-data"
}
Schema:
- training_url: String, required. URL to be used for training in the next step.
Append response output URL with https://s3.us-east-2.amazonaws.com/
For example: https://s3.us-east-2.amazonaws.com/tmp-prod-0524/generated_audio/bdf21d1c-9bb9-4c25-a3d3-7a11beea9cca.wav
POST https://voice.bhuman.ai/api/v2/voice/generate
Description: Generates a voice using the provided training URL.
Request Body
{
"config": null,
"names": [],
"training_urls": ["https://example.com/training-data"],
"use_prosody": false
}
Response Example
{
"status": "success",
"message": "Voice generated successfully",
"voice_id": "12345"
}
Schema:
- config: Null, optional. Reserved for advanced configuration.
- names: Array of Strings, optional. Names associated with the voice.
- training_urls: Array of Strings, required. URLs retrieved from the previous step.
- use_prosody: Boolean, optional. Set to true to enable natural prosody.
POST /api/admin/instance
- Description: Creates a new instance for a persona.
Request Body:
jsonCopy code{
"instance_data": {
"name": "PersonaName",
"description": "A detailed description of the persona",
"configuration": {
"setting1": "value1",
"setting2": "value2"
}
}
}
Response Example:
jsonCopy code{
"status": "success",
"message": "Instance created successfully",
"instance_id": "67890"
}
Schema:
- name: String, required, persona name.
- description: String, required, detailed description.
- configuration: Object, required, configuration settings.
POST /api/admin/video
- Description: Adds a new video to a persona's profile.
Request Body:
jsonCopy code{
"video_data": {
"file": "base64_encoded_video",
"title": "Introduction Video",
"description": "A brief introduction video",
"duration": 120,
"resolution": "1080p"
}
}
Response Example:
jsonCopy code{
"status": "success",
"message": "Video added successfully",
"video_id": "abc123"
}
Schema:
- file: String, required, base64 encoded video.
- title: String, required, video title.
- description: String, optional, video description.
- duration: Integer, required, video duration in seconds.
- resolution: String, required, video resolution.
POST /api/instance
- Description: Creates a new instance of a persona.
Request Body:
jsonCopy code{
"instance_data": {
"name": "PersonaName",
"description": "A detailed description of the persona",
"configuration": {
"setting1": "value1",
"setting2": "value2"
}
}
}
Response Example:
jsonCopy code{
"status": "success",
"message": "Instance created successfully",
"instance_id": "67890"
}
Schema:
- name: String, required, persona name.
- description: String, required, detailed description.
- configuration: Object, required, configuration settings.
DELETE /api/instance
- Description: Deletes an existing persona instance.
Request Body:
jsonCopy code{
"instance_id": "67890"
}
Response Example:
jsonCopy code{
"status": "success",
"message": "Instance deleted successfully"
}
Schema:
- instance_id: String, required, unique identifier of the instance.
Add to KB (Knowledge Base)
POST /api/kb/auto-generate-prompts
- Description: Automatically generates prompts for the knowledge base.
Request Body:
jsonCopy code{
"data": {
"topics": ["topic1", "topic2"],
"context": "Additional context for prompt generation"
}
}
Response Example:
jsonCopy code{
"status": "success",
"prompts": ["Generated prompt 1", "Generated prompt 2"]
}
Schema:
- topics: Array of Strings, required, topics for prompt generation.
- context: String, optional, additional context.
Review Data
POST /api/kb/review-data
- Description: Submits data for review in the knowledge base.
Request Body:
jsonCopy code{
"review_data": {
"articles": ["article1", "article2"],
"notes": ["note1", "note2"]
}
}
Response Example:
jsonCopy code{
"status": "success",
"message": "Data submitted for review"
}
Schema:
- articles: Array of Strings, required, articles for review.
- notes: Array of Strings, required, notes for review.
Store Pages
POST /api/kb/store-pages
- Description: Stores pages in the knowledge base.
Request Body:
jsonCopy code{
"pages": [
{
"title": "Page Title",
"content": "Page content here",
"metadata": {
"author": "Author Name",
"date": "2024-05-01"
}
}
]
}
Response Example:
jsonCopy code{
"status": "success",
"message": "Pages stored successfully"
}
Schema:
- title: String, required, title of the page.
- content: String, required, content of the page.
- metadata: Object, optional, metadata about the page.
Stream Pages
POST /api/kb/stream-pages
- Description: Streams pages into the knowledge base.
Request Body:
jsonCopy code{
"stream_data": {
"stream_id": "stream123",
"pages": [
{
"title": "Page Title",
"content": "Page content here",
"metadata": {
"author": "Author Name",
"date": "2024-05-01"
}
}
]
}
}
Response Example:
jsonCopy code{
"status": "success",
"message": "Pages streamed successfully"
}
Schema:
- stream_id: String, required, unique identifier for the stream.
- pages: Array of Page objects, required, pages to be streamed.
Manage Training Data
GET /api/kb/training-data
- Description: Retrieves training data from the knowledge base.
Response Example:
jsonCopy code{
"status": "success",
"training_data": [
{
"id": "data1",
"content": "Training data content here"
},
{
"id": "data2",
"content": "More training data content"
}
]
}
PUT /api/kb/training-data
- Description: Updates training data in the knowledge base.
Request Body:
jsonCopy code{
"training_data": {
"id": "data1",
"content": "Updated training data content"
}
}
Response Example:
jsonCopy code{
"status": "success",
"message": "Training data updated successfully"
}
Schema:
- id: String, required, unique identifier for the training data.
- content: String, required, content of the training data.
DELETE /api/kb/training-data/
- Description: Deletes specific training data from the knowledge base.
Response Example:
jsonCopy code{
"status": "success",
"message": "Training data deleted successfully"
}
Schema:
- id: String, required, unique identifier for the training data to be deleted.
Chat
POST /api/kb/v2/chat
- Description: Initiates a chat using knowledge base version 2.
Request Body:
jsonCopy code{
"chat_data": {
"user_id": "user123",
"message": "Hello, I need help with...",
"context": "Context for the chat"
}
}
Response Example:
jsonCopy code{
"status": "success",
"chat_id": "chat123",
"response": "How can I assist you today?"
}
Schema:
- user_id: String, required, unique identifier of the user.
- message: String, required, initial message from the user.
- context: String, optional, additional context for the chat.
Chat History
GET /api/persona/chats
- Description: Retrieves the chat history.
Response Example:
jsonCopy code{
"status": "success",
"chats": [
{
"chat_id": "chat123",
"user_id": "user123",
"messages": ["Hello", "How can I help you?"]
}
]
}
GET /api/persona/messages/
- Description: Retrieves messages from a specific chat.
Response Example:
jsonCopy code{
"status": "success",
"messages": ["Hello", "How can I help you?"]
}
Schema:
- chat_id: String, required, unique identifier of the chat### Make New Persona
Create a new Persona
POST /api/admin/add_voice
- Description: Adds a new voice profile for a persona.
Request Body:
jsonCopy code{
"voice_data": {
"language": "en",
"tone": "friendly",
"pitch": "medium",
"sample_audio": "base64_encoded_audio"
}
}
Response Example:
jsonCopy code{
"status": "success",
"message": "Voice profile added successfully",
"voice_id": "12345"
}
Schema:
- language: String, required, language code.
- tone: String, required, tone description.
- pitch: String, required, pitch level.
- sample_audio: String, required, base64 encoded audio.
POST /api/admin/instance
- Description: Creates a new instance for a persona.
Request Body:
jsonCopy code{
"instance_data": {
"name": "PersonaName",
"description": "A detailed description of the persona",
"configuration": {
"setting1": "value1",
"setting2": "value2"
}
}
}
Response Example:
jsonCopy code{
"status": "success",
"message": "Instance created successfully",
"instance_id": "67890"
}
Schema:
- name: String, required, persona name.
- description: String, required, detailed description.
- configuration: Object, required, configuration settings.
POST /api/admin/video
- Description: Adds a new video to a persona's profile.
Request Body:
jsonCopy code{
"video_data": {
"file": "base64_encoded_video",
"title": "Introduction Video",
"description": "A brief introduction video",
"duration": 120,
"resolution": "1080p"
}
}
Response Example:
jsonCopy code{
"status": "success",
"message": "Video added successfully",
"video_id": "abc123"
}
Schema:
- file: String, required, base64 encoded video.
- title: String, required, video title.
- description: String, optional, video description.
- duration: Integer, required, video duration in seconds.
- resolution: String, required, video resolution.
POST /api/instance
- Description: Creates a new instance of a persona.
Request Body:
jsonCopy code{
"instance_data": {
"name": "PersonaName",
"description": "A detailed description of the persona",
"configuration": {
"setting1": "value1",
"setting2": "value2"
}
}
}
Response Example:
jsonCopy code{
"status": "success",
"message": "Instance created successfully",
"instance_id": "67890"
}
Schema:
- name: String, required, persona name.
- description: String, required, detailed description.
- configuration: Object, required, configuration settings.
DELETE /api/instance
- Description: Deletes an existing persona instance.
Request Body:
jsonCopy code{
"instance_id": "67890"
}
Response Example:
jsonCopy code{
"status": "success",
"message": "Instance deleted successfully"
}
Schema:
- instance_id: String, required, unique identifier of the instance.
Add to KB (Knowledge Base)
POST /api/kb/auto-generate-prompts
- Description: Automatically generates prompts for the knowledge base.
Request Body:
jsonCopy code{
"data": {
"topics": ["topic1", "topic2"],
"context": "Additional context for prompt generation"
}
}
Response Example:
jsonCopy code{
"status": "success",
"prompts": ["Generated prompt 1", "Generated prompt 2"]
}
Schema:
- topics: Array of Strings, required, topics for prompt generation.
- context: String, optional, additional context.
POST /api/kb/review-data
- Description: Submits data for review in the knowledge base.
Request Body:
jsonCopy code{
"review_data": {
"articles": ["article1", "article2"],
"notes": ["note1", "note2"]
}
}
Response Example:
jsonCopy code{
"status": "success",
"message": "Data submitted for review"
}
Schema:
- articles: Array of Strings, required, articles for review.
- notes: Array of Strings, required, notes for review.
POST /api/kb/store-pages
- Description: Stores pages in the knowledge base.
Request Body:
jsonCopy code{
"pages": [
{
"title": "Page Title",
"content": "Page content here",
"metadata": {
"author": "Author Name",
"date": "2024-05-01"
}
}
]
}
Response Example:
jsonCopy code{
"status": "success",
"message": "Pages stored successfully"
}
Schema:
- title: String, required, title of the page.
- content: String, required, content of the page.
- metadata: Object, optional, metadata about the page.
POST /api/kb/stream-pages
- Description: Streams pages into the knowledge base.
Request Body:
jsonCopy code{
"stream_data": {
"stream_id": "stream123",
"pages": [
{
"title": "Page Title",
"content": "Page content here",
"metadata": {
"author": "Author Name",
"date": "2024-05-01"
}
}
]
}
}
Response Example:
jsonCopy code{
"status": "success",
"message": "Pages streamed successfully"
}
Schema:
- stream_id: String, required, unique identifier for the stream.
- pages: Array of Page objects, required, pages to be streamed.
GET /api/kb/training-data
- Description: Retrieves training data from the knowledge base.
Response Example:
jsonCopy code{
"status": "success",
"training_data": [
{
"id": "data1",
"content": "Training data content here"
},
{
"id": "data2",
"content": "More training data content"
}
]
}
PUT /api/kb/training-data
- Description: Updates training data in the knowledge base.
Request Body:
jsonCopy code{
"training_data": {
"id": "data1",
"content": "Updated training data content"
}
}
Response Example:
jsonCopy code{
"status": "success",
"message": "Training data updated successfully"
}
Schema:
- id: String, required, unique identifier for the training data.
- content: String, required, content of the training data.
DELETE /api/kb/training-data/
- Description: Deletes specific training data from the knowledge base.
Response Example:
jsonCopy code{
"status": "success",
"message": "Training data deleted successfully"
}
Schema:
- id: String, required, unique identifier for the training data to be deleted.
Chat
POST /api/kb/v2/chat
- Description: Initiates a chat using knowledge base version 2.
Request Body:
jsonCopy code{
"chat_data": {
"user_id": "user123",
"message": "Hello, I need help with...",
"context": "Context for the chat"
}
}
Response Example:
jsonCopy code{
"status": "success",
"chat_id": "chat123",
"response": "How can I assist you today?"
}
Schema:
- user_id: String, required, unique identifier of the user.
- message: String, required, initial message from the user.
- context: String, optional, additional context for the chat.
Chat History
GET /api/persona/chats
- Description: Retrieves the chat history.
Response Example:
jsonCopy code{
"status": "success",
"chats": [
{
"chat_id": "chat123",
"user_id": "user123",
"messages": ["Hello", "How can I help you?"]
}
]
}
GET /api/persona/messages/
- Description: Retrieves messages from a specific chat.
Response Example:
jsonCopy code{
"status": "success",
"messages": ["Hello", "How can I help you?"]
}
Schema:
- chat_id: String, required, unique identifier of the chat.