Agent Get API
Retrieve details of an existing agent
Retrieves the current settings and details available for an existing agent in your workspace. The endpoint returns the agent's active (published) version. If the agent has never been published, it returns the current draft instead.
Before You Start
- API key scope: Requires an API key with the Agent API scope and access to the agent you want to retrieve.
- Legacy Assistants API: This is the new Agents API with native Vercel AI SDK compatibility. If you're using the legacy Assistants API, see the migration guide.
Base URL
https://api.ajan.io/agent/v1/getParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
agentId | string | Yes | UUID of the agent to retrieve |
Examples
Basic Retrieval
javascript
const axios = require("axios");
async function getAgent() {
const response = await axios.get(
"https://api.ajan.io/agent/v1/get",
{
params: {
agentId: "550e8400-e29b-41d4-a716-446655440000"
},
headers: {
Authorization: "Bearer YOUR_API_KEY"
}
}
);
console.log("Agent details:", response.data.agent);
}Validation Rules
The API enforces the following validation rules:
- Agent access - Your API key must have access to the agent
- Workspace match - Agent must belong to the same workspace as your API key
Response Format
Success Response (200 OK)
typescript
{
status: "success";
agent: {
id: string;
name: string;
description: string | null;
instruction: string | null;
emojiIcon: string | null;
model: string | null;
temperature: number;
conversationStarters: string[];
inputType: "PROMPT" | "STRUCTURED" | "INTEGRATION" | "SCHEDULED" | "WEBHOOK";
webSearchEnabled: boolean;
imageGenerationEnabled: boolean;
canvasEnabled: boolean;
extendedThinking: boolean;
actions: Array<{
actionId: string;
requiresConfirmation: boolean;
}>;
inputFields: Array<{
type: "TEXT" | "MULTI_LINE_TEXT" | "NUMBER" | "CHECKBOX" | "FILE" | "SELECT" | "MULTI_SELECT" | "DATE" | "EMAIL";
label: string;
description: string | null;
required: boolean;
order: number;
}>;
attachments: string[];
knowledgeFolderIds: string[];
owner: {
id: string;
name: string | null;
email: string;
} | null;
createdAt: string;
updatedAt: string;
};
}Error Handling
typescript
try {
const response = await axios.get('https://api.ajan.io/agent/v1/get', ...);
} catch (error) {
if (error.response) {
switch (error.response.status) {
case 400:
console.error('Invalid agent ID format');
break;
case 401:
console.error('Invalid or missing API key');
break;
case 403:
console.error('Insufficient permissions - no access to this agent');
break;
case 404:
console.error('Agent not found');
break;
case 500:
console.error('Server error');
break;
}
}
}OpenAPI
openapi: 3.0.0
info:
title: ajan API
version: 3.0.0
servers:
- url: https://api.ajan.io
description: Production
security:
- bearerAuth: []
paths:
/agent/v1/get:
get:
tags:
- Agent Build
summary: Retrieves details of an existing agent
description: >-
Retrieves the current settings and details available for an existing
agent.
operationId: getAgentV2
parameters:
- name: agentId
in: query
required: true
schema:
type: string
format: uuid
responses:
'200':
description: Agent retrieved successfully
content:
application/json:
schema:
type: object
required:
- status
- agent
properties:
status:
type: string
agent:
$ref: '#/components/schemas/AssistantDetails'
components:
schemas:
AssistantDetails:
type: object
required:
- id
- name
- description
- instruction
- emojiIcon
- model
- temperature
- conversationStarters
- inputType
- webSearchEnabled
- imageGenerationEnabled
- canvasEnabled
- extendedThinking
- actions
- inputFields
- attachments
- knowledgeFolderIds
- createdAt
- updatedAt
properties:
id:
type: string
format: uuid
description: Unique identifier for the agent
name:
type: string
description: Name of the agent
description:
type: string
nullable: true
description: Description of what the agent does
instruction:
type: string
nullable: true
description: System prompt/instructions for the agent
emojiIcon:
type: string
nullable: true
description: Emoji icon for the agent
model:
type: string
nullable: true
description: Model ID to use (see Models for Agent API)
temperature:
type: number
minimum: 0
maximum: 1
description: Temperature/creativity setting for response generation
conversationStarters:
type: array
items:
type: string
description: Array of suggested prompts to help users get started
inputType:
type: string
enum:
- PROMPT
- STRUCTURED
- INTEGRATION
- SCHEDULED
- WEBHOOK
description: Input type for the agent
webSearchEnabled:
type: boolean
description: Whether web search capability is enabled
imageGenerationEnabled:
type: boolean
description: Whether image generation capability is enabled
canvasEnabled:
type: boolean
description: Whether canvas capability is enabled
extendedThinking:
type: boolean
description: >-
Whether extended thinking is enabled. Only supported on models that
expose this capability; enabling it on an unsupported model returns
a 400 error.
actions:
type: array
items:
type: object
required:
- actionId
- requiresConfirmation
properties:
actionId:
type: string
format: uuid
description: UUID of the action from an enabled integration
requiresConfirmation:
type: boolean
description: Whether user confirmation is required before executing
description: Array of action objects for custom integrations
inputFields:
type: array
items:
type: object
required:
- type
- label
- description
- required
- order
properties:
type:
type: string
enum:
- TEXT
- MULTI_LINE_TEXT
- NUMBER
- CHECKBOX
- FILE
- SELECT
- MULTI_SELECT
- DATE
- EMAIL
description: Field type
label:
type: string
description: Display label for the field
description:
type: string
nullable: true
description: Help text for the field
required:
type: boolean
description: Whether the field is required
order:
type: integer
minimum: 0
description: Display order (0-indexed)
description: Array of form field definitions (for STRUCTURED input type)
attachments:
type: array
items:
type: string
format: uuid
description: Array of attachment UUIDs associated with the agent
knowledgeFolderIds:
type: array
items:
type: string
format: uuid
description: Array of Folder UUIDs associated with the agent
createdAt:
type: string
format: date-time
description: Timestamp when the agent was created
updatedAt:
type: string
format: date-time
description: Timestamp when the agent was last updated
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: API Key
description: API key as Bearer token. Format "Bearer YOUR_API_KEY"