Create a prompt folder
curl --request POST \
--url https://api.langdock.com/prompts/v1/folders \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"sharedWithWorkspace": true,
"sharedWithGroupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'import requests
url = "https://api.langdock.com/prompts/v1/folders"
payload = {
"name": "<string>",
"sharedWithWorkspace": True,
"sharedWithGroupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
sharedWithWorkspace: true,
sharedWithGroupId: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
})
};
fetch('https://api.langdock.com/prompts/v1/folders', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.langdock.com/prompts/v1/folders",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'sharedWithWorkspace' => true,
'sharedWithGroupId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.langdock.com/prompts/v1/folders"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"sharedWithWorkspace\": true,\n \"sharedWithGroupId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.langdock.com/prompts/v1/folders")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"sharedWithWorkspace\": true,\n \"sharedWithGroupId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.langdock.com/prompts/v1/folders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"sharedWithWorkspace\": true,\n \"sharedWithGroupId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}"
response = http.request(request)
puts response.read_body{
"folder": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"createdBy": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sharedWithWorkspace": true,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"sharedWithGroupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}Prompt Library API
Create Prompt Folder
Create a new prompt folder in your workspace
POST
/
prompts
/
v1
/
folders
Create a prompt folder
curl --request POST \
--url https://api.langdock.com/prompts/v1/folders \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"sharedWithWorkspace": true,
"sharedWithGroupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'import requests
url = "https://api.langdock.com/prompts/v1/folders"
payload = {
"name": "<string>",
"sharedWithWorkspace": True,
"sharedWithGroupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
sharedWithWorkspace: true,
sharedWithGroupId: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
})
};
fetch('https://api.langdock.com/prompts/v1/folders', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.langdock.com/prompts/v1/folders",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'sharedWithWorkspace' => true,
'sharedWithGroupId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.langdock.com/prompts/v1/folders"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"sharedWithWorkspace\": true,\n \"sharedWithGroupId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.langdock.com/prompts/v1/folders")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"sharedWithWorkspace\": true,\n \"sharedWithGroupId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.langdock.com/prompts/v1/folders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"sharedWithWorkspace\": true,\n \"sharedWithGroupId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}"
response = http.request(request)
puts response.read_body{
"folder": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"createdBy": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sharedWithWorkspace": true,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"sharedWithGroupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}Creates a prompt folder in your workspace. The API key creator becomes the folder owner and can manage it in the Prompt Library.
Base URL
https://api.langdock.com/prompts/v1/folders
Dedicated deploymentsReplace
api.langdock.com with <your-deployment-url>/api/public in all requests.Required Scopes
This endpoint requires thePROMPT_API scope.
Sharing the folder with the workspace requires workspace editor access or the
sharePrompts permission. Sharing with a group requires group editor or admin membership, or workspace admin access.Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Folder name. Minimum: 2 characters. Maximum: 50 characters. |
sharedWithWorkspace | boolean | No | Share the folder with the workspace. Cannot be true when sharedWithGroupId is set. |
sharedWithGroupId | string | No | UUID of the group to share with. Cannot be set when sharedWithWorkspace is true. |
Example
const axios = require("axios");
async function createPromptFolder() {
const response = await axios.post(
"https://api.langdock.com/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)
{
folder: {
id: string;
name: string;
createdBy: string;
sharedWithWorkspace: boolean;
sharedWithGroupId: string | null;
createdAt: string;
updatedAt: string;
};
}
Error Handling
| Status Code | Description |
|---|---|
| 400 | Invalid request body, or workspace sharing combined with group sharing |
| 401 | Invalid or missing API key |
| 403 | Missing PROMPT_API scope or share permission |
| 404 | Group not found |
| 429 | Rate limit exceeded |
| 500 | Internal server error |
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.
Authorizations
API key as Bearer token. Format "Bearer YOUR_API_KEY"
Body
application/json
Response
Prompt folder created successfully
Show child attributes
Show child attributes
Was this page helpful?
⌘I