Persona API Docs

Documentation for Persona's APIs
Written by Don Bosco
Updated 3 weeks ago

We provide extensive APIs for Persona, so you can make your clone do anything you can imagine. Here's a list of available APIs.

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.

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.

Did this answer your question?