Prompt güncelle
Mevcut bir prompt'u güncelleyin
Workspace'inizdeki mevcut bir prompt'u günceller. Yalnızca değiştirmek istediğiniz alanları ekleyin.
Base URL
https://api.ajan.io/prompts/v1/{promptId}Dedicated deployments Tüm isteklerde
api.ajan.com'u/api/publicile değiştirin.
Required Scopes
Bu endpoint PROMPT_API kapsamını gerektirir.
Prompt'un klasöründe oluşturan kullanıcı erişimi, workspace editor erişimi veya grup editor erişimi gerekir.
Parameters
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
promptId | string | Yes | Güncellenecek prompt'un UUID'si. |
Request Body
| Parameter | Type | Description |
|---|---|---|
title | string | Prompt başlığı. Minimum: 2 karakter. Maksimum: 100 karakter. |
prompt | string | Prompt içeriği. Minimum: 2 karakter. Maksimum: 120000 karakter. |
promptFolderId | string | null | Atanacak klasör UUID'si veya klasörü kaldırmak için null. Prompt workspace ile paylaşılırken ayarlanamaz. |
sharedWithWorkspace | boolean | Prompt'u workspace ile paylaş. sharePrompts gerektirir. Prompt bir klasördeyken true olamaz. |
Example
javascript
const axios = require("axios");
async function updatePrompt(promptId) {
const response = await axios.patch(
`https://api.ajan.io/prompts/v1/${promptId}`,
{
title: "Support Reply",
prompt: "Write a concise customer reply. Include the next best action and the ticket ID."
},
{
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
}
);
console.log("Updated prompt:", response.data.prompt.updatedAt);
}
updatePrompt("550e8400-e29b-41d4-a716-446655440000");Response Format
Success Response (200 OK)
typescript
{
prompt: {
id: string;
title: string;
prompt: string;
createdBy: string | null;
promptFolderId: string | null;
sharedWithWorkspace: boolean;
createdAt: string | null;
updatedAt: string | null;
};
}Error Handling
| Status Code | Description |
|---|---|
| 400 | Geçersiz istek gövdesi veya çakışan klasör / paylaşım ayarları |
| 401 | Geçersiz veya eksik API anahtarı |
| 403 | Eksik PROMPT_API kapsamı veya güncelleme izni |
| 404 | Prompt bulunamadı |
| 429 | Rate limit aşıldı |
| 500 | Dahili sunucu hatası |
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:
/prompts/v1/{promptId}:
patch:
tags:
- Prompts
summary: Update a prompt
description: Updates an existing prompt in your workspace.
operationId: updatePrompt
parameters:
- $ref: '#/components/parameters/PromptId'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdatePromptRequest'
responses:
'200':
description: Prompt updated successfully
content:
application/json:
schema:
$ref: '#/components/schemas/PromptResponse'
'400':
description: Invalid request body
'401':
description: Invalid or missing API key
'403':
description: Missing required scope, write access, or share permission
'404':
description: Prompt or prompt folder not found
'429':
description: Rate limit exceeded
'500':
description: Internal server error
components:
parameters:
PromptId:
name: promptId
in: path
required: true
description: UUID of the prompt.
schema:
type: string
format: uuid
schemas:
UpdatePromptRequest:
type: object
minProperties: 1
additionalProperties: false
properties:
title:
type: string
minLength: 2
maxLength: 100
description: Prompt title.
prompt:
type: string
minLength: 2
maxLength: 120000
description: Prompt content.
promptFolderId:
type: string
format: uuid
nullable: true
description: Folder UUID to assign, or null to remove the folder.
sharedWithWorkspace:
type: boolean
description: Share the prompt with the workspace.
PromptResponse:
type: object
required:
- prompt
properties:
prompt:
$ref: '#/components/schemas/Prompt'
Prompt:
type: object
required:
- id
- title
- prompt
- sharedWithWorkspace
properties:
id:
type: string
format: uuid
description: Unique identifier for the prompt.
title:
type: string
minLength: 2
maxLength: 100
description: Prompt title.
prompt:
type: string
minLength: 2
maxLength: 120000
description: Prompt content.
createdBy:
type: string
format: uuid
nullable: true
description: User ID of the prompt creator.
promptFolderId:
type: string
format: uuid
nullable: true
description: Folder ID the prompt is assigned to.
sharedWithWorkspace:
type: boolean
description: Whether the prompt is shared with the workspace.
createdAt:
type: string
format: date-time
nullable: true
description: ISO 8601 timestamp for prompt creation.
updatedAt:
type: string
format: date-time
nullable: true
description: ISO 8601 timestamp for the latest prompt update.
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: API Key
description: API key as Bearer token. Format "Bearer YOUR_API_KEY"