patris API

patris.ai bietet eine einfache und DSGVO-konforme Schnittstelle, die es Benutzern ermöglicht, alle verfügbaren LLMs über eine REST-API zu nutzen.

Chat

Base URL

The base URL for all API endpoints is https://app.patris.ai.

Endpoint: /api/v1/chat/:id

Description

This endpoint allows users to have interactive chats with the API by sending a question or message and receiving a response.

Request

  • Method: POST
  • Content-Type: application/json
  • Authorization: PATRIS_API_KEY

Request Path Parameters

Parameter Type Required Description
id string Yes The ID of the chat session.

Request Body Parameters

Parameter Type Required Description
message string Yes The question or message to be responded to.
chatId string No The ID of the chat history, used for future chats.
targetUrl string No The URL of another API endpoint to be triggered.
Example Request
POST /api/v1/chat/1234
Content-Type: application/json
Authorization: PATRIS_API_KEY

{
"message": "What is the weather like today?",
"chatId": "5678",
"history": true,
"response_format": "txt"
}

Response

  • Status Code: 200 OK
  • Content-Type: application/json

Response Body

Property Type Description
answer object Contains the response from the chat and other related data.

The answer object further has these properties:

Property Type Description
message string The response to the provided question or message.
executionTime number The time taken to execute the function in milliseconds.
price number The cost of the API call in euros.
chatId string The ID of the chat session.
Example Response
HTTP/1.1 200 OK
Content-Type: application/json
{
"answer": {
"message": "The weather today is sunny.",
"executionTime": 50,
"price": 0.05,
"chatId": "1234"
	}
}

Error Handling

In case of errors, the API will respond with the appropriate HTTP status code and an error message in the response body.

  • Status Code: 400 Bad Request
  • Content-Type: application/json
Example Error Response
HTTP/1.1 400 Bad Request
Content-Type: application/json

{
"error": "Invalid request. Please provide valid parameters."
}
  • Status Code: 404 Not Found
  • Content-Type: application/json
Example Error Response
HTTP/1.1 404 Not Found
Content-Type: application/json

{
"error": "API endpoint doesn't exist"
}
  • Status Code: 429 Too Many Requests
  • Content-Type: application/json
Example Error Response
HTTP/1.1 429 Too Many Requests
Content-Type: application/json

{
"error": "Insufficient funds"
}

Agents

Get a list of all existing Agents

Retrieves a list of all agents or modules created by the authenticated user.

Endpoint: /api/agents/

Request

  • Method: GET
  • Content-Type: application/json
  • Authorization: PATRIS_API_KEY

Response

{
 "success": true,
 "message": "Agents retrieved successfully",
 "data": [
   {
     "id": "string",
     "userId": "string",
     "name": "string",
     "model": "string",
     "description": "string",
     "promptTemplate": "string",
     "temperature": "number",
     "options": {
       "webcrawling": "boolean",
       "google_search": "boolean"
     },
     "category": "string"
   }
 ]
}

Create a new agent 

Retrieves a list of all agents or modules created by the authenticated user.

Endpoint: /api/agents/

Request

  • Method: POST
  • Content-Type: application/json
  • Authorization: PATRIS_API_KEY

Request Body

{
 "name": "string",
 "model": "string",
 "description": "string",
 "promptTemplate": "string",
 "temperature": "number",
 "options": {
   "webcrawling": "boolean",
   "google_search": "boolean"
 },
 "category": "string"
}
  • name (required, string): The name of the agent.
  • model (optional, string): The AI model to be used for the agent. Default is „automatic“.
  • description (optional, string): A description explaining how to use the agent.
  • promptTemplate (optional, string): The default system prompt for the agent.
  • temperature (optional, number): A value between 0 and 1 that controls the creativity of the agent’s responses.
  • options (optional, object): Additional options for the agent.
    • webcrawling (boolean): Allows the agent to access websites.
    • google_search (boolean): Allows the agent to autonomously use Google Search.
  • category (optional, string): The general category of the agent.

Response

{
 "success": true,
  "message": "Agent added successfully",
  "data": {
    "id": "string",
    "userId": "string",
    "name": "string",
    "model": "string",
    "description": "string",
    "promptTemplate": "string",
    "temperature": "number",
    "options": {
      "webcrawling": "boolean",
      "google_search": "boolean"
    },
    "category": "string"
  }
}

Update an agent

Deletes an existing agent or module for the authenticated user.

Endpoint: /api/agents/:id

Request

  • Method: PUT
  • Content-Type: application/json
  • Authorization: PATRIS_API_KEY

Requested parameters

  • id (required, string): The ID of the agent to be updated.

Example request

{
 "name": "string",
 "model": "string",
 "description": "string",
 "promptTemplate": "string",
 "temperature": "number",
 "options": {
   "webcrawling": "boolean",
   "google_search": "boolean"
 },
 "category": "string"
}
Response example
{
 "success": true,
  "message": "Agent updated successfully",
	"data": 
	{
	"name": "string",
	"model": "string",
	 "description": "string",
	 "promptTemplate": "string",
	 "temperature": "number",
	 "options": {
		 "webcrawling": "boolean",
		"google_search": "boolean"
	},
	 "category": "string"
	}
}

Delete an agent

Deletes an existing agent or module for the authenticated user.

Endpoint: /api/agents/

Request

  • Method: DELETE
  • Content-Type: application/json
  • Authorization: PATRIS_API_KEY

Requested parameters

  • id (required, string): The ID of the agent to be deleted.

Response example

{
 "success": true,
  "message": "Agent deleted successfully",
  "id": "string"
}
en_USEN