Appearance
PeakPrivacy Assistants API
Auth
HEADERS
| Key | Value |
|---|---|
| Api-token | api_token from [https://app.peakprivacy.ch/api-tokens](https://app.peakprivacy.ch/api-tokens) |
| X-Requested-With | XMLHttpRequest |
| Accept | application/json |
401 - Unauthenticated; API Token is invalid or expired OR Subscription is inactive
json
{
"error": "Unauthenticated"
}POST Create Assistant
sh
https://api.peakprivacy.ch/v1/ai/assistantsREQUEST BODY SCHEMA: application/json
| Key | Value |
|---|---|
| name | string (required) Assistant Name |
| model | string (required) Specifies the model which will be applied to the assistant by default Supported models : gpt-4-1106-previewgpt-4gpt-3.5-turbo-1106mistral-tinymistral-smallmistral-mediummistral-swiss |
| instructions | text (optional) Additional instructions for the assistant. Example: 'Please provide the answer in Spanish' |
| temperature | number (required)[ 0 .. 1 ]What sampling temperature to use, between 0.0 and 1.0. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. |
| anonymize | boolean (required) Default: trueWhether to use anonymization for the prompt. Might slightly increase response time due to anonymzation & deanonymization algorithms work. |
| file_ids | array of strings (optional) IDs of files to be attached to the assistant |
REQUEST BODY EXAMPLE
json
{
"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
sh
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
json
{
"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
json
{
"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
sh
https://api.peakprivacy.ch/v1/ai/assistants/{id}REQUEST BODY SCHEMA: application/json
| Key | Value |
|---|---|
| name | string Assistant Name |
| model | string Specifies the model which will be applied to the assistant by default Supported models : gpt-4-1106-previewgpt-4gpt-3.5-turbo-1106mistral-tinymistral-smallmistral-mediummistral-swiss |
| instructions | text Additional instructions for the assistant. Example: 'Please provide the answer in Spanish' |
| temperature | number[ 0 .. 1 ]What sampling temperature to use, between 0.0 and 1.0. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. |
| anonymize | boolean Whether to use anonymization for the prompt. Might slightly increase response time due to anonymzation & deanonymization algorithms work. |
| file_ids | array of strings (optional) IDs of files to be attached to the assistant NOTE: update is performed with 'sync' logic, so if some of attached files are absent in the provided array, they will be detached of the assistant. Empty array will detach all files. To leave files list untouched don't send this parameter |
REQUEST BODY EXAMPLE
json
{
"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
sh
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
json
{
"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
json
{
"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
json
{
"error": "Not found"
}GET Retrieve Assistant
sh
https://api.peakprivacy.ch/v1/ai/assistants/{id}Example request
sh
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
json
{
"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
json
{
"error": "Not found"
}GET Assistants paginated list
sh
https://api.peakprivacy.ch/v1/ai/assistantsGET Parameters
| Key | Value |
|---|---|
| limit | int (optional) default: 20 Per page items |
| cursor | string (optional) Pagination cursor |
Example request
sh
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
json
{
"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
sh
https://api.peakprivacy.ch/v1/ai/assistants/{id}Example request
sh
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
json
NO CONTENT404 - Not Found
json
{
"error": "Not found"
}POST Ask Assistant
sh
https://api.peakprivacy.ch/v1/ai/assistants/{id}/askREQUEST BODY SCHEMA: application/json
| Key | Value |
|---|---|
| messages | required Array of objects The prompt(s) to generate completions for, encoded as a list of dict with role and content. |
| Following params are optional and override corresponding Assistant params | |
| model | string Specifies the version of the GPT model to be used. Supported models : gpt-4-1106-previewgpt-4gpt-3.5-turbo-1106mistral-tinymistral-smallmistral-mediummistral-swiss |
| temperature | number or null [ 0 .. 1 ]What sampling temperature to use, between 0.0 and 1.0. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. |
| anonymize | boolean or null Whether to use anonymization for the prompt. Might slightly increase response time due to anonymzation & deanonymization algorithms work. |
messages SCHEMA:
| Key | Value |
|---|---|
| role | stringsystem user assistantSpecifies the LLM the prompt will be sent to |
| content | string |
BODY raw
json
{
"model": "mistral-swiss",
"messages": [
{
"role": "user",
"content": "Create a summary of all my documents"
}
],
"temperature": 0.2,
"anonymize" : true
}Example request
sh
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 - Success
json
{
"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
json
{
"message": "The model field is required.",
"errors": {
"model": [
"The selected model is invalid."
]
}
}404 - Assistant Not Found
json
{
"error": "Not found"
}