İçeriğe geç
ajan.io

Belgeler menüsü

Bu sayfada

Prompt klasörü oluştur

Workspace'inizde yeni bir prompt klasörü oluşturun

Workspace'inizde bir prompt klasörü oluşturur. API anahtarını oluşturan kullanıcı klasör sahibi olur ve onu Prompt Library'de yönetebilir.

Base URL

https://api.ajan.io/prompts/v1/folders

Dedicated deployments Tüm isteklerde api.ajan.com'u /api/public ile değiştirin.

Required Scopes

Bu endpoint PROMPT_API kapsamını gerektirir.

Klasörü workspace ile paylaşmak için workspace editor erişimi veya sharePrompts izni gerekir. Bir grupla paylaşmak için grup editor veya admin üyeliği ya da workspace admin erişimi gerekir.

Parameters

ParameterTypeRequiredDescription
namestringYesKlasör adı. Minimum: 2 karakter. Maksimum: 50 karakter.
sharedWithWorkspacebooleanNoKlasörü workspace ile paylaş. sharedWithGroupId ayarlıyken true olamaz.
sharedWithGroupIdstringNoPaylaşılacak grubun UUID'si. sharedWithWorkspace true iken ayarlanamaz.

Example

javascript
const axios = require("axios");

async function createPromptFolder() {
  const response = await axios.post(
    "https://api.ajan.io/prompts/v1/folders",
    {
      name: "Support templates",
      sharedWithWorkspace: true
    },
    {
      headers: {
        Authorization: "Bearer YOUR_API_KEY",
        "Content-Type": "application/json"
      }
    }
  );

  console.log("Created folder:", response.data.folder.id);
}

createPromptFolder();

Response Format

Success Response (201 Created)

typescript
{
  folder: {
    id: string;
    name: string;
    createdBy: string;
    sharedWithWorkspace: boolean;
    sharedWithGroupId: string | null;
    createdAt: string;
    updatedAt: string;
  };
}

Error Handling

Status CodeDescription
400Geçersiz istek gövdesi veya workspace paylaşımı ile grup paylaşımının birlikte kullanılması
401Geçersiz veya eksik API anahtarı
403Eksik PROMPT_API kapsamı veya paylaşım izni
404Grup bulunamadı
429Rate limit aşıldı
500Dahili 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/folders:
    post:
      tags:
        - Prompts
      summary: Create a prompt folder
      description: Creates a prompt folder in your workspace.
      operationId: createPromptFolder
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePromptFolderRequest'
      responses:
        '201':
          description: Prompt folder created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PromptFolderResponse'
        '400':
          description: Invalid request body
        '401':
          description: Invalid or missing API key
        '403':
          description: Missing required scope or share permission
        '404':
          description: Group not found
        '429':
          description: Rate limit exceeded
        '500':
          description: Internal server error
components:
  schemas:
    CreatePromptFolderRequest:
      type: object
      required:
        - name
      additionalProperties: false
      properties:
        name:
          type: string
          minLength: 2
          maxLength: 50
          description: Folder name.
        sharedWithWorkspace:
          type: boolean
          description: >-
            Share the folder with the workspace. Cannot be true when
            sharedWithGroupId is set.
        sharedWithGroupId:
          type: string
          format: uuid
          description: >-
            Group UUID to share with. Cannot be set when sharedWithWorkspace is
            true.
    PromptFolderResponse:
      type: object
      required:
        - folder
      properties:
        folder:
          $ref: '#/components/schemas/PromptFolder'
    PromptFolder:
      type: object
      required:
        - id
        - name
        - createdBy
        - sharedWithWorkspace
        - createdAt
        - updatedAt
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier for the prompt folder.
        name:
          type: string
          minLength: 2
          maxLength: 50
          description: Folder name.
        createdBy:
          type: string
          format: uuid
          description: User ID of the folder creator.
        sharedWithWorkspace:
          type: boolean
          description: Whether the folder is shared with the workspace.
        sharedWithGroupId:
          type: string
          format: uuid
          nullable: true
          description: Group ID the folder is shared with.
        createdAt:
          type: string
          format: date-time
          description: ISO 8601 timestamp for folder creation.
        updatedAt:
          type: string
          format: date-time
          description: ISO 8601 timestamp for the latest folder update.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: API key as Bearer token. Format "Bearer YOUR_API_KEY"