Auth
HEADERS
Key | Value |
Api-token | api_token from |
X-Requested-With | XMLHttpRequest |
Accept | application/json |
401 - Unauthenticated; API Token is invalid or expired OR Subscription is inactive
{
"error": "Unauthenticated"
}
POST Create Assistant
POST Create Assistant
https://api.peakprivacy.ch/v1/ai/assistants
REQUEST BODY SCHEMA: application/json
Key | Value |
name | string (required) Assistant Name |
model | string (required) |
instructions | text (optional) |
temperature | number (required) |
anonymize | boolean (required) |
file_ids | array of strings (optional) |
REQUEST BODY EXAMPLE
{
"name": "Invoices",
"model": "mistral-swiss",
"instructions": "Please provide the answer in Spanish",
"temperature": 0.5,
"anonymize": true,
"file_ids": ["b7454f54-aa96-4306-b64d-83343d7bf4a4"]
}Example request
curl --location --request POST 'https://api.peakprivacy.ch/v1/ai/assistants' \
--header 'Api-token: api-token' \
--header 'X-Requested-With: XMLHttpRequest' \
--header 'Accept: application/json' \
--header 'Content-Type:/ application/json' \
--data '{
"name": "Invoices",
"model": "mistral-swiss",
"instructions": "Please provide the answer in Spanish",
"temperature": 0.5,
"anonymize": true,
"file_ids": ["b7454f54-aa96-4306-b64d-83343d7bf4a4"]
}'
Possible Responses
201 - Success
201 - Success
{
"id": "7ca6999d-3ed4-47d7-8915-4df8aab6c989",
"name": "Invoices",
"model": "mistral-swiss",
"instructions": "Please provide the answer in Spanish",
"temperature": 0.5,
"anonymize": true,
"files": [
{
"id": "b7454f54-aa96-4306-b64d-83343d7bf4a4",
"name": "twint_pat_instructions_1.pdf",
"ext": "pdf",
"size": "2371319",
"mimetype": "application/pdf"
}
]
}422 - Validation Error
422 - Validation Error
{
"message": "Validation error",
"errors": {
"model": [
"The model field must be a string.",
"The selected model is invalid."
],
"name": [
"The name field is required."
]
}
}PUT Update Assistant
PUT Update Assistant
https://api.peakprivacy.ch/v1/ai/assistants/{id}REQUEST BODY SCHEMA: application/json
Key | Value |
name | string |
model | string |
instructions | text |
temperature | number |
anonymize | boolean |
file_ids | array of strings (optional) |
REQUEST BODY EXAMPLE
{
"name": "Assistant Name UPDATED",
"model": "mistral-swiss",
"instructions": "Please provide the answer in Spanish",
"temperature": 0.7,
"anonymize": true,
"file_ids": ["b7454f54-aa96-4306-b64d-83343d7bf4a4"]
}Example request
curl --location --request PUT 'https://api.peakprivacy.ch/v1/ai/assistants/d9ba620b-4b8b-4ded-89be-d93b08ad786d' \
--header 'Api-token: api-token' \
--header 'X-Requested-With: XMLHttpRequest' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"name": "Assistant Name UPDATED",
"model": "mistral-swiss",
"instructions": "Please provide the answer in Spanish",
"temperature": 0.7,
"anonymize": true,
"file_ids": ["b7454f54-aa96-4306-b64d-83343d7bf4a4"]
}'
Possible Responses
200 - Success
200 - Success
{
"id": "d9ba620b-4b8b-4ded-89be-d93b08ad786d",
"name": "Assistant Name UPDATED",
"model": "mistral-swiss",
"instructions": "Please provide the answer in Spanish",
"temperature": 0.7,
"anonymize": true,
"files": [
{
"id": "b7454f54-aa96-4306-b64d-83343d7bf4a4",
"name": "twint_pat_instructions_1.pdf",
"ext": "pdf",
"size": "2371319",
"mimetype": "application/pdf"
}
]
}422 - Validation Error
422 - Validation Error
{
"message": "Validation error",
"errors": {
"model": [
"The model field must be a string.",
"The selected model is invalid."
],
"name": [
"The name field is required."
]
}
}404 - Not Found
404 - Not Found
{
"error": "Not found"
}GET Retrieve Assistant
GET Retrieve Assistant
https://api.peakprivacy.ch/v1/ai/assistants/{id}Example request
curl --location --request GET 'https://api.peakprivacy.ch/v1/ai/assistants/c33a8b18-c82a-4955-a449-515001848b1f' \
--header 'Api-token: api-token' \
--header 'X-Requested-With: XMLHttpRequest' \
--header 'Accept: application/json'
Possible Responses
200 - Success
200 - Success
{
"id": "c33a8b18-c82a-4955-a449-515001848b1f",
"name": "Assistant Name_UPDATED",
"model": "gpt-3.5-turbo-1106",
"instructions": "context_UPDATED (PUT)",
"temperature": 0.7,
"anonymize": true,
"files": [
{
"id": "b7454f54-aa96-4306-b64d-83343d7bf4a4",
"name": "twint_pat_instructions_1.pdf",
"ext": "pdf",
"size": "2371319",
"mimetype": "application/pdf"
}
]
}404 - Not Found
404 - Not Found
{
"error": "Not found"
}GET Assistants paginated list
GET Assistants paginated list
https://api.peakprivacy.ch/v1/ai/assistants
GET Parameters
Key | Value |
limit | int (optional) |
cursor | string (optional) |
Example request
curl --location --request GET 'https://api.peakprivacy.ch/v1/ai/assistants?limit=6' \
--header 'API-TOKEN: api-token' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json'
Possible Responses
200 - Success
200 - Success
{
"data": [
{
"uuid": "8147e92d-2b98-4719-8ba1-d6a3a968e4cf",
"name": "Invoices",
"model": null,
"instructions": null,
"files": []
},
{
"uuid": "98369e03-2aaa-4810-89c6-d05157965738",
"name": "Invoices",
"model": null,
"instructions": null,
"files": [
{
"id": "fc2930a6-8d3f-4d8f-bb2f-5f75cced1aa6",
"name": "test-2",
"ext": "txt",
"size": "12345",
"mimetype": "text/plain-text"
}
]
}
],
"links": {
"first": null,
"last": null,
"prev": null,
"next": "{{ $frontmatter.global.apiUrl }}/v1/ai/assistants?cursor=eyJhc3Npc3RhbnRzLmlkIjoyLCJfcG9pbnRzVG9OZXh0SXRlbXMiOnRydWV9"
},
"meta": {
"path": "{{ $frontmatter.global.apiUrl }}/v1/ai/assistants",
"per_page": 2,
"next_cursor": "eyJhc3Npc3RhbnRzLmlkIjoyLCJfcG9pbnRzVG9OZXh0SXRlbXMiOnRydWV9",
"prev_cursor": null
}
}DELETE Delete Assistant
DELETE Delete Assistant
https://api.peakprivacy.ch/v1/ai/assistants/{id}Example request
curl --location --request DELETE 'https://api.peakprivacy.ch/v1/ai/assistants/a4904bba-e854-4709-9e48-8cbc149fff35' \
--header 'Api-token: api_token' \
--header 'X-Requested-With: XMLHttpRequest' \
--header 'Accept: application/json' \
Possible Responses
204 - Success
204 - Success
NO CONTENT
404 - Not Found
404 - Not Found
{
"error": "Not found"
}POST Ask Assistant
POST Ask Assistant
https://api.peakprivacy.ch/v1/ai/assistants/{id}/askREQUEST BODY SCHEMA: application/json
Key | Value |
messages | required |
Following params are optional and override corresponding Assistant params | |
model | string |
temperature | number or null |
anonymize | boolean or null |
messages SCHEMA:
Key | Value |
role | string |
content | string |
BODY raw
{
"model": "mistral-swiss",
"messages": [
{
"role": "user",
"content": "Create a summary of all my documents"
}
],
"temperature": 0.2,
"anonymize" : true
}Example request
curl --location --request POST 'https://api.peakprivacy.ch/v1/ai/assistants/c33a8b18-c82a-4955-a449-515001848b1f/ask' \
--header 'API-TOKEN: api-token' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"messages": [
{
"role": "user",
"content": "create document summary"
}
]
}'
Possible Responses
RESPONSE SCHEMA: application/json
Key | Value |
id | string |
object | string |
created | integer |
model | string |
choices | Array of objects |
usage | object |
choices SCHEMA: application/json
Key | Value |
finish_reason | string |
index | string |
message | object |
message SCHEMA: application/json
Key | Value |
role | string |
content | string |
usage SCHEMA: application/json
Key | Value |
completion_tokens | integer |
prompt_tokens | integer |
total_tokens | integer |
200 - Sucess
200 - Sucess
{
"id": "2820e9eb-22e9-40c6-a2fb-07d7ee06453d",
"object": "chat.completion",
"created": 1710243743,
"model": "mistral-swiss",
"choices": [
{
"finish_reason": "stop",
"index": 0,
"message": {
"content": "The document contains instructions for downloading and using the TWINT configurator app, including information on selecting the app environment, version, and build, onboarding the app, topping up credit, and updating the app. It also provides details for iOS and Android devices.",
"role": "assistant"
}
}
],
"usage": {
"completion_tokens": 54,
"prompt_tokens": 1196,
"total_tokens": 1250
}
}422 - Unprocessable Entity; Validation Error
422 - Unprocessable Entity; Validation Error
{
"message": "The model field is required.",
"errors": {
"model": [
"The selected model is invalid."
]
}
}404 - Assistant Not Found
404 - Assistant Not Found
{
"error": "Not found"
}
