Produktbeschreibungen: Ablauf
Erstellen Sie Beschreibungen aus Produktname und Eigenschaften. Folgen Sie dem Ablauf von der Kostenschätzung bis zu HTML, Seitentitel, Meta-Beschreibung und H1.
Auf dieser Seite
- Unterstützte Sprachen
- POST /public-api/v1/ai-writer/product-descriptions/cost
- POST /public-api/v1/ai-writer/product-descriptions/documents
- GET /public-api/v1/ai-writer/product-descriptions/documents/{document_id}
Erstellen Sie Katalogbeschreibungen aus Produktnamen und Eigenschaften. Die API liefert HTML, Seitentitel, Meta-Beschreibung und H1. Die Erstellung läuft im Hintergrund: Kosten schätzen, Dokument erstellen und das Ergebnis über dessen Kennung abrufen.
Alle drei Felder sind im JSON-Body beider POST-Anfragen erforderlich. Senden Sie Content-Type: application/json. Maximal 16 KiB. Die Erstellung benötigt ai-product-descriptions:write, Schätzung und Lesen ai-product-descriptions:read.
| Parameter | Beschreibung |
|---|---|
title · string | Produktname und wichtige Eigenschaften: 1–256 Zeichen. Geben Sie Modell, Material, Größe oder Verwendungszweck zur Erkennung des Produkts an. |
language · string | Sprachcode aus der folgenden Tabelle. Dieses Feld bestimmt die Ausgabesprache. |
word_count · integer |
Parameterwerte und Zielumfang: 400 → 400–600 Wörter; 600 → 600–800 Wörter; 800 → 800–1200 Wörter. Die tatsächliche Wortzahl steht in actual_words.
|
Unterstützte Sprachen
Verwenden Sie de, um eine deutsche Beschreibung zu erstellen. Die zulässigen Sprachcodes stehen in ProductDescriptionRequest.
POST /public-api/v1/ai-writer/product-descriptions/cost
Schätzt die Kosten, ohne die Erstellung zu starten oder Credits auszugeben. Liefert cost, total_credits, remaining_credits und has_enough_credits. Prüfen Sie has_enough_credits vor der Erstellung; eine Schätzung reserviert kein Guthaben.
curl
curl --fail-with-body --silent --show-error --location \
--request POST \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"title": "Ceramic coffee mug, 350 ml, dishwasher safe",
"language": "en",
"word_count": 400
}' \
'https://app.labrika.com/public-api/v1/ai-writer/product-descriptions/cost'
JavaScript
async function main () {
const response = await fetch("https://app.labrika.com/public-api/v1/ai-writer/product-descriptions/cost", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Accept": "application/json",
"Content-Type": "application/json",
},
body: JSON.stringify({
"title": "Ceramic coffee mug, 350 ml, dishwasher safe",
"language": "en",
"word_count": 400
}),
signal: AbortSignal.timeout(30_000),
})
if (!response.ok) {
const responseText = await response.text()
throw new Error(`HTTP ${response.status}: ${responseText}`)
}
const responseText = await response.text()
const data = responseText && response.headers.get("content-type")?.includes("application/json") ? JSON.parse(responseText) : responseText
console.log(data)
}
main().catch(error => {
console.error(error)
process.exitCode = 1
})
Python
import json
import requests
url = "https://app.labrika.com/public-api/v1/ai-writer/product-descriptions/cost"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Accept": "application/json",
"Content-Type": "application/json",
}
payload = json.loads("{\n \"title\": \"Ceramic coffee mug, 350 ml, dishwasher safe\",\n \"language\": \"en\",\n \"word_count\": 400\n}")
response = requests.request(
"POST",
url,
headers=headers,
json=payload,
timeout=30,
)
response.raise_for_status()
print(json.dumps(response.json(), ensure_ascii=False, indent=2) if response.content and "application/json" in response.headers.get("Content-Type", "") else response.text)
PHP
<?php
$curl = curl_init('https://app.labrika.com/public-api/v1/ai-writer/product-descriptions/cost');
if ($curl === false) {
throw new RuntimeException('Unable to initialize cURL');
}
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Accept: application/json',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => '{
"title": "Ceramic coffee mug, 350 ml, dishwasher safe",
"language": "en",
"word_count": 400
}',
]);
$response = curl_exec($curl);
if ($response === false) {
$message = curl_error($curl);
curl_close($curl);
throw new RuntimeException('Network error: ' . $message);
}
$status = curl_getinfo($curl, CURLINFO_RESPONSE_CODE);
$contentType = curl_getinfo($curl, CURLINFO_CONTENT_TYPE) ?: '';
curl_close($curl);
if ($status < 200 || $status >= 300) {
throw new RuntimeException("HTTP $status: $response");
}
if ($response !== '' && str_contains($contentType, 'application/json')) {
print_r(json_decode($response, true, 512, JSON_THROW_ON_ERROR));
} else {
echo $response;
}
Go
package main
import (
"context"
"fmt"
"io"
"net/http"
"os"
"strings"
"time"
)
func main() {
ctx, cancel := context.WithTimeout(context.Background(), 30 * time.Second)
defer cancel()
request, err := http.NewRequestWithContext(ctx, http.MethodPost, "https://app.labrika.com/public-api/v1/ai-writer/product-descriptions/cost", strings.NewReader("{\n \"title\": \"Ceramic coffee mug, 350 ml, dishwasher safe\",\n \"language\": \"en\",\n \"word_count\": 400\n}"))
if err != nil {
panic(err)
}
request.Header.Set("Authorization", "Bearer YOUR_API_KEY")
request.Header.Set("Accept", "application/json")
request.Header.Set("Content-Type", "application/json")
client := &http.Client{Timeout: 30 * time.Second}
response, err := client.Do(request)
if err != nil {
panic(err)
}
defer response.Body.Close()
if response.StatusCode < http.StatusOK || response.StatusCode >= http.StatusMultipleChoices {
errorBody, readErr := io.ReadAll(response.Body)
if readErr != nil {
panic(readErr)
}
panic(fmt.Sprintf("HTTP %d: %s", response.StatusCode, errorBody))
}
if _, err := io.Copy(os.Stdout, response.Body); err != nil {
panic(err)
}
}
Google Apps Script
function callLabrikaPublicAPI() {
const response = UrlFetchApp.fetch("https://app.labrika.com/public-api/v1/ai-writer/product-descriptions/cost", {
method: "post",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Accept": "application/json",
"Content-Type": "application/json",
},
payload: "{\n \"title\": \"Ceramic coffee mug, 350 ml, dishwasher safe\",\n \"language\": \"en\",\n \"word_count\": 400\n}",
followRedirects: false,
muteHttpExceptions: true,
});
const status = response.getResponseCode();
if (status < 200 || status >= 300) {
throw new Error('HTTP ' + status + ': ' + response.getContentText());
}
Logger.log(response.getContentText());
}
POST /public-api/v1/ai-writer/product-descriptions/documents
Startet die Erstellung. Verwenden Sie einen eindeutigen Idempotency-Key pro neuem Dokument. HTTP 202 liefert document_id, status, cost und has_enough_credits. Speichern Sie document_id für den Ergebnisabruf.
curl
curl --fail-with-body --silent --show-error --location \
--request POST \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: product-123-description-v1' \
--data '{
"title": "Ceramic coffee mug, 350 ml, dishwasher safe",
"language": "en",
"word_count": 400
}' \
'https://app.labrika.com/public-api/v1/ai-writer/product-descriptions/documents'
JavaScript
async function main () {
const response = await fetch("https://app.labrika.com/public-api/v1/ai-writer/product-descriptions/documents", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Accept": "application/json",
"Content-Type": "application/json",
"Idempotency-Key": "product-123-description-v1",
},
body: JSON.stringify({
"title": "Ceramic coffee mug, 350 ml, dishwasher safe",
"language": "en",
"word_count": 400
}),
signal: AbortSignal.timeout(30_000),
})
if (!response.ok) {
const responseText = await response.text()
throw new Error(`HTTP ${response.status}: ${responseText}`)
}
const responseText = await response.text()
const data = responseText && response.headers.get("content-type")?.includes("application/json") ? JSON.parse(responseText) : responseText
console.log(data)
}
main().catch(error => {
console.error(error)
process.exitCode = 1
})
Python
import json
import requests
url = "https://app.labrika.com/public-api/v1/ai-writer/product-descriptions/documents"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Accept": "application/json",
"Content-Type": "application/json",
"Idempotency-Key": "product-123-description-v1",
}
payload = json.loads("{\n \"title\": \"Ceramic coffee mug, 350 ml, dishwasher safe\",\n \"language\": \"en\",\n \"word_count\": 400\n}")
response = requests.request(
"POST",
url,
headers=headers,
json=payload,
timeout=30,
)
response.raise_for_status()
print(json.dumps(response.json(), ensure_ascii=False, indent=2) if response.content and "application/json" in response.headers.get("Content-Type", "") else response.text)
PHP
<?php
$curl = curl_init('https://app.labrika.com/public-api/v1/ai-writer/product-descriptions/documents');
if ($curl === false) {
throw new RuntimeException('Unable to initialize cURL');
}
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Accept: application/json',
'Content-Type: application/json',
'Idempotency-Key: product-123-description-v1',
],
CURLOPT_POSTFIELDS => '{
"title": "Ceramic coffee mug, 350 ml, dishwasher safe",
"language": "en",
"word_count": 400
}',
]);
$response = curl_exec($curl);
if ($response === false) {
$message = curl_error($curl);
curl_close($curl);
throw new RuntimeException('Network error: ' . $message);
}
$status = curl_getinfo($curl, CURLINFO_RESPONSE_CODE);
$contentType = curl_getinfo($curl, CURLINFO_CONTENT_TYPE) ?: '';
curl_close($curl);
if ($status < 200 || $status >= 300) {
throw new RuntimeException("HTTP $status: $response");
}
if ($response !== '' && str_contains($contentType, 'application/json')) {
print_r(json_decode($response, true, 512, JSON_THROW_ON_ERROR));
} else {
echo $response;
}
Go
package main
import (
"context"
"fmt"
"io"
"net/http"
"os"
"strings"
"time"
)
func main() {
ctx, cancel := context.WithTimeout(context.Background(), 30 * time.Second)
defer cancel()
request, err := http.NewRequestWithContext(ctx, http.MethodPost, "https://app.labrika.com/public-api/v1/ai-writer/product-descriptions/documents", strings.NewReader("{\n \"title\": \"Ceramic coffee mug, 350 ml, dishwasher safe\",\n \"language\": \"en\",\n \"word_count\": 400\n}"))
if err != nil {
panic(err)
}
request.Header.Set("Authorization", "Bearer YOUR_API_KEY")
request.Header.Set("Accept", "application/json")
request.Header.Set("Content-Type", "application/json")
request.Header.Set("Idempotency-Key", "product-123-description-v1")
client := &http.Client{Timeout: 30 * time.Second}
response, err := client.Do(request)
if err != nil {
panic(err)
}
defer response.Body.Close()
if response.StatusCode < http.StatusOK || response.StatusCode >= http.StatusMultipleChoices {
errorBody, readErr := io.ReadAll(response.Body)
if readErr != nil {
panic(readErr)
}
panic(fmt.Sprintf("HTTP %d: %s", response.StatusCode, errorBody))
}
if _, err := io.Copy(os.Stdout, response.Body); err != nil {
panic(err)
}
}
Google Apps Script
function callLabrikaPublicAPI() {
const response = UrlFetchApp.fetch("https://app.labrika.com/public-api/v1/ai-writer/product-descriptions/documents", {
method: "post",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Accept": "application/json",
"Content-Type": "application/json",
"Idempotency-Key": "product-123-description-v1",
},
payload: "{\n \"title\": \"Ceramic coffee mug, 350 ml, dishwasher safe\",\n \"language\": \"en\",\n \"word_count\": 400\n}",
followRedirects: false,
muteHttpExceptions: true,
});
const status = response.getResponseCode();
if (status < 200 || status >= 300) {
throw new Error('HTTP ' + status + ': ' + response.getContentText());
}
Logger.log(response.getContentText());
}
GET /public-api/v1/ai-writer/product-descriptions/documents/{document_id}
Bei pending wiederholen Sie GET nach retry_after_seconds (normalerweise 10 Sekunden). Bei success: content (HTML), title, description, h1, actual_words und credits_spent. Bei error lesen Sie error_code; credits_spent ist 0.
curl
curl --fail-with-body --silent --show-error --location \ --header 'Authorization: Bearer YOUR_API_KEY' \ --header 'Accept: application/json' \ 'https://app.labrika.com/public-api/v1/ai-writer/product-descriptions/documents/DOCUMENT_ID'
JavaScript
async function main () {
const response = await fetch("https://app.labrika.com/public-api/v1/ai-writer/product-descriptions/documents/DOCUMENT_ID", {
method: "GET",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Accept": "application/json",
},
signal: AbortSignal.timeout(30_000),
})
if (!response.ok) {
const responseText = await response.text()
throw new Error(`HTTP ${response.status}: ${responseText}`)
}
const responseText = await response.text()
const data = responseText && response.headers.get("content-type")?.includes("application/json") ? JSON.parse(responseText) : responseText
console.log(data)
}
main().catch(error => {
console.error(error)
process.exitCode = 1
})
Python
import json
import requests
url = "https://app.labrika.com/public-api/v1/ai-writer/product-descriptions/documents/DOCUMENT_ID"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Accept": "application/json",
}
response = requests.request(
"GET",
url,
headers=headers,
timeout=30,
)
response.raise_for_status()
print(json.dumps(response.json(), ensure_ascii=False, indent=2) if response.content and "application/json" in response.headers.get("Content-Type", "") else response.text)
PHP
<?php
$curl = curl_init('https://app.labrika.com/public-api/v1/ai-writer/product-descriptions/documents/DOCUMENT_ID');
if ($curl === false) {
throw new RuntimeException('Unable to initialize cURL');
}
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Accept: application/json',
],
]);
$response = curl_exec($curl);
if ($response === false) {
$message = curl_error($curl);
curl_close($curl);
throw new RuntimeException('Network error: ' . $message);
}
$status = curl_getinfo($curl, CURLINFO_RESPONSE_CODE);
$contentType = curl_getinfo($curl, CURLINFO_CONTENT_TYPE) ?: '';
curl_close($curl);
if ($status < 200 || $status >= 300) {
throw new RuntimeException("HTTP $status: $response");
}
if ($response !== '' && str_contains($contentType, 'application/json')) {
print_r(json_decode($response, true, 512, JSON_THROW_ON_ERROR));
} else {
echo $response;
}
Go
package main
import (
"context"
"fmt"
"io"
"net/http"
"os"
"time"
)
func main() {
ctx, cancel := context.WithTimeout(context.Background(), 30 * time.Second)
defer cancel()
request, err := http.NewRequestWithContext(ctx, http.MethodGet, "https://app.labrika.com/public-api/v1/ai-writer/product-descriptions/documents/DOCUMENT_ID", nil)
if err != nil {
panic(err)
}
request.Header.Set("Authorization", "Bearer YOUR_API_KEY")
request.Header.Set("Accept", "application/json")
client := &http.Client{Timeout: 30 * time.Second}
response, err := client.Do(request)
if err != nil {
panic(err)
}
defer response.Body.Close()
if response.StatusCode < http.StatusOK || response.StatusCode >= http.StatusMultipleChoices {
errorBody, readErr := io.ReadAll(response.Body)
if readErr != nil {
panic(readErr)
}
panic(fmt.Sprintf("HTTP %d: %s", response.StatusCode, errorBody))
}
if _, err := io.Copy(os.Stdout, response.Body); err != nil {
panic(err)
}
}
Google Apps Script
function callLabrikaPublicAPI() {
const response = UrlFetchApp.fetch("https://app.labrika.com/public-api/v1/ai-writer/product-descriptions/documents/DOCUMENT_ID", {
method: "get",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Accept": "application/json",
},
followRedirects: false,
muteHttpExceptions: true,
});
const status = response.getResponseCode();
if (status < 200 || status >= 300) {
throw new Error('HTTP ' + status + ': ' + response.getContentText());
}
Logger.log(response.getContentText());
}
Geht die POST-Antwort verloren, wiederholen Sie mit demselben API-Schlüssel, Idempotency-Key und Body. Die gespeicherte Antwort wird 24 Stunden lang zurückgegeben. Ein anderer Body oder eine laufende Anfrage führt zu HTTP 409. Bei zu wenig Credits laden Sie Guthaben auf und verwenden einen neuen Schlüssel.
product_not_recognized: Produktnamen und Eigenschaften präzisieren. product_description_failed: Erstellung fehlgeschlagen. Bekannte Erkennungsfehler können sofort HTTP 422 liefern und werden für dasselbe Produkt 7 Tage gespeichert. Ein neuer Schlüssel umgeht diesen Cache nicht.
Beim Start werden KI-Credits reserviert. Nach Erfolg zeigt credits_spent den tatsächlichen Verbrauch; ungenutzte Credits werden zurückgegeben. Fehlgeschlagene Erstellung verbraucht keine Credits.
Prüfen Sie vor der Nutzung von KI-Ergebnissen Fakten, Firmen- oder Produktnamen, Sprache und Übereinstimmung mit den Eingaben. Lesen Sie erzeugtes HTML vor der Veröffentlichung. Technischer Erfolg ersetzt keine Inhaltsprüfung.
