API Documentation

GET /personas

This endpoint retrieves a list of personas, which includes employees and generators.

Request Parameters

None

Response

The response is a JSON array of personas, where each persona has the following properties:

  • id (string): The unique identifier of the persona.
  • name (string): The name of the persona.
  • category (string): The category of the persona.
  • type (string): The type of the persona, which can be either "expert" or "generator".

Example Request

GET /personas

Example Response

[
  {
    "id": "1",
    "name": "John Doe",
    "category": "Marketing",
    "type": "expert"
  },
  {
    "id": "2",
    "name": "Jane Smith",
    "category": "Sales",
    "type": "expert"
  },
  {
    "id": "3",
    "name": "Acme Generator",
    "category": "Marketing",
    "type": "generator"
  }
]

POST /generate

Description

This endpoint generates a response based on the provided message, persona, and model.

Request Headers

  • Content-Type: application/json

Request Body

The request body should be a JSON object containing the following properties:

  • api-key (string, required): The API key for authentication. You can get an API key at https://gptboss.com/dashboard if you have an Enterprise account.
  • message (string, required): The message to send to the AI.
  • id (string, required): The persona ID to use. You can review a list of personas by calling the /personas endpoint.
  • model (string, required): The model to use. You can review a list of models by calling the /models endpoint.

Example Request

{
  "api-key": "your-api-key",
  "message": "What is the capital of France?",
  "id": "persona-1",
  "model": "model-1"
}

Response

The response will be a JSON object containing the following properties:

  • success (boolean): Indicates whether the request was successful or not.
  • message (string): The generated message from the AI.
  • message_id (string): The unique identifier for the generated message.
  • persona (string): The persona used for generating the message.

Example Response

{
  "success": true,
  "message": "The capital of France is Paris.",
  "message_id": "msg-12345",
  "persona": "persona-1"
}

Error Handling

If there is an error, the response will have a status code of 500 and a JSON object containing the following property:

  • generatorError (string): A description of the error that occurred.

Example Error Response

{
  "generatorError": "No message provided - please provide a message to send to the AI."
}

POST /experts

This endpoint creates a message with experts and returns the generated message, message ID, and persona.

Request

Headers:

  • Content-Type: application/json

Body:

  • api-key (string): The API key for authentication.
  • messages (array): An array of message objects containing the following properties:
    • role (string): The role of the message sender (e.g., "system", "user", "assistant").
    • content (string): The content of the message.
  • id (any): A unique identifier for the conversation.
  • model (string): The AI model to use for generating the message. Possible values are "gpt-4" and "gpt-3.5-turbo".

Response

  • 200 OK: The request was successful.
    • success (boolean): Indicates whether the operation was successful.
    • message (string): The generated message.
    • message_id (string): The unique identifier of the generated message.
    • persona (string): The persona of the expert.
  • 500 Internal Server Error: An error occurred while processing the request.
    • error (string): A description of the error.

Example 1 - Starting a Chat

Request:

{
  "api-key": "your-api-key",
  "messages": [
    {
      "role": "user",
      "content": "Can you generate a SWOT analysis for a McDonald's Franchise?"
    }
  ], // notice this is an array
  "id": "42",
  "model": "gpt-3.5-turbo"
}

Response:

{
  "success": true,
  "message": "Sure, here is a SWOT Analysis for a new McDonald's Franchise:

Strengths:

1. Strong brand recognition and reputation
2. Wide range of menu options to cater to different customer preferences
3. Well-established supply chain and distribution system
4. Franchisee support system including training and marketing assistance...",
  "message_id": "generated-message-id",
  "persona": "Addison Brant"
}

Client-side, you should store the value of "message" into an array of messages inside of an object like:

{
	"role": "assistant",
	"content": "Sure, here is a SWOT Analysis for a new McDonald's Franchise..."
}

Example 2 - Continuing a Chat

Request:

{
  "api-key": "your-api-key",
  "messages": [
	{
	"role": "user",
	"content": "Can you generate a SWOT analysis for a McDonald's Franchise?"
	},
	{
	"role": "assistant",
	"content": "Sure, here is a SWOT Analysis for a new McDonald's Franchise..."
	},
	{
	"role": "user",
	"content": "Thanks! Can you also generate a SWOT analysis for a Burger King Franchise?"
	}
]
  "id": "42",
  "model": "gpt-3.5-turbo"
}

Response:

{
  "success": true,
  "message": "Sure, here is a SWOT Analysis for a new Burger King Franchise:

Strengths:

1. Strong brand recognition and reputation
2. Wide range of menu options to cater to different customer preferences
3. Well-established supply chain and distribution system
4. Franchisee support system including training and marketing assistance...",
  "message_id": "generated-message-id",
  "persona": "Addison Brant"
}

Client-side, you should store the value of "message" into an array of messages inside of an object like:

{
	"role": "assistant",
	"content": "Sure, here is a SWOT Analysis for a new McDonald's Franchise..."
}
Contact
  • mackenzie@gptboss.com
OTHER
  • Our Sponsors
  • Hire Us as Developers
SOCIALS

GPTBoss 2.0 Beta

|