Update a prompt
curl --request PATCH \
--url https://api.langdock.com/prompts/v1/{promptId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"title": "<string>",
"prompt": "<string>",
"promptFolderId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sharedWithWorkspace": true
}
'import requests
url = "https://api.langdock.com/prompts/v1/{promptId}"
payload = {
"title": "<string>",
"prompt": "<string>",
"promptFolderId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sharedWithWorkspace": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
title: '<string>',
prompt: '<string>',
promptFolderId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
sharedWithWorkspace: true
})
};
fetch('https://api.langdock.com/prompts/v1/{promptId}', 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/{promptId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'title' => '<string>',
'prompt' => '<string>',
'promptFolderId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'sharedWithWorkspace' => true
]),
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/{promptId}"
payload := strings.NewReader("{\n \"title\": \"<string>\",\n \"prompt\": \"<string>\",\n \"promptFolderId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"sharedWithWorkspace\": true\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.langdock.com/prompts/v1/{promptId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"<string>\",\n \"prompt\": \"<string>\",\n \"promptFolderId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"sharedWithWorkspace\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.langdock.com/prompts/v1/{promptId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"<string>\",\n \"prompt\": \"<string>\",\n \"promptFolderId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"sharedWithWorkspace\": true\n}"
response = http.request(request)
puts response.read_body{
"prompt": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"title": "<string>",
"prompt": "<string>",
"sharedWithWorkspace": true,
"createdBy": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"promptFolderId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}Prompt Library API
Prompt aktualisieren
Aktualisiere einen bestehenden Prompt
PATCH
/
prompts
/
v1
/
{promptId}
Update a prompt
curl --request PATCH \
--url https://api.langdock.com/prompts/v1/{promptId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"title": "<string>",
"prompt": "<string>",
"promptFolderId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sharedWithWorkspace": true
}
'import requests
url = "https://api.langdock.com/prompts/v1/{promptId}"
payload = {
"title": "<string>",
"prompt": "<string>",
"promptFolderId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sharedWithWorkspace": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
title: '<string>',
prompt: '<string>',
promptFolderId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
sharedWithWorkspace: true
})
};
fetch('https://api.langdock.com/prompts/v1/{promptId}', 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/{promptId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'title' => '<string>',
'prompt' => '<string>',
'promptFolderId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'sharedWithWorkspace' => true
]),
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/{promptId}"
payload := strings.NewReader("{\n \"title\": \"<string>\",\n \"prompt\": \"<string>\",\n \"promptFolderId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"sharedWithWorkspace\": true\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.langdock.com/prompts/v1/{promptId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"<string>\",\n \"prompt\": \"<string>\",\n \"promptFolderId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"sharedWithWorkspace\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.langdock.com/prompts/v1/{promptId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"<string>\",\n \"prompt\": \"<string>\",\n \"promptFolderId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"sharedWithWorkspace\": true\n}"
response = http.request(request)
puts response.read_body{
"prompt": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"title": "<string>",
"prompt": "<string>",
"sharedWithWorkspace": true,
"createdBy": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"promptFolderId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}Aktualisiert einen bestehenden Prompt in deinem Workspace. Gib nur die Felder an, die du ändern möchtest.
Basis-URL
https://api.langdock.com/prompts/v1/{promptId}
Dedicated DeploymentsErsetze
api.langdock.com durch <your-deployment-url>/api/public in allen Anfragen.Erforderliche Scopes
Dieser Endpoint erfordert denPROMPT_API Scope.
Erfordert Zugriff als Ersteller, Workspace-Editor oder Gruppen-Editor des Prompt-Ordners.
Parameter
Pfad-Parameter
| Parameter | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
promptId | string | Ja | UUID des zu aktualisierenden Prompts. |
Request Body
| Parameter | Typ | Beschreibung |
|---|---|---|
title | string | Prompt-Titel. Minimum: 2 Zeichen. Maximum: 100 Zeichen. |
prompt | string | Prompt-Inhalt. Minimum: 2 Zeichen. Maximum: 120000 Zeichen. |
promptFolderId | string | null | Ordner-UUID zum Zuweisen oder null, um den Ordner zu entfernen. Darf nicht gesetzt sein, solange der Prompt mit dem Workspace geteilt ist. |
sharedWithWorkspace | boolean | Teilt den Prompt mit dem Workspace. Erfordert sharePrompts. Darf nicht true sein, solange der Prompt in einem Ordner liegt. |
Beispiel
const axios = require("axios");
async function updatePrompt(promptId) {
const response = await axios.patch(
`https://api.langdock.com/prompts/v1/${promptId}`,
{
title: "Support Reply",
prompt: "Write a concise customer reply. Include the next best action and the ticket ID."
},
{
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
}
);
console.log("Updated prompt:", response.data.prompt.updatedAt);
}
updatePrompt("550e8400-e29b-41d4-a716-446655440000");
Antwortformat
Erfolgsantwort (200 OK)
{
prompt: {
id: string;
title: string;
prompt: string;
createdBy: string | null;
promptFolderId: string | null;
sharedWithWorkspace: boolean;
createdAt: string | null;
updatedAt: string | null;
};
}
Fehlerbehandlung
| Statuscode | Beschreibung |
|---|---|
| 400 | Ungültiger Request Body, fehlende Update-Felder oder Workspace-Freigabe kombiniert mit einer Ordnerzuweisung |
| 401 | Ungültiger oder fehlender API Key |
| 403 | Fehlender PROMPT_API Scope, kein Schreibzugriff oder keine Freigabe-Berechtigung |
| 404 | Prompt oder Prompt-Ordner nicht gefunden |
| 429 | Rate Limit überschritten |
| 500 | Interner Serverfehler |
Langdock blockiert bewusst Browser-basierte Anfragen, um deinen API-Schlüssel zu schützen und die Sicherheit deiner Anwendungen zu gewährleisten. Weitere Informationen findest du in unserem Guide zu Best Practices für API-Schlüssel.
Autorisierungen
API key as Bearer token. Format "Bearer YOUR_API_KEY"
Pfadparameter
UUID of the prompt.
Body
application/json
Antwort
Prompt updated successfully
Show child attributes
Show child attributes
War diese Seite hilfreich?
⌘I