Skip to content
ajan.io

Docs menu

On this page

Update Prompt Folder

Update an existing prompt folder

Updates an existing prompt folder in your workspace. Only include the fields you want to change.

Base URL

https://api.ajan.io/prompts/v1/folders/{folderId}

Required Scopes

This endpoint requires the PROMPT_API scope.

Parameters

Path Parameters

ParameterTypeRequiredDescription
folderIdstringYesUUID of the folder to update.

Request Body

ParameterTypeDescription
namestringFolder name. Minimum: 2 characters. Maximum: 50 characters.
sharedWithWorkspacebooleanShare the folder with the workspace. Cannot be true while the folder is shared with a group.
sharedWithGroupIdstring | nullGroup UUID to share with, or null to disconnect the group. Cannot be set while the folder is shared with the workspace.

Example

javascript
const axios = require("axios");

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

  console.log("Updated folder:", response.data.folder.updatedAt);
}

updatePromptFolder("7c9e6679-7425-40de-944b-e07fc1f90ae7");

Response Format

Success Response (200 OK)

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

Error Handling

Status CodeDescription
400Invalid request body, missing update fields, or workspace sharing combined with group sharing
401Invalid or missing API key
403Missing PROMPT_API scope or manage access
404Prompt folder or group not found
429Rate limit exceeded
500Internal server error

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/{folderId}:
    patch:
      tags:
        - Prompts
      summary: Update a prompt folder
      description: Updates an existing prompt folder in your workspace.
      operationId: updatePromptFolder
      parameters:
        - $ref: '#/components/parameters/PromptFolderId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdatePromptFolderRequest'
      responses:
        '200':
          description: Prompt folder updated 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 manage access
        '404':
          description: Prompt folder or group not found
        '429':
          description: Rate limit exceeded
        '500':
          description: Internal server error
components:
  parameters:
    PromptFolderId:
      name: folderId
      in: path
      required: true
      description: UUID of the prompt folder.
      schema:
        type: string
        format: uuid
  schemas:
    UpdatePromptFolderRequest:
      type: object
      minProperties: 1
      additionalProperties: false
      properties:
        name:
          type: string
          minLength: 2
          maxLength: 50
          description: Folder name.
        sharedWithWorkspace:
          type: boolean
          description: Share the folder with the workspace.
        sharedWithGroupId:
          type: string
          format: uuid
          nullable: true
          description: Group UUID to share with, or null to disconnect the group.
    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"