Agent API

pdf version of the Agent API documentation

Agent Public API Documentation

Note

  • Fields marked with ? are optional.

Error Response Format

All error responses are returned in the following format:

{
  "message": "Error message",
  "error": "error code",
  "statusCode": code
}

Example:

{
  "message": "Capri token not found",
  "error": "Unauthorized",
  "statusCode": 401
}

Endpoints

1. POST /v1/agent/create

Description: Create a new agent.

Request Body:

{
  "agentName": "string",
  "folder"?: "string",
  "website"?: "string",
  "prompts"?: {
    "name": "string",
    "promptContent": "string",
    "customFallbackPrompt"?: "string"
  }
}

Response:

{
  "agentName": "new Agent",
  "orgId": "6561047156b3825f13bwc878",
  "userId": "",
  "disabled": false,
  "aiProvider": {
    "companyId": "openai-hosted",
    "modelName": "gpt-4o",
    "accountName": "4O - Capri Hosted",
    "accountId": "capriHosted",
    "isAdvancedSettings": false,
    "advancedSettings": {
      "temperature": 0.3,
      "maxLength": 180,
      "frequencyPenalty": 0,
      "optimize": "accuracy"
    }
  },
  "failsafeAiProvider": {
    "failsafe": false,
    "companyId": "fireworks",
    "modelName": "llama-v3-70b",
    "accountName": "Capri Hosted",
    "accountId": "capriHosted"
  },
  "multipleInbound": false,
  "multipleInboundConfig": {
    "initialWait": 1,
    "maxWait": 10,
    "incrementBy": 30
  },
  "actions": [],
  "savedSessionIds": [],
  "humanTakeover": {
    "takeoverType": "None"
  },
  "contextLength": 1000,
  "textContentKnowledgeSource": null,
  "showNotifications": {
    "connectAgentToTrigger": true
  },
  "_id": "678578dc217db71ewe060b4d6",
  "processingJobs": [],
  "processedFiles": [],
  "triggers": [],
  "variables": [],
  "faqs": [],
  "__v": 0
}

2. POST /v1/agent/{agentId}/update-faq

Description: Add a new FAQ to an agent.

Params:

  • agentId // id of the agent to add the new FAQ.

Request Body:

{
  "faqs": [
    {
      "question": "string",
      "answer": "string"
    }
  ]
}

Response:

{
  "success": true,
  "faqs": [
    {
      "id": "string",
      "question": "string",
      "answer": "string"
    }
  ]
}

3. POST /v1/agent/edit/name

Description: Update an agent’s name.

Request Body:

{
  "agentId": "string",
  "agentName": "string"
}

Response:

{
  "message": "Agent name updated successfully"
}

4. POST /v1/agent/{agentId}/website/scrape

Description: Add websites as a knowledge source to an agent.

Params:

  • agentId // id of the agent to add the website.

Request Body:

{
  "urls": ["string"] // URLs of the websites to scrape.
}

Response:

{
  "success": true,
  "message": "Website processing started",
  "processingJobs": [
    {
      "jobId": "manual-processing-website",
      "accountId": "e33c37-a6a0-4748-8807-07cf194f4e82",
      "fileName": "https://capriai.us",
      "jobType": "website-scrape",
      "maxDepth": 0
    }
  ]
}

5. POST /v1/agent/{agentId}/file-upload

Description: Add a file as a knowledge source to an agent.

Params:

  • agentId // id of the agent to upload the new file.

Request Body:

{
  "files": file
}

Response:

{
  "message": "Files queued for processing",
  "processingJobs": [
    {
      "jobId": "37",
      "accountId": "9772-4e01-a403-8916dc6b1c5a",
      "fileName": "capriai.txt",
      "mimeType": "text/plain",
      "jobType": "file-upload"
    }
  ]
}

6. POST /v1/agent/add/prompt

Description: Add a prompt to an agent.

Request Body:

{
  "agentId": "string",
  "prompt": {
    "name": "string",
    "promptContent": "string",
    "customFallbackPrompt"?: "string"
  }
}

Response:

{
  "message": "New Prompt Pushed Successfully",
  "currentActive": "a17e6aa6-e54f77b-abf7-12080247fe4c",
  "prompt": {
    "promptId": "ff9a69f4-45eb-a119-aed31a75158d",
    "name": "main prompt",
    "promptContent": "You are a bot representing capri AI",
    "isFallbackPrompt": false,
    "customFallbackPrompt": "Say sorry and ask to contact customer support whenever you can't answer"
 

Last updated