PromptLeo REST API (latest)

Download OpenAPI specification:Download

Welcome to the prompt engineering API by PromptLeo.

You can use this REST API to manage prompts library, submit online forms as well as trigger API endpoints. You need to register and add API keys first.

Authentication

PromptLeo uses API keys to allow access to the API. You can sign in and get your API key on the account page or on the workspace settings page.

PromptLeo expects for the API key to be included in all API requests to the server in a header that looks like the following:

Authorization: Bearer API_KEY

Workspace Scope

All API requests are executed in the scope of a certain workspace and all endpoint paths always begin with the /{workspace_id}/ prefix. You can find your workspace ID on the workspace settings page.

Endpoints

Endpoints enable the execution of prompt templates over a REST API. To create an endpoint and connect it to your backend (like ChatGPT), you need to sign in. Once created, this endpoint can be executed via a REST API by specifying template parameters in the request body and then receiving the generated response for the custom prompt.

/{workspace_id}/endpoints

Load all available endpoints

Authorizations:
api_key

Responses

Response samples

Content type
application/json
[
  • {
    }
]

/{workspace_id}/endpoints/{name}

Passes the parameters from the request body to the prompt template, creates a final prompt and then passes it to the Generative AI backend configured. Returns the generated prompt answer. You can see the response to the prompt Which country is {city} in? on the right.

Authorizations:
api_key
path Parameters
name
required
string
Example: city_finder

The name of the endpoint to be executed.

Request Body schema: application/json

Endpoint execution request

object

Map of parameter names and values.

metadata
object

Map of custom metadata perameters and values to be passed to the engine.

Responses

Request samples

Content type
application/json
{
  • "params": {
    }
}

Response samples

Content type
application/json
{
  • "status": "SUCCESS",
  • "choices": [
    ]
}

Prompts

Prompt library management. Find, create, update and delete prompts and prompt versions.

/{workspace_id}/prompts

Load all available prompts. With a prompt ID, you can request its versions containing prompt text and parameters.

Authorizations:
api_key

Responses

Response samples

Content type
application/json
[
  • {
    }
]

/{workspace_id}/prompts

Create a new prompt object.

Authorizations:
api_key
Request Body schema: application/json

Prompt create request

name
string

Name of a prompt.

Responses

Request samples

Content type
application/json
{
  • "name": "Idea Generator Prompt"
}

Response samples

Content type
application/json
{
  • "uid": "e9f6318246",
  • "name": "Idea Generator Prompt",
  • "dateCreated": "2023-02-18T14:41:18.000Z",
  • "dateUpdated": "2023-02-18T14:41:18.000Z"
}

/{workspace_id}/prompts/{id}

Load a specific prompt object.

Authorizations:
api_key
path Parameters
id
required
string
Example: e9f6318246

The ID of the prompt.

Responses

Response samples

Content type
application/json
{
  • "uid": "string",
  • "name": "string",
  • "dateCreated": "2023-02-18T14:41:18.000Z",
  • "dateUpdated": "2023-02-18T14:41:18.000Z"
}

/{workspace_id}/prompts/{id}

Update a prompt object.

Authorizations:
api_key
path Parameters
id
required
string
Example: e9f6318246

The ID of the prompt.

Request Body schema: application/json

Prompt update request

name
string

Name of a prompt.

Responses

Request samples

Content type
application/json
{
  • "name": "Idea Generator Prompt"
}

Response samples

Content type
application/json
{
  • "uid": "string",
  • "name": "string",
  • "dateCreated": "2023-02-18T14:41:18.000Z",
  • "dateUpdated": "2023-02-18T14:41:18.000Z"
}

/{workspace_id}/prompts/{id}

Delete a specific prompt object.

Authorizations:
api_key
path Parameters
id
required
string
Example: e9f6318246

The ID of the prompt.

Responses

Response samples

Content type
application/json
{
  • "uid": "string",
  • "name": "string",
  • "dateCreated": "2023-02-18T14:41:18.000Z",
  • "dateUpdated": "2023-02-18T14:41:18.000Z"
}

Prompt Versions

Each prompt may contain many versions so that it's easy to test, improve and replace prompt texts used in production.

/{workspace_id}/prompts/{id}/versions

Load all versions of a prompt.

Authorizations:
api_key
path Parameters
workspace_id
required
string
Example: e9f6318246

The ID of the workspace.

id
required
string
Example: e9f6318246

The ID of the prompt.

Responses

Response samples

Content type
application/json
[
  • {
    }
]

/{workspace_id}/prompts/{id}/versions

Create a new prompt version.

Authorizations:
api_key
path Parameters
workspace_id
required
string
Example: e9f6318246

The ID of the workspace.

id
required
string
Example: e9f6318246

The ID of the prompt.

Request Body schema: application/json

Prompt version create request

name
string

Name of a prompt.

content
string

The text of the prompt.

Responses

Request samples

Content type
application/json
{
  • "name": "version-2",
  • "content": "Which country is {city} in?"
}

Response samples

Content type
application/json
{
  • "uid": "e9f6318246",
  • "name": "version-2",
  • "content": "Which country is {city} in?",
  • "dateCreated": "2023-02-18T14:41:18.000Z",
  • "dateUpdated": "2023-02-18T14:41:18.000Z"
}

/{workspace_id}/prompts/{id}/versions/{vid}

Load a specific prompt version.

Authorizations:
api_key
path Parameters
workspace_id
required
string
Example: e9f6318246

The ID of the workspace.

id
required
string
Example: e9f6318246

The ID of the prompt.

vid
required
string
Example: e9f6318246

The ID of the prompt version.

Responses

Response samples

Content type
application/json
{
  • "uid": "3eb6be3138",
  • "name": "version-3",
  • "content": "Which country is `{city}` in?",
  • "dateCreated": "2023-02-18T14:41:18.000Z",
  • "dateUpdated": "2023-02-18T14:41:18.000Z"
}

/{workspace_id}/prompts/{id}/versions/{vid}

Update a prompt version.

Authorizations:
api_key
path Parameters
workspace_id
required
string
Example: e9f6318246

The ID of the workspace.

id
required
string
Example: e9f6318246

The ID of the prompt.

vid
required
string
Example: e9f6318246

The ID of the prompt version.

Request Body schema: application/json

Prompt update request

name
string

Name of a prompt.

content
string

The text of the prompt.

Responses

Request samples

Content type
application/json
{
  • "name": "version-2",
  • "content": "Which country is {city} in?"
}

Response samples

Content type
application/json
{
  • "uid": "3eb6be3138",
  • "name": "version-3",
  • "content": "Which country is `{city}` in?",
  • "dateCreated": "2023-02-18T14:41:18.000Z",
  • "dateUpdated": "2023-02-18T14:41:18.000Z"
}

/{workspace_id}/prompts/{id}/versions/{vid}

Delete a specific prompt version.

Authorizations:
api_key
path Parameters
workspace_id
required
string
Example: e9f6318246

The ID of the workspace.

id
required
string
Example: e9f6318246

The ID of the prompt.

vid
required
string
Example: e9f6318246

The ID of the prompt version.

Responses

Response samples

Content type
application/json
{
  • "uid": "3eb6be3138",
  • "name": "version-3",
  • "content": "Which country is `{city}` in?",
  • "dateCreated": "2023-02-18T14:41:18.000Z",
  • "dateUpdated": "2023-02-18T14:41:18.000Z"
}