Hogar / Probar descripciones de productos

Probar descripciones de productos

Pruebe la generación con una clave TEST en el entorno de pruebas. Los ejemplos usan la API de test y muestran cómo obtener un resultado simulado.

En esta página

Esta guía corresponde al entorno de prueba. Use una clave TEST y /public-api-test/v1 en todos los pasos. Los ejemplos simulan resultados; no generan contenido real ni cargan costes a la cuenta de producción.

Genere descripciones para su catálogo a partir del nombre y las características del producto. La API devuelve HTML, título de página, metadescripción y H1. La generación es asíncrona: calcule el coste, cree un documento y consulte el resultado por su identificador.

Los tres campos son obligatorios en el cuerpo JSON de ambas solicitudes POST. Envíe Content-Type: application/json. El límite es de 16 KiB. Para crear se requiere ai-product-descriptions:write; para calcular y consultar el resultado, ai-product-descriptions:read.

Parámetro Descripción
title · string Nombre y características principales: entre 1 y 256 caracteres. Incluya modelo, material, tamaño o uso para identificar el producto.
language · string Código del idioma de la tabla siguiente. Determina el idioma del resultado.
word_count · integer Valores del parámetro y extensión objetivo: 400 → 400–600 palabras; 600 → 600–800 palabras; 800 → 800–1200 palabras. El número real de palabras se devuelve en actual_words.

Idiomas admitidos

Use es para generar una descripción en español. Los códigos de idioma admitidos figuran en ProductDescriptionRequest.

POST /public-api-test/v1/ai-writer/product-descriptions/cost

Calcula el coste sin iniciar la generación ni gastar créditos. Devuelve cost, total_credits, remaining_credits y has_enough_credits. Compruebe has_enough_credits antes de crear el documento; el cálculo no reserva saldo.

curl

curl --fail-with-body --silent --show-error --location \
  --request POST \
  --header 'Authorization: Bearer YOUR_TEST_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-test/v1/ai-writer/product-descriptions/cost'

JavaScript

async function main () {
  const response = await fetch("https://app.labrika.com/public-api-test/v1/ai-writer/product-descriptions/cost", {
    method: "POST",
    headers: {
      "Authorization": "Bearer YOUR_TEST_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-test/v1/ai-writer/product-descriptions/cost"
headers = {
    "Authorization": "Bearer YOUR_TEST_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-test/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_TEST_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-test/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_TEST_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-test/v1/ai-writer/product-descriptions/cost", {
    method: "post",
    headers: {
      "Authorization": "Bearer YOUR_TEST_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-test/v1/ai-writer/product-descriptions/documents

Inicia la generación. Envíe un Idempotency-Key único por documento nuevo. HTTP 202 devuelve document_id, status, cost y has_enough_credits. Guarde document_id para consultar el resultado.

curl

curl --fail-with-body --silent --show-error --location \
  --request POST \
  --header 'Authorization: Bearer YOUR_TEST_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-test/v1/ai-writer/product-descriptions/documents'

JavaScript

async function main () {
  const response = await fetch("https://app.labrika.com/public-api-test/v1/ai-writer/product-descriptions/documents", {
    method: "POST",
    headers: {
      "Authorization": "Bearer YOUR_TEST_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-test/v1/ai-writer/product-descriptions/documents"
headers = {
    "Authorization": "Bearer YOUR_TEST_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-test/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_TEST_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-test/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_TEST_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-test/v1/ai-writer/product-descriptions/documents", {
    method: "post",
    headers: {
      "Authorization": "Bearer YOUR_TEST_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-test/v1/ai-writer/product-descriptions/documents/{document_id}

Con pending, repita GET tras retry_after_seconds (normalmente 10 segundos). Con success se devuelven content (HTML), title, description, h1, actual_words y credits_spent. Con error, consulte error_code; credits_spent es 0.

curl

curl --fail-with-body --silent --show-error --location \
  --header 'Authorization: Bearer YOUR_TEST_API_KEY' \
  --header 'Accept: application/json' \
  'https://app.labrika.com/public-api-test/v1/ai-writer/product-descriptions/documents/DOCUMENT_ID'

JavaScript

async function main () {
  const response = await fetch("https://app.labrika.com/public-api-test/v1/ai-writer/product-descriptions/documents/DOCUMENT_ID", {
    method: "GET",
    headers: {
      "Authorization": "Bearer YOUR_TEST_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-test/v1/ai-writer/product-descriptions/documents/DOCUMENT_ID"
headers = {
    "Authorization": "Bearer YOUR_TEST_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-test/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_TEST_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-test/v1/ai-writer/product-descriptions/documents/DOCUMENT_ID", nil)
	if err != nil {
		panic(err)
	}

	request.Header.Set("Authorization", "Bearer YOUR_TEST_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-test/v1/ai-writer/product-descriptions/documents/DOCUMENT_ID", {
    method: "get",
    headers: {
      "Authorization": "Bearer YOUR_TEST_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());
}

Si pierde la respuesta POST, repita con la misma clave API, Idempotency-Key y cuerpo. Durante 24 horas se devuelve la respuesta guardada. Un cuerpo distinto o una solicitud sin terminar produce HTTP 409. Si faltan créditos, recargue y use una clave nueva.

product_not_recognized: precise el nombre y las características. product_description_failed: no se pudo generar la descripción. Un fallo de reconocimiento conocido puede devolver HTTP 422 inmediatamente; se conserva durante 7 días para el mismo producto. Una clave nueva no evita esta caché.

Al iniciar se reservan créditos de IA. Tras el éxito, credits_spent indica el consumo real y se devuelve la reserva no utilizada. Los fallos no consumen créditos.

En modo de prueba, use estos valores de title para reproducir errores. Use un Idempotency-Key nuevo para cada escenario.

title Resultado
sandbox:product_not_recognized HTTP 422 inmediato
sandbox:async_product_not_recognized pending y después error product_not_recognized
sandbox:product_description_failed pending y después error product_description_failed

curl

curl --fail-with-body --silent --show-error --location \
  --request POST \
  --header 'Authorization: Bearer YOUR_TEST_API_KEY' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --header 'Idempotency-Key: sandbox-product-not-recognized-v1' \
  --data '{
  "title": "sandbox:product_not_recognized",
  "language": "en",
  "word_count": 400
}' \
  'https://app.labrika.com/public-api-test/v1/ai-writer/product-descriptions/documents'

JavaScript

async function main () {
  const response = await fetch("https://app.labrika.com/public-api-test/v1/ai-writer/product-descriptions/documents", {
    method: "POST",
    headers: {
      "Authorization": "Bearer YOUR_TEST_API_KEY",
      "Accept": "application/json",
      "Content-Type": "application/json",
      "Idempotency-Key": "sandbox-product-not-recognized-v1",
    },
    body: JSON.stringify({
      "title": "sandbox:product_not_recognized",
      "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-test/v1/ai-writer/product-descriptions/documents"
headers = {
    "Authorization": "Bearer YOUR_TEST_API_KEY",
    "Accept": "application/json",
    "Content-Type": "application/json",
    "Idempotency-Key": "sandbox-product-not-recognized-v1",
}
payload = json.loads("{\n  \"title\": \"sandbox:product_not_recognized\",\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-test/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_TEST_API_KEY',
        'Accept: application/json',
        'Content-Type: application/json',
        'Idempotency-Key: sandbox-product-not-recognized-v1',
    ],
    CURLOPT_POSTFIELDS => '{
  "title": "sandbox:product_not_recognized",
  "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-test/v1/ai-writer/product-descriptions/documents", strings.NewReader("{\n  \"title\": \"sandbox:product_not_recognized\",\n  \"language\": \"en\",\n  \"word_count\": 400\n}"))
	if err != nil {
		panic(err)
	}

	request.Header.Set("Authorization", "Bearer YOUR_TEST_API_KEY")
	request.Header.Set("Accept", "application/json")
	request.Header.Set("Content-Type", "application/json")
	request.Header.Set("Idempotency-Key", "sandbox-product-not-recognized-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-test/v1/ai-writer/product-descriptions/documents", {
    method: "post",
    headers: {
      "Authorization": "Bearer YOUR_TEST_API_KEY",
      "Accept": "application/json",
      "Content-Type": "application/json",
      "Idempotency-Key": "sandbox-product-not-recognized-v1",
    },
    payload: "{\n  \"title\": \"sandbox:product_not_recognized\",\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());
}

Antes de usar un resultado de IA, compruebe hechos, nombre de empresa o producto, idioma y coherencia con la entrada. Revise el HTML generado antes de publicarlo. El éxito técnico no sustituye la revisión del contenido.