> ## Documentation Index
> Fetch the complete documentation index at: https://docs.langdock.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Prompt Library API Overview

> Programmatically create and manage prompts and prompt folders in your Langdock 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.langdock.com
```

<Warning>
  **Dedicated deployments**

  Replace `api.langdock.com` with `<your-deployment-url>/api/public` in all requests.
</Warning>

## API Key Scope

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

<Tip>
  Create an API key with `PROMPT_API` scope in your [workspace settings](https://app.langdock.com/settings/workspace/api-keys). The API acts as the user who created the key, including their Prompt Library access and sharing permissions.
</Tip>

## Available Endpoints

| Method   | Endpoint                         | Description                                                       |
| -------- | -------------------------------- | ----------------------------------------------------------------- |
| `GET`    | `/prompts/v1`                    | [List prompts](/en/developer/prompts-api/list-prompts)            |
| `POST`   | `/prompts/v1`                    | [Create a prompt](/en/developer/prompts-api/create-prompt)        |
| `GET`    | `/prompts/v1/{promptId}`         | [Get a prompt](/en/developer/prompts-api/get-prompt)              |
| `PATCH`  | `/prompts/v1/{promptId}`         | [Update a prompt](/en/developer/prompts-api/update-prompt)        |
| `DELETE` | `/prompts/v1/{promptId}`         | [Delete a prompt](/en/developer/prompts-api/delete-prompt)        |
| `GET`    | `/prompts/v1/folders`            | [List prompt folders](/en/developer/prompts-api/list-folders)     |
| `POST`   | `/prompts/v1/folders`            | [Create a prompt folder](/en/developer/prompts-api/create-folder) |
| `GET`    | `/prompts/v1/folders/{folderId}` | [Get a prompt folder](/en/developer/prompts-api/get-folder)       |
| `PATCH`  | `/prompts/v1/folders/{folderId}` | [Update a prompt folder](/en/developer/prompts-api/update-folder) |
| `DELETE` | `/prompts/v1/folders/{folderId}` | [Delete a prompt folder](/en/developer/prompts-api/delete-folder) |

## Prompt Object

Prompt endpoints return the same prompt object:

```typescript theme={null}
{
  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 theme={null}
{
  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:

| Action                            | Required access                                                                         |
| --------------------------------- | --------------------------------------------------------------------------------------- |
| List or get prompts               | Access through ownership, workspace sharing, or a shared folder                         |
| Create prompts                    | Active workspace membership                                                             |
| Update or delete prompts          | Creator, workspace editor, or group editor of the prompt's folder                       |
| Share a prompt with the workspace | `sharePrompts` permission                                                               |
| List or get folders               | Access through ownership, workspace sharing, or group sharing                           |
| Create folders                    | Active workspace membership                                                             |
| Update folders                    | Creator, workspace editor, `sharePrompts` for workspace-shared folders, or group editor |
| Delete folders                    | Creator, 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.

<Info>
  Langdock intentionally blocks browser-origin requests to protect your API key and ensure your applications remain secure. For more information, please see our guide on [API Key Best Practices](/en/admin/ai-adoption-and-rollout/best-practices/api-key-best-practices).
</Info>
