Skip to content
synthreo.ai

ThreoAI API Management

ThreoAI API reference - create, configure, and manage Custom GPT agents and conversational AI workflows programmatically via the Synthreo REST API.

The ThreoAI API enables developers to create, manage, and interact with custom AI assistants programmatically. In the ThreoAI platform:

  • My GPTs (UI term): Custom AI assistants visible to users in the interface
  • Contexts (API term): The underlying data structure that powers My GPTs

This documentation uses “My GPT” when describing user-facing concepts and “context” when referring to the actual API endpoints and data structures. Each My GPT/context consists of specific knowledge (training documents), custom instructions that define behavior, conversation starters, and optional tools that extend capabilities.

Base URL: https://threo-api.synthreo.ai

TermDescription
My GPT (Context)A custom AI assistant with specific knowledge, instructions, and capabilities
Training DocumentsFiles that provide domain-specific knowledge to your My GPT
Conversation StartersPre-defined prompts that help users interact with your My GPT
Custom ToolsAgent integrations that allow your My GPT to perform specialized actions via the Builder platform
Semantic SearchVector-based document retrieval for contextually relevant responses
OperationMethodEndpointDescription
Create My GPTPOST/contextCreate a new custom AI assistant
List My GPTsGET/contextGet all My GPTs for your account
Get My GPTGET/context/{contextId}Get detailed info about a specific My GPT
Update My GPTPUT/context/{contextId}Modify My GPT configuration
Delete My GPTDELETE/context/{contextId}Permanently remove a My GPT
Upload DocumentPOST/context/upload/{contextId}Add training documents
List DocumentsGET/context/documents/{contextId}List all training documents
Delete DocumentDELETE/context/documents/{contextId}/{documentId}Delete a training document
Search KnowledgePOST/context/relevant-docs/{contextId}Find relevant content via semantic search
Share My GPTPUT/context/share/{contextId}Make My GPT public or private

All endpoints require authentication via JWT Bearer token.

URL: POST https://auth.synthreo.ai/threo/token

Request Body:

{
"email": "example@company.com",
"password": "password",
"customerId": 123
}

Field Descriptions:

FieldTypeRequiredDescription
emailstringYesYour email address
passwordstringYesYour password
customerIdintegerNoThe customer you want to generate a token for. If omitted, generates a token for your default customer.

Example Response:

{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"customerOptions": [
{
"customerId": 123,
"displayName": "MyCompany",
"roleName": "Admin",
"isOwner": false
}
]
}

The value in token is your JWT token. Include it in all future calls:

Authorization: Bearer your_jwt_token

Create a custom AI assistant with specific instructions and capabilities.

Endpoint: POST /context

Request Parameters:

ParameterTypeRequiredDescription
namestringYesDisplay name for your My GPT (e.g., “Legal Assistant”, “Marketing Expert”)
descriptionstringYesSystem instructions/prompts that define the My GPT’s behavior and personality
captionstringYesBrief description of the My GPT’s purpose and capabilities
toolsJsonstringYesJSON string defining custom tools (see Custom Tools section). If no tools, must be set to "[]"
starterPromptsarray of stringsNoPre-defined conversation starters (auto-generated if not provided)

Example Request:

POST /context HTTP/1.1
Host: threo-api.synthreo.ai
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
{
"name": "Example GPT",
"description": "You are an example GPT",
"caption": "Example GPT",
"toolsJson": "[]",
"starterPrompts": [
"Analyze this contract for potential risks",
"What are the key compliance requirements for this regulation?",
"Draft a summary of this legal document"
]
}

Response Example:

{
"id": 123,
"name": "Legal Assistant",
"description": "You are a specialized legal assistant with expertise in contract analysis...",
"caption": "AI assistant for legal research and contract analysis",
"userId": 456,
"embeddingModel": "text-embedding-3-small",
"maxSize": 104857600,
"topN": 5,
"scoreThreshold": 0,
"chunkSize": 1000,
"overlap": 0.2,
"toolsJson": "[]",
"starterPrompts": [
"Analyze this contract for potential risks",
"What are the key compliance requirements for this regulation?",
"Draft a summary of this legal document"
],
"shareState": 0,
"deleted": null,
"created": "2025-01-15T10:30:00Z"
}

Response Fields:

FieldTypeDescription
idintegerUnique identifier for the My GPT
namestringDisplay name
descriptionstringSystem prompt/instructions
captionstringShort description
userIdintegerID of the user who created this My GPT
embeddingModelstringThe embedding model used for document retrieval
maxSizeintegerMaximum total document size in bytes
topNintegerNumber of top document chunks returned in semantic search
scoreThresholdnumberMinimum similarity score for document retrieval
chunkSizeintegerNumber of tokens per document chunk
overlapnumberFraction of overlap between adjacent chunks (0.0 to 1.0)
toolsJsonstringStringified JSON array of custom tool definitions
starterPromptsarrayPre-defined conversation starter prompts
shareStateinteger0 = private, 1 = shared
createdstringISO 8601 creation timestamp

Retrieve all My GPTs associated with your account.

Endpoint: GET /context

Example Request:

GET /context HTTP/1.1
Host: threo-api.synthreo.ai
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

Response Example:

[
{
"id": 123,
"name": "Legal Assistant",
"description": "You are a specialized legal assistant with expertise in contract analysis...",
"caption": "AI assistant for legal research and contract analysis",
"userId": 456,
"embeddingModel": "text-embedding-3-small",
"maxSize": 104857600,
"topN": 5,
"scoreThreshold": 0,
"chunkSize": 1000,
"overlap": 0.2,
"toolsJson": "[]",
"starterPrompts": [
"Analyze this contract for potential risks",
"What are the key compliance requirements for this regulation?",
"Draft a summary of this legal document"
],
"shareState": 0,
"deleted": null,
"created": "2025-01-15T10:30:00Z"
}
]

Retrieve detailed information about a specific My GPT, including its configuration and metadata.

Endpoint: GET /context/{contextId}

Path Parameters:

ParameterTypeRequiredDescription
contextIdintegerYesID of the My GPT to retrieve

Example Request:

GET /context/123 HTTP/1.1
Host: threo-api.synthreo.ai
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

Response Example:

{
"id": 123,
"name": "Legal Assistant",
"description": "You are a specialized legal assistant with expertise in contract analysis...",
"caption": "AI assistant for legal research and contract analysis",
"userId": 456,
"embeddingModel": "text-embedding-3-small",
"maxSize": 104857600,
"topN": 5,
"scoreThreshold": 0,
"chunkSize": 1000,
"overlap": 0.2,
"toolsJson": "[]",
"starterPrompts": [
"Analyze this contract for potential risks",
"What are the key compliance requirements for this regulation?",
"Draft a summary of this legal document"
],
"shareState": 0,
"deleted": null,
"created": "2025-01-15T10:30:00Z"
}

Modify an existing My GPT’s name, description, instructions, or conversation starters.

Endpoint: PUT /context/{contextId}

Path Parameters:

ParameterTypeRequiredDescription
contextIdintegerYesID of the My GPT to update

Request Parameters:

ParameterTypeRequiredDescription
namestringYesDisplay name for your My GPT
descriptionstringYesSystem instructions/prompts that define behavior and personality
captionstringYesBrief description of the My GPT’s purpose
toolsJsonstringNoJSON string defining custom tools. If no tools, must be set to "[]"
starterPromptsarray of stringsNoPre-defined conversation starters

Example Request:

PUT /context/123 HTTP/1.1
Host: threo-api.synthreo.ai
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
{
"name": "Example GPT",
"description": "You are an example GPT",
"caption": "Example GPT",
"toolsJson": "[]",
"starterPrompts": [
"Analyze this contract for potential risks",
"What are the key compliance requirements for this regulation?"
]
}

Response Example:

{
"id": 123,
"name": "Legal Assistant",
"description": "You are a specialized legal assistant with expertise in contract analysis...",
"caption": "AI assistant for legal research and contract analysis",
"userId": 456,
"embeddingModel": "text-embedding-3-small",
"maxSize": 104857600,
"topN": 5,
"scoreThreshold": 0,
"chunkSize": 1000,
"overlap": 0.2,
"toolsJson": "[]",
"starterPrompts": [
"Analyze this contract for potential risks",
"What are the key compliance requirements for this regulation?"
],
"shareState": 0,
"deleted": null,
"created": "2025-01-15T10:30:00Z"
}

Permanently remove a My GPT and all associated data including training documents and embeddings.

Endpoint: DELETE /context/{contextId}

Path Parameters:

ParameterTypeRequiredDescription
contextIdintegerYesID of the My GPT to delete

Example Request:

DELETE /context/123 HTTP/1.1
Host: threo-api.synthreo.ai
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

Response: 200 OK on success


Add documents to train your My GPT with domain-specific knowledge. The system automatically processes documents into searchable chunks with embeddings.

Endpoint: POST /context/upload/{contextId}

Path Parameters:

ParameterTypeRequiredDescription
contextIdintegerYesID of the My GPT to add documents to

Request: Multipart form data with a single file in the file field.

Supported File Types:

  • PDF documents (.pdf)
  • Microsoft Word (.docx, .doc)
  • Plain text files (.txt)
  • Markdown files (.md)
  • CSV files (.csv)

Example Request (cURL):

Terminal window
curl -X POST 'https://threo-api.synthreo.ai/context/upload/123' \
-H 'Authorization: Bearer YOUR_JWT_TOKEN' \
-F 'file=@/path/to/document.pdf'

Response Example:

"ba8dc2ac-8dce-ab82-e4ee-f8a2123128cd2"

The response is the document ID (a UUID string) that can be used to delete the document later.


View all training documents associated with a My GPT.

Endpoint: GET /context/documents/{contextId}

Path Parameters:

ParameterTypeRequiredDescription
contextIdintegerYesID of the My GPT to list documents for

Example Request:

GET /context/documents/123 HTTP/1.1
Host: threo-api.synthreo.ai
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

Response Example:

[
{
"contextId": 0,
"id": 456,
"fileName": "ba8dc2ac-8dce-ab82-e4ee-f8a2123128cd2",
"originalName": "Filename.pdf",
"nameIndex": 0,
"contentType": "application/pdf",
"contentHash": "2b7c7ff34d566b2a86e834bcd713b434",
"size": 735588,
"chunks": 535,
"created": "0001-01-01T00:00:00",
"createdBy": 35,
"started": "2025-08-29T18:32:30.558",
"completed": "2025-08-29T18:33:40.658",
"displayName": "Filename.pdf"
}
]

Response Fields:

FieldTypeDescription
idintegerDocument ID used for deletion
fileNamestringInternal storage UUID
originalNamestringOriginal filename at upload time
contentTypestringMIME type of the document
sizeintegerFile size in bytes
chunksintegerNumber of text chunks the document was split into
startedstringTimestamp when processing began
completedstringTimestamp when processing finished
displayNamestringHuman-readable filename shown in the UI

Delete a training document and its associated embeddings.

Endpoint: DELETE /context/documents/{contextId}/{docId}

Path Parameters:

ParameterTypeRequiredDescription
contextIdintegerYesID of the My GPT
docIdintegerYesID of the document to delete (from the id field in list response)

Example Request:

DELETE /context/documents/123/456 HTTP/1.1
Host: threo-api.synthreo.ai
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

Response: 200 OK on success


Search through your My GPT’s training documents to find relevant content for a given query. This uses the same vector embedding model as the My GPT itself, so results reflect what the AI would retrieve when answering questions.

Endpoint: POST /context/relevant-docs/{contextId}

Path Parameters:

ParameterTypeRequiredDescription
contextIdintegerYesID of the My GPT to search

Request Body:

{
"prompt": "Search query here"
}

Example Request:

POST /context/relevant-docs/123 HTTP/1.1
Host: threo-api.synthreo.ai
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
{
"prompt": "What is the return policy?"
}

Response Example:

[
{
"id": 29579,
"docId": 456,
"content": " ... document chunk text here ... ",
"similarity": 0.16064027
}
]

Response Fields:

FieldTypeDescription
idintegerUnique chunk ID
docIdintegerID of the source document this chunk belongs to
contentstringThe text content of the matching chunk
similaritynumberCosine similarity score between the query and the chunk (0 to 1; higher is more relevant)

Custom tools in My GPTs allow integration with existing AI agents built on your Builder platform. Instead of defining new tools from scratch, you connect to pre-built agents that can perform specific actions.

Tool Structure for Agent Integration: The value for toolsJson must be a stringified JSON array. All double quotes must be escaped with backslashes. All backslashes must be doubled. The entire array must be a string.

There are online tools that can stringify JSON arrays. You can also do this with Python using json_string = json.dumps(json_obj).

Example JSON (Not Stringified):

[
{
"id": 1,
"name": "check_weather",
"description": "Finds the weather for a given location",
"action": "Run Agent",
"agentId": 456,
"parameters": [
{
"paramName": "location",
"type": "string",
"required": true,
"description": "Location to get the weather for"
}
]
}
]

Tool Parameter Fields:

FieldTypeRequiredDescription
idintegerYesUnique identifier for the tool within this My GPT
namestringYesFunction name used by the AI model (no spaces, use underscores)
descriptionstringYesExplains when and how the AI should use this tool
actionstringYesAlways "Run Agent" when integrating with Builder agents
agentIdintegerYesThe Builder cognitive diagram ID to execute
parametersarrayNoList of input parameters the tool accepts
parameters[].paramNamestringYesParameter name passed to the agent
parameters[].typestringYesData type: "string", "integer", "boolean"
parameters[].requiredbooleanYesWhether this parameter must be provided
parameters[].descriptionstringYesDescribes the parameter to the AI model

Stringified Version (what you send in the API):

"[{\"id\":1,\"name\":\"check_weather\",\"description\":\"Finds the weather for a given location\",\"action\":\"Run Agent\",\"agentId\":456,\"parameters\":[{\"paramName\":\"location\",\"type\":\"string\",\"required\":true,\"description\":\"Location to get the weather for\"}]}]"

Make your My GPT available to other users or keep it private.

Note: This endpoint is not yet fully implemented. The field values are accepted but sharing behavior may differ from what is described here.

Endpoint: PUT /context/share/{contextId}

Path Parameters:

ParameterTypeRequiredDescription
contextIdintegerYesID of the My GPT to share

Request Body:

{
"shareState": 1,
"icon": ""
}
FieldTypeDescription
shareStateinteger0 = private (not shared), 1 = shared
iconstringAn emoji character to use as the My GPT icon

Example Request:

PUT /context/share/123 HTTP/1.1
Host: threo-api.synthreo.ai
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
{
"shareState": 1,
"icon": ""
}

Response: 204 No Content on success


HTTP StatusMeaningCommon Cause
200 OKSuccessRequest processed normally
201 CreatedResource createdPOST request created a new resource
204 No ContentSuccess with no bodyUpdate or delete completed
400 Bad RequestInvalid inputMissing required fields or invalid JSON
401 UnauthorizedAuthentication failedMissing or expired JWT token
403 ForbiddenAccess deniedToken does not have permission to access this resource
404 Not FoundResource missingThe contextId or docId does not exist
413 Payload Too LargeFile too largeUploaded document exceeds the maxSize limit
500 Internal Server ErrorServer errorContact Synthreo support

  • Programmatic Control: Full API access to My GPT functionality
  • Scalable Operations: Batch processing and error handling for enterprise use
  • Custom Integration: Flexible tools and configuration options connecting to Builder agents
  • Semantic Search: Query the training knowledge directly to validate content or build custom retrieval logic

For additional support or advanced use cases, please refer to the API reference or contact the Synthreo support team.


Related pages: