Skip to content
ajan.io

Docs menu

On this page

Prompt Library API Overview

Programmatically create and manage prompts and prompt folders in your ajan workspace

The Prompt Library API lets you manage prompts and prompt folders programmatically. Use it to sync prompts from a repository, bulk-update templates, and keep folder sharing in step with your content workflow.

Base URL

https://api.ajan.io

API Key Scope

All Prompt Library API endpoints require an API key with the PROMPT_API scope.

Available Endpoints

MethodEndpointDescription
GET/prompts/v1List prompts
POST/prompts/v1Create a prompt
GET/prompts/v1/{promptId}Get a prompt
PATCH/prompts/v1/{promptId}Update a prompt
DELETE/prompts/v1/{promptId}Delete a prompt
GET/prompts/v1/foldersList prompt folders
POST/prompts/v1/foldersCreate a prompt folder
GET/prompts/v1/folders/{folderId}Get a prompt folder
PATCH/prompts/v1/folders/{folderId}Update a prompt folder
DELETE/prompts/v1/folders/{folderId}Delete a prompt folder

Prompt Object

Prompt endpoints return the same prompt object:

typescript
{
  id: string;
  title: string;
  prompt: string;
  createdBy: string | null;
  promptFolderId: string | null;
  sharedWithWorkspace: boolean;
  createdAt: string | null;
  updatedAt: string | null;
}

Folder Object

Folder endpoints return the same folder object:

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

Permissions

Requests use the user who created the API key for permissions and access:

ActionRequired access
List or get promptsAccess through ownership, workspace sharing, or a shared folder
Create promptsActive workspace membership
Update or delete promptsCreator, workspace editor, or group editor of the prompt's folder
Share a prompt with the workspacesharePrompts permission
List or get foldersAccess through ownership, workspace sharing, or group sharing
Create foldersActive workspace membership
Update foldersCreator, workspace editor, sharePrompts for workspace-shared folders, or group editor
Delete foldersCreator, workspace editor, or group editor

A prompt cannot be shared with the workspace and assigned to a folder at the same time. A folder cannot be shared with the workspace and a group at the same time. Deleting a folder also deletes the prompts in it.

Private folders stay creator-only. Workspace sharing of folders uses the sharePrompts permission or workspace editor access.

Rate Limits

The Prompt Library API follows standard API rate limits. If you exceed the limit, you'll receive a 429 response. Wait and retry with exponential backoff.