AI Assistants

Base Path: /v1/assistants

Endpoints

Get All AI Assistants

Method: GET Endpoint: https://api.tokensource.com/v1/assistants Description: Retrieves all AI assistants associated with the authenticated user.

Response (200 OK):

{
  "status": 200,
  "data": [
    {
      "id": 1,
      "externalId": "uuid-1",
      "name": "Assistant Alpha",
      "instruction": "Provide helpful answers.",
      "objective": {},
      "ecosystem": "openai",
      "model": "gpt-4",
      "agentEnabled": true,
      "createdAt": "2023-10-27T09:00:00Z",
      "updatedAt": "2023-10-27T12:00:00Z"
    }
  ],
  "message": "Assistants retrieved successfully"
}

Get AI Assistant by External ID

Method: GET Endpoint: https://api.tokensource.com/v1/assistants/{externalId} Description: Retrieves a specific AI assistant by its external ID.

Parameters:

  • externalId (string, required)

Response (200 OK):

{
  "status": 200,
  "data": {
    "id": 2,
    "externalId": "uuid-2",
    "name": "Assistant Beta",
    "instruction": "Summarize documents."
  },
  "message": "Assistant retrieved successfully"
}

Response (404 Not Found):

{
  "status": 404,
  "data": null,
  "message": "Assistant not found"
}

Create AI Assistant

Method: POST Endpoint: https://api.tokensource.com/v1/assistants Description: Creates a new AI assistant.

Request Body:

{
  "name": "Assistant Gamma",
  "instruction": "Generate creative content.",
  "objectiveId": 1,
  "ecosystem": "anthropic",
  "model": "claude-2",
  "agentEnabled": false
}

Response (201 Created):

{
  "status": 201,
  "data": {},
  "message": "Assistant created successfully"
}

Update AI Assistant

Method: PUT Endpoint: https://api.tokensource.com/v1/assistants/{externalId} Description: Updates an existing AI assistant and handles agent creation/deletion based on agentEnabled.

Parameters:

  • externalId (string, required)

Request Body:

{
  "name": "Assistant Beta",
  "instruction": "Provide enhanced summarization.",
  "objectiveId": 2,
  "ecosystem": "openai",
  "model": "gpt-4",
  "agentEnabled": true
}

Response (200 OK):

{
  "status": 200,
  "data": {},
  "message": "Assistant updated successfully"
}

Response (404 Not Found):

{
  "status": 404,
  "data": null,
  "message": "Assistant not found"
}

Last updated