Prompts API Documentation
GET: Retrieve Prompts
Description
This route is used to retrieve a list of Prompts will fine-tune the interaction between the user and the copilot assistant.
Method
GET
Query Parameters
sort
(string): The field by which to sort the Knowledge base.page
(number): The page number of the results.limit
(number): The number of items per page.searchTerm
(string): Optional search term to filter Knowledge base.
Response
- Returns a JSON response with the list of prompts or an error message.
Status Codes
200 OK
: Prompts retrieved successfully.500 Internal Server Error
: Error listing Prompts.
Throws
- An error if request validation or prompts retrieval fails.
Example cURL
curl --location 'https://app.ai12z.net/api/projects/{projectId}/prompt' \
--header 'Authorization: Bearer <YOUR_KEY>'
--data-urlencode 'sort=name' \
--data-urlencode 'page=1' \
--data-urlencode 'limit=10'
GET: Retrieve Prompts by ID
Description
This route is used to retrieve details of a specific prompts by its ID.
Method
GET
URL Parameters
id
(string): The ID of the prompts to retrieve.
Response
- Returns a JSON response with prompts details such as
id
,prompt
,systemprompt
,temperature
,noOfDocuments
andmaxTokens
.
Status Codes
200 OK
: Prompts retrieved successfully.500 Internal Server Error
: Error retrieving the Prompts.
Throws
- An error if the Prompts is not found or any other error occurs.
Example cURL
curl --location 'https://app.ai12z.net/api/projects/{projectId}/prompt' \
--header 'Authorization: Bearer <YOUR_KEY>'
POST: Create a Prompts
Description
This route is used to create a new prompts for a project.
Method
POST
Request Body
Example request body:
{
"name": "Prompt Name",
"isDefault": "true or false",
"modelId": "Model",
"systemPrompt": "systemprompt Name",
"prompt": "About Prompt",
"temperature": "temperature",
"noOfDocuments": "noOfDocuments",
"maxTokens": "maxTokens"
}
Response
- Returns the newly created Prompts.
Status Codes
200 OK
: Prompts created successfully.500 Internal Server Error
: Error creating the Prompts.
Throws
- An error if request validation or Prompts creation fails.
Example cURL
curl --location 'https://app.ai12z.net/api/projects/{projectId}/prompts' \
--header 'Authorization: Bearer <YOUR_KEY>' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Prompt Name",
"isDefault":"true or false",
"modelId": "Model",
"systemPrompt": "systemprompt Name",
"prompt":"About Prompt",
"temperature":"temperature",
"noOfDocuments":"noOfDocuments",
"maxTokens": "maxTokens"
}'
PUT: Update a Prompts
Description
This route is used to update an existing prompts.
Method
PUT
Request Body
Example request body:
{
"id": "prompt ID",
"name": "Prompt Name",
"isDefault": "true or false",
"modelId": "Model",
"systemPrompt": "systemprompt Name",
"prompt": "About Prompt",
"temperature": "temperature",
"noOfDocuments": "noOfDocuments",
"maxTokens": "maxTokens"
}
Response
- Returns the updated prompts.
Status Codes
200 OK
: Prompts updated successfully.500 Internal Server Error
: Error updating the Prompts.
Throws
- An error if request validation or Prompt update fails.
Example cURL
curl --location --request PUT 'https://app.ai12z.net/api/projects/{projectId}/prompt' \
--header 'Authorization: Bearer <YOUR_KEY>' \
--header 'Content-Type: application/json' \
--data-raw '{
"id":"prompt ID",
"name": "Prompt Name",
"isDefault":"true or false",
"modelId": "Model",
"systemPrompt": "systemprompt Name",
"prompt":"About Prompt",
"temperature":"temperature",
"noOfDocuments":"noOfDocuments",
"maxTokens": "maxTokens"
}'
DELETE: Delete a Prompts
Description
This route is used to delete an existing prompts.
Method
DELETE
Request Body
Example request body:
{
"id": "Prompt ID"
}
Response
- Returns a confirmation message indicating successful deletion.
Status Codes
200 OK
: Prompts deleted successfully.500 Internal Server Error
: Error deleting the Prompts.
Throws
- An error if request validation or prompts deletion fails.
Example cURL
curl --location --request DELETE 'https://app.ai12z.net/api/projects/{projectId}/prompt' \
--header 'Authorization: Bearer <YOUR_KEY>' \
--header 'Content-Type: application/json' \
--data-raw '{
"id": "Prompt ID"
}'