Agent Get API
Mevcut bir agent'ın ayrıntılarını alın
Workspace'inizdeki mevcut bir agent için geçerli ayarları ve ayrıntıları döndürür. Endpoint, agent'ın aktif (yayınlanmış) sürümünü döndürür. Agent hiç yayınlanmamışsa mevcut taslağı döndürür.
Başlamadan önce
- API key scope: Agent API kapsamına sahip bir API anahtarı ve almak istediğiniz agent'a erişim gerekir.
- Legacy Assistants API: Bu, yerel Vercel AI SDK uyumluluğuna sahip yeni Agents API'dir. Eski Assistants API kullanıyorsanız migration guide sayfasına bakın.
Base URL
https://api.ajan.io/agent/v1/getDedicated deployments Tüm isteklerde
api.ajan.com'u/api/publicile değiştirin.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
agentId | string | Yes | Alınacak agent'ın UUID'si |
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
API şu doğrulama kurallarını uygular:
- Agent access — API anahtarınızın agent'a erişimi olmalıdır
- Workspace match — Agent, API anahtarınızla aynı workspace'e ait olmalıdır
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;
}
}
}ajan, API anahtarınızı korumak ve uygulamalarınızın güvenliğini sağlamak için tarayıcı kaynaklı istekleri bilinçli olarak engeller. Daha fazla bilgi için API Key Best Practices kılavuzuna bakın.
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"