Import a Skill
curl --request POST \
--url https://api.langdock.com/skills/v1/import \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file='@example-file' \
--form mode=create \
--form 'integrationIds=<string>'import requests
url = "https://api.langdock.com/skills/v1/import"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"mode": "create",
"integrationIds": "<string>"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
form.append('mode', 'create');
form.append('integrationIds', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.langdock.com/skills/v1/import', 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/skills/v1/import",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mode\"\r\n\r\ncreate\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"integrationIds\"\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$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/skills/v1/import"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mode\"\r\n\r\ncreate\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"integrationIds\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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/skills/v1/import")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mode\"\r\n\r\ncreate\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"integrationIds\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.langdock.com/skills/v1/import")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mode\"\r\n\r\ncreate\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"integrationIds\"\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"skill": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"instructions": "<string>",
"integrationIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
},
"files": [
{
"path": "<string>",
"sizeBytes": 123,
"extension": "<string>",
"hasScript": true
}
]
}{
"skill": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"instructions": "<string>",
"integrationIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
},
"files": [
{
"path": "<string>",
"sizeBytes": 123,
"extension": "<string>",
"hasScript": true
}
]
}Skills API
Skill importieren
Erstelle oder aktualisiere einen Skill aus einer SKILL.md-Datei oder einem Zip-Archiv
POST
/
skills
/
v1
/
import
Import a Skill
curl --request POST \
--url https://api.langdock.com/skills/v1/import \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file='@example-file' \
--form mode=create \
--form 'integrationIds=<string>'import requests
url = "https://api.langdock.com/skills/v1/import"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"mode": "create",
"integrationIds": "<string>"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
form.append('mode', 'create');
form.append('integrationIds', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.langdock.com/skills/v1/import', 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/skills/v1/import",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mode\"\r\n\r\ncreate\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"integrationIds\"\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$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/skills/v1/import"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mode\"\r\n\r\ncreate\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"integrationIds\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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/skills/v1/import")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mode\"\r\n\r\ncreate\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"integrationIds\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.langdock.com/skills/v1/import")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mode\"\r\n\r\ncreate\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"integrationIds\"\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"skill": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"instructions": "<string>",
"integrationIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
},
"files": [
{
"path": "<string>",
"sizeBytes": 123,
"extension": "<string>",
"hasScript": true
}
]
}{
"skill": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"instructions": "<string>",
"integrationIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
},
"files": [
{
"path": "<string>",
"sizeBytes": 123,
"extension": "<string>",
"hasScript": true
}
]
}Importiert einen Skill aus einer
Unterstützte Dateitypen umfassen Markdown, Text, Python, Shell, JavaScript, TypeScript, JSON, YAML, TOML, CSV, XML, HTML, CSS, SVG, PDF, Office-Dateien, Fonts und gängige Bildformate.
Wenn ein Upsert einen bestehenden Skill aktualisiert, ersetzen importierte Dateien die bisher gespeicherten Skill-Dateien.
SKILL.md-Datei oder einem Zip-Archiv. Nutze diesen Endpoint, um repository-verwaltete Skills in Langdock zu synchronisieren.
Basis-URL
https://api.langdock.com/skills/v1/import
Dedicated DeploymentsErsetze
api.langdock.com durch <your-deployment-url>/api/public in allen Anfragen.Erforderliche Scopes
Dieser Endpoint erfordert denSKILL_API Scope.
Das Erstellen eines neuen Skills erfordert die Workspace-Berechtigung
createSkills. Das Aktualisieren eines bestehenden Skills mit mode: "upsert" erfordert Editor-Zugriff auf den passenden Skill.Request-Format
Sende die Anfrage alsmultipart/form-data.
| Feld | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
file | file | Ja | SKILL.md, .zip oder .skill Dateiinhalt. |
fileType | string | Ja | Zu verwendender Datei-Parser: md oder zip. Nutze zip für .zip- und .skill-Archive. |
mode | string | Nein | Import-Modus: create oder upsert. Standard: create. |
integrationIds | string | Nein | JSON-kodiertes Array von Integration-UUIDs zum Anhängen, z. B. ["550e8400-e29b-41d4-a716-446655440000"]. |
SKILL.md-Format
Der importierte Skill muss YAML-Frontmatter gefolgt von Anweisungen enthalten:SKILL.md
---
name: Support Reply Style
slug: support-reply-style
description: Applies the support team's tone and escalation rules.
---
Write concise replies, include the next best action, and escalate billing issues to the account owner.
| Frontmatter-Feld | Erforderlich | Beschreibung |
|---|---|---|
name | Ja | Skill-Name. Maximum: 64 Zeichen. |
slug | Nein | Stabiler Skill-Slug. Wenn ausgelassen, generiert Langdock einen aus dem Namen. |
description | Nein | Beschreibung, wann der Skill angewendet werden soll. Maximum: 1024 Zeichen. |
license | Nein | Optionale Lizenz-Metadaten. |
Zip-Archiv-Regeln
Zip-Archive müssen eineSKILL.md-Datei im Root oder in einem Top-Level-Verzeichnis enthalten. Langdock speichert erlaubte unterstützende Dateien mit dem Skill und überspringt nicht unterstützte Dateitypen.
| Limit | Wert |
|---|---|
| Upload-Größe | 25 MB |
| Gesamtgröße unkomprimiert | 20 MB |
| Einzeldateigröße | 5 MB |
| Dateien pro Archiv | 200 |
Import-Modi
| Modus | Verhalten |
|---|---|
create | Erstellt einen neuen Skill aus dem Import. Die Anfrage schlägt fehl, wenn der Slug bereits existiert. |
upsert | Aktualisiert einen bearbeitbaren Skill mit demselben Slug oder erstellt einen neuen Skill, wenn keiner existiert. Die Anfrage schlägt fehl, wenn mehrere bearbeitbare Skills denselben Slug verwenden. |
Beispiel
const axios = require("axios");
const FormData = require("form-data");
const fs = require("fs");
async function importSkill() {
const form = new FormData();
form.append("file", fs.createReadStream("./support-reply-style.zip"));
form.append("fileType", "zip");
form.append("mode", "upsert");
form.append("integrationIds", JSON.stringify([]));
const response = await axios.post(
"https://api.langdock.com/skills/v1/import",
form,
{
headers: {
Authorization: "Bearer YOUR_API_KEY",
...form.getHeaders()
}
}
);
console.log("Imported Skill:", response.data.skill.id);
}
importSkill();
Antwortformat
Erfolgsantwort (200 OK oder 201 Created)
{
skill: {
id: string;
name: string;
slug: string;
description: string;
instructions: string;
integrationIds: string[];
createdAt: string;
updatedAt: string;
};
files: Array<{
path: string;
sizeBytes: number;
extension: string;
hasScript: boolean;
}>;
}
200 OK bedeutet, dass ein bestehender Skill per upsert aktualisiert wurde. 201 Created bedeutet, dass ein neuer Skill erstellt wurde.
Fehlerbehandlung
| Statuscode | Beschreibung |
|---|---|
| 400 | Ungültige Form-Daten, ungültige SKILL.md, ungültiges Zip-Archiv oder nicht zugängliche integrationIds |
| 401 | Ungültiger oder fehlender API Key |
| 403 | Fehlender SKILL_API Scope, kein Skills-Produktzugriff, keine Erstellberechtigung oder kein Editor-Zugriff |
| 409 | Bestehender Slug-Konflikt oder mehrdeutiger Upsert-Slug |
| 413 | Hochgeladene Datei ist zu groß |
| 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"
Body
multipart/form-data
SKILL.md, .zip, or .skill file content.
File parser to use.
Verfügbare Optionen:
md, zip Whether to create a Skill or update an editable Skill with the same slug.
Verfügbare Optionen:
create, upsert JSON-encoded array of integration UUIDs.
War diese Seite hilfreich?