API से AI लेखक और उत्पाद विवरण
API से AI लेखक और उत्पाद विवरण. HTTP अनुरोध, पैरामीटर, उत्तर के स्कीमा और Labrika में काम का क्रम।
इस पृष्ठ पर
- AI Writer
- API विधि संदर्भ — AIWriter
- उत्पाद विवरण
- API सैंडबॉक्स: इंटीग्रेशन का परीक्षण — उत्पाद विवरण
- API विधि संदर्भ — ProductDescriptions
AI Writer
API से AI Writer का बैलेंस देखा जा सकता है, अनुकूलन की लागत निकाली जा सकती है, अनुकूलन शुरू किया जा सकता है और पूरा दस्तावेज़ प्राप्त किया जा सकता है। इन कार्रवाइयों के लिए अलग अनुमतियाँ हैं: ai-writer:read, ai-optimization:read और ai-optimization:write।
document_id सहेजें और दस्तावेज़ की status स्थिति success या error होने तक उसे प्राप्त करने के लिए अनुरोध करें। स्थिति pending होने पर retry_after_seconds का उपयोग करें।/public-api/v1/ai-writer/balance वर्तमान क्रेडिट बैलेंस लौटाता है। ai-writer:read अनुमति आवश्यक है।
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/balance'
JavaScript
async function main () {
const response = await fetch("https://app.labrika.com/public-api/v1/ai-writer/balance", {
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/balance"
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/balance');
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/balance", 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/balance", {
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());
}
{
"total_credits": 10000
} | फ़ील्ड | प्रकार | विवरण |
|---|---|---|
total_credits | integer | वर्तमान AI Writer बैलेंस। |
/public-api/v1/ai-writer/optimization/cost अनुकूलन शुरू किए बिना लागत की गणना करता है। ai-optimization:read अनुमति आवश्यक है। JSON बॉडी 3 MiB से अधिक नहीं होनी चाहिए।
adjust_text_length=false होने पर भेजे गए पाठ के आधार पर कीमत तुरंत तय होती है। true होने पर पहला अनुरोध estimate_id, expires_at और retry_after_seconds के साथ 202 देता है: सुझाव बिना क्रेडिट काटे तैयार होते हैं। 200 मिलने तक वही लागत अनुरोध दोहराएँ। फिर मिले हुए estimate_id को जोड़कर वही बॉडी /documents पर भेजें: सुझाई गई लंबाई के आधार पर दिखाई गई कीमत काटी जाएगी। गणना तैयारी शुरू होने से एक घंटे और एक बार शुरू करने के लिए मान्य है; बदले हुए डेटा या दोबारा उपयोग पर 409 मिलता है।
| फ़ील्ड | प्रकार | विवरण और सीमाएँ |
|---|---|---|
keywords | string[] | खोज परिणामों के विश्लेषण और पाठ के अनुकूलन के लिए कीवर्ड। आवश्यक; 1 से 10 कीवर्ड। |
search_engine | string | वह खोज इंजन जिसके परिणाम विश्लेषण के लिए उपयोग होते हैं: google। |
region_code | string | प्रतिस्पर्धी विश्लेषण के लिए खोज क्षेत्र। उपयुक्त संख्यात्मक ID दें: Google के लिए भौगोलिक लक्ष्यीकरण संदर्भ से क्षेत्र कोड। |
language | string | अनुकूलित किए जा रहे टेक्स्ट की भाषा। उदाहरण के लिए, हिंदी के लिए hi दें। स्वीकार्य कोड SiteLanguage में दिए गए हैं। |
title | string | वैकल्पिक। अनुकूलित किए जाने वाले HTML title टैग की सामग्री। अधिकतम 256 वर्ण। |
description | string | वैकल्पिक। अनुकूलित किए जाने वाले description मेटा टैग की सामग्री। अधिकतम 500 वर्ण। |
h1 | string | वैकल्पिक। अनुकूलित किए जाने वाले h1 शीर्षक का पाठ। अधिकतम 256 वर्ण। |
content | string | विश्लेषण और अनुकूलन के लिए पृष्ठ की HTML सामग्री। अधिकतम 512,000 Unicode वर्ण। |
adjust_text_length | boolean | निर्धारित करता है कि पाठ की लंबाई को अनुशंसित शब्द-संख्या सीमा में समायोजित करना है या नहीं। डिफ़ॉल्ट मान true है। |
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 '{
"keywords": [
"seo audit"
],
"search_engine": "google",
"region_code": "2840",
"language": "en",
"title": "SEO Audit",
"description": "SEO audit service",
"h1": "SEO Audit",
"content": "<p>Run a complete SEO audit of your website.</p>",
"adjust_text_length": true
}' \
'https://app.labrika.com/public-api/v1/ai-writer/optimization/cost'
JavaScript
async function main () {
const response = await fetch("https://app.labrika.com/public-api/v1/ai-writer/optimization/cost", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Accept": "application/json",
"Content-Type": "application/json",
},
body: JSON.stringify({
"keywords": [
"seo audit"
],
"search_engine": "google",
"region_code": "2840",
"language": "en",
"title": "SEO Audit",
"description": "SEO audit service",
"h1": "SEO Audit",
"content": "<p>Run a complete SEO audit of your website.</p>",
"adjust_text_length": true
}),
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/optimization/cost"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Accept": "application/json",
"Content-Type": "application/json",
}
payload = json.loads("{\n \"keywords\": [\n \"seo audit\"\n ],\n \"search_engine\": \"google\",\n \"region_code\": \"2840\",\n \"language\": \"en\",\n \"title\": \"SEO Audit\",\n \"description\": \"SEO audit service\",\n \"h1\": \"SEO Audit\",\n \"content\": \"<p>Run a complete SEO audit of your website.</p>\",\n \"adjust_text_length\": true\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/optimization/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 => '{
"keywords": [
"seo audit"
],
"search_engine": "google",
"region_code": "2840",
"language": "en",
"title": "SEO Audit",
"description": "SEO audit service",
"h1": "SEO Audit",
"content": "<p>Run a complete SEO audit of your website.</p>",
"adjust_text_length": true
}',
]);
$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/optimization/cost", strings.NewReader("{\n \"keywords\": [\n \"seo audit\"\n ],\n \"search_engine\": \"google\",\n \"region_code\": \"2840\",\n \"language\": \"en\",\n \"title\": \"SEO Audit\",\n \"description\": \"SEO audit service\",\n \"h1\": \"SEO Audit\",\n \"content\": \"<p>Run a complete SEO audit of your website.</p>\",\n \"adjust_text_length\": true\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/optimization/cost", {
method: "post",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Accept": "application/json",
"Content-Type": "application/json",
},
payload: "{\n \"keywords\": [\n \"seo audit\"\n ],\n \"search_engine\": \"google\",\n \"region_code\": \"2840\",\n \"language\": \"en\",\n \"title\": \"SEO Audit\",\n \"description\": \"SEO audit service\",\n \"h1\": \"SEO Audit\",\n \"content\": \"<p>Run a complete SEO audit of your website.</p>\",\n \"adjust_text_length\": true\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());
}
{
"estimate_id": "d3k9gp386g2uo3ei6sg0",
"expires_at": "2026-11-17T12:00:00Z",
"cost": 120,
"total_credits": 10000,
"remaining_credits": 9880,
"has_enough_credits": true
} | फ़ील्ड | प्रकार | विवरण |
|---|---|---|
cost | integer | अनुकूलन शुरू करने के लिए आवश्यक क्रेडिट की संख्या। |
total_credits | integer | वर्तमान AI Writer बैलेंस। |
remaining_credits | integer | अनुकूलन शुरू होने के बाद अनुमानित क्रेडिट बैलेंस। |
has_enough_credits | boolean | बताता है कि वर्तमान बैलेंस अनुकूलन शुरू करने के लिए पर्याप्त है या नहीं। |
413 लौटाता है।/public-api/v1/ai-writer/optimization/documents लागत की गणना में उपयोग की गई JSON बॉडी से अनुकूलन शुरू करता है। ai-optimization:write अनुमति आवश्यक है। वैकल्पिक Idempotency-Key हेडर के साथ अनुरोध सुरक्षित रूप से दोहराया जा सकता है, जिससे अनुकूलन या क्रेडिट कटौती दोबारा नहीं होती। कुंजी में A-Z a-z 0-9 . _ : - के 1–128 वर्ण होने चाहिए।
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: optimization-001' \
--data '{
"keywords": [
"seo audit"
],
"search_engine": "google",
"region_code": "2840",
"language": "en",
"title": "SEO Audit",
"description": "SEO audit service",
"h1": "SEO Audit",
"content": "<p>Run a complete SEO audit of your website.</p>",
"adjust_text_length": true,
"estimate_id": "d3k9gp386g2uo3ei6sg0"
}' \
'https://app.labrika.com/public-api/v1/ai-writer/optimization/documents'
JavaScript
async function main () {
const response = await fetch("https://app.labrika.com/public-api/v1/ai-writer/optimization/documents", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Accept": "application/json",
"Content-Type": "application/json",
"Idempotency-Key": "optimization-001",
},
body: JSON.stringify({
"keywords": [
"seo audit"
],
"search_engine": "google",
"region_code": "2840",
"language": "en",
"title": "SEO Audit",
"description": "SEO audit service",
"h1": "SEO Audit",
"content": "<p>Run a complete SEO audit of your website.</p>",
"adjust_text_length": true,
"estimate_id": "d3k9gp386g2uo3ei6sg0"
}),
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/optimization/documents"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Accept": "application/json",
"Content-Type": "application/json",
"Idempotency-Key": "optimization-001",
}
payload = json.loads("{\n \"keywords\": [\n \"seo audit\"\n ],\n \"search_engine\": \"google\",\n \"region_code\": \"2840\",\n \"language\": \"en\",\n \"title\": \"SEO Audit\",\n \"description\": \"SEO audit service\",\n \"h1\": \"SEO Audit\",\n \"content\": \"<p>Run a complete SEO audit of your website.</p>\",\n \"adjust_text_length\": true,\n \"estimate_id\": \"d3k9gp386g2uo3ei6sg0\"\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/optimization/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: optimization-001',
],
CURLOPT_POSTFIELDS => '{
"keywords": [
"seo audit"
],
"search_engine": "google",
"region_code": "2840",
"language": "en",
"title": "SEO Audit",
"description": "SEO audit service",
"h1": "SEO Audit",
"content": "<p>Run a complete SEO audit of your website.</p>",
"adjust_text_length": true,
"estimate_id": "d3k9gp386g2uo3ei6sg0"
}',
]);
$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/optimization/documents", strings.NewReader("{\n \"keywords\": [\n \"seo audit\"\n ],\n \"search_engine\": \"google\",\n \"region_code\": \"2840\",\n \"language\": \"en\",\n \"title\": \"SEO Audit\",\n \"description\": \"SEO audit service\",\n \"h1\": \"SEO Audit\",\n \"content\": \"<p>Run a complete SEO audit of your website.</p>\",\n \"adjust_text_length\": true,\n \"estimate_id\": \"d3k9gp386g2uo3ei6sg0\"\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", "optimization-001")
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/optimization/documents", {
method: "post",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Accept": "application/json",
"Content-Type": "application/json",
"Idempotency-Key": "optimization-001",
},
payload: "{\n \"keywords\": [\n \"seo audit\"\n ],\n \"search_engine\": \"google\",\n \"region_code\": \"2840\",\n \"language\": \"en\",\n \"title\": \"SEO Audit\",\n \"description\": \"SEO audit service\",\n \"h1\": \"SEO Audit\",\n \"content\": \"<p>Run a complete SEO audit of your website.</p>\",\n \"adjust_text_length\": true,\n \"estimate_id\": \"d3k9gp386g2uo3ei6sg0\"\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());
}
{
"cost": 120,
"total_credits": 10000,
"remaining_credits": 9880,
"has_enough_credits": true,
"document_id": "01k3m8v7g6c5v4b3n2a1",
"status": "pending"
} | फ़ील्ड | प्रकार | विवरण |
|---|---|---|
cost | integer | अनुकूलन के लिए काटे गए क्रेडिट की संख्या। |
total_credits | integer | अनुकूलन की लागत काटे जाने से पहले का क्रेडिट बैलेंस। |
remaining_credits | integer | अनुकूलन की लागत काटे जाने के बाद का क्रेडिट बैलेंस। |
has_enough_credits | boolean | बताता है कि अनुकूलन शुरू करने के लिए पर्याप्त क्रेडिट थे या नहीं। |
document_id | string | शुरू किए गए अनुकूलन का पहचानकर्ता। इससे स्थिति और अंतिम दस्तावेज़ प्राप्त करें। |
status | string | आरंभिक स्थिति pending है: अनुकूलन स्वीकार कर लिया गया है और चल रहा है। |
-
422— अपर्याप्त क्रेडिट; उत्तर में लागत की गणना शामिल है। -
409—Idempotency-Keyका परस्पर विरोधी पुनः उपयोग। -
413— JSON बॉडी 3 MiB से बड़ी है।
/public-api/v1/ai-writer/optimization/documents/{document_id} अनुकूलन की स्थिति या परिणाम लौटाता है। ai-optimization:read अनुमति आवश्यक है। आरंभिक उत्तर का पहचानकर्ता document_id में दें: 0-9a-v सीमा के 20 वर्ण।
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/optimization/documents/01k3m8v7g6c5v4b3n2a1'
JavaScript
async function main () {
const response = await fetch("https://app.labrika.com/public-api/v1/ai-writer/optimization/documents/01k3m8v7g6c5v4b3n2a1", {
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/optimization/documents/01k3m8v7g6c5v4b3n2a1"
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/optimization/documents/01k3m8v7g6c5v4b3n2a1');
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/optimization/documents/01k3m8v7g6c5v4b3n2a1", 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/optimization/documents/01k3m8v7g6c5v4b3n2a1", {
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());
}
| फ़ील्ड | प्रकार | विवरण |
|---|---|---|
document_id | string | अनुरोधित अनुकूलन का पहचानकर्ता। |
status | string | अनुकूलन की स्थिति: pending — जारी, success — पूर्ण, error — विफल। |
retry_after_seconds | integer | अगले स्थिति अनुरोध से पहले सेकंड में अनुशंसित प्रतीक्षा। स्थिति pending होने पर लौटाई जाती है। |
progress_percent | integer | अनुकूलन की वर्तमान प्रगति, 0 से 100 प्रतिशत। स्थिति pending होने पर लौटाई जा सकती है। |
title | string | HTML title की अनुकूलित सामग्री। |
description | string |
description मेटा टैग की अनुकूलित सामग्री। |
h1 | string |
h1 शीर्षक का अनुकूलित पाठ। |
content | string | पृष्ठ की अनुकूलित HTML सामग्री। |
credits_spent | integer | सफल अनुकूलन के बाद वास्तव में काटे गए AI Writer क्रेडिट। केवल status=success होने पर लौटाए जाते हैं। |
seo_score | number | 0 से 100 तक दशमलव SEO अनुकूलन स्कोर, दो दशमलव स्थानों तक राउंड किया गया। |
recommended_words_min | integer | अनुशंसित शब्द संख्या की निचली सीमा। |
recommended_words_max | integer | अनुशंसित शब्द संख्या की ऊपरी सीमा। |
actual_words | integer | अनुकूलित पाठ में शब्दों की वास्तविक संख्या। |
error_code | string | मशीन द्वारा पढ़ा जाने वाला अनुकूलन त्रुटि कोड। status=error होने पर लौटाया जाता है। |
{
"document_id": "01k3m8v7g6c5v4b3n2a1",
"status": "pending",
"retry_after_seconds": 10,
"progress_percent": 50
}
{
"document_id": "01k3m8v7g6c5v4b3n2a1",
"status": "success",
"credits_spent": 120,
"title": "SEO Audit",
"description": "SEO audit service",
"h1": "SEO Audit",
"content": "<p>Optimized content.</p>",
"seo_score": 100,
"recommended_words_min": 100,
"recommended_words_max": 140,
"actual_words": 120
}
404 लौटाता है। status=error होने पर उत्तर में error_code शामिल होता है।AI परिणाम इस्तेमाल करने से पहले तथ्य, कंपनी या उत्पाद का नाम, भाषा और इनपुट से मेल जाँचें। उत्पन्न HTML प्रकाशन से पहले पढ़ें। तकनीकी सफलता सामग्री की समीक्षा का विकल्प नहीं है।
API विधि संदर्भ — AIWriter
विषय-सूची से विधि चुनें। HTTP विधि, पथ, अनुमतियाँ, अनिवार्य पैरामीटर और अनुरोध बॉडी जाँचें। schema, properties और $ref वाले JSON ब्लॉक अनुबंध बताते हैं; उन्हें तैयार अनुरोध बॉडी की तरह न भेजें। अनुरोध उदाहरण और उत्तर स्कीमा अलग चिन्हित हैं।
इस अनुभाग की विधियाँ
- GET /public-api/v1/ai-writer/balance
- POST /public-api/v1/ai-writer/optimization/cost
- POST /public-api/v1/ai-writer/optimization/documents
- GET /public-api/v1/ai-writer/optimization/documents/{document_id}
- POST /public-api/v1/ai-writer/expert-articles/cost
- POST /public-api/v1/ai-writer/expert-articles/documents
- GET /public-api/v1/ai-writer/expert-articles/documents/{document_id}
GET /public-api/v1/ai-writer/balance
`ai-writer:read` स्कोप आवश्यक है।
संबंधित डेटा मॉडल: CacheControl · RateLimitLimit · RateLimitRemaining · RateLimitResetAt · RetryAfter · XRequestID · AIWriterBalance · ErrorResponse
प्रतिक्रियाएँ
200
वर्तमान AI Writer क्रेडिट बैलेंस।
{
"headers": {
"X-Request-ID": {
"$ref": "#/components/headers/XRequestID"
},
"X-RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"X-RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"X-RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitResetAt"
},
"Cache-Control": {
"$ref": "#/components/headers/CacheControl"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AIWriterBalance"
}
}
}
}
default
कुंजी अनुपस्थित या अमान्य होने पर सीमा हेडर प्रति IP विफल प्रयासों को दर्शाते हैं। प्रमाणीकरण के बाद वे कुंजी या खाते की सीमा दर्शाते हैं। पहले से रोक या काउंटर अनुपलब्ध होने पर हेडर अनुपस्थित हो सकते हैं। X-RateLimit-Reset सेकंड में Unix समय है; 429 पर Retry-After सेकंड में प्रतीक्षा है।
{
"headers": {
"X-Request-ID": {
"$ref": "#/components/headers/XRequestID"
},
"X-RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"X-RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"X-RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitResetAt"
},
"Cache-Control": {
"$ref": "#/components/headers/CacheControl"
},
"Retry-After": {
"$ref": "#/components/headers/RetryAfter"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
POST /public-api/v1/ai-writer/optimization/cost
`ai-optimization:read` स्कोप आवश्यक है।
संबंधित डेटा मॉडल: CacheControl · RateLimitLimit · RateLimitRemaining · RateLimitResetAt · RetryAfter · XRequestID · AIWriterOptimizationCost · AIWriterOptimizationEstimate · AIWriterOptimizationEstimatePending · AIWriterOptimizationRequest · ErrorResponse
अनुरोध
JSON अनुरोध बॉडी 3 MiB (3145728 बाइट) से अधिक नहीं होनी चाहिए।
{
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AIWriterOptimizationRequest"
}
}
}
}
प्रतिक्रियाएँ
200
लागत की जानकारी और वर्तमान बैलेंस।
{
"headers": {
"X-Request-ID": {
"$ref": "#/components/headers/XRequestID"
},
"X-RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"X-RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"X-RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitResetAt"
},
"Cache-Control": {
"$ref": "#/components/headers/CacheControl"
}
},
"content": {
"application/json": {
"schema": {
"anyOf": [
{
"$ref": "#/components/schemas/AIWriterOptimizationCost"
},
{
"$ref": "#/components/schemas/AIWriterOptimizationEstimate"
}
]
}
}
}
}
202
क्रेडिट काटे बिना सुझाव तैयार किए जा रहे हैं। लागत की गणना वाला वही अनुरोध दोहराएँ।
{
"headers": {
"Retry-After": {
"$ref": "#/components/headers/RetryAfter"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AIWriterOptimizationEstimatePending"
}
}
}
}
413
{
"headers": {
"X-Request-ID": {
"$ref": "#/components/headers/XRequestID"
},
"X-RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"X-RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"X-RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitResetAt"
},
"Cache-Control": {
"$ref": "#/components/headers/CacheControl"
},
"Retry-After": {
"$ref": "#/components/headers/RetryAfter"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
default
{
"headers": {
"X-Request-ID": {
"$ref": "#/components/headers/XRequestID"
},
"X-RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"X-RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"X-RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitResetAt"
},
"Cache-Control": {
"$ref": "#/components/headers/CacheControl"
},
"Retry-After": {
"$ref": "#/components/headers/RetryAfter"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
POST /public-api/v1/ai-writer/optimization/documents
`ai-optimization:write` स्कोप आवश्यक है।
संबंधित डेटा मॉडल: CacheControl · RateLimitLimit · RateLimitRemaining · RateLimitResetAt · RetryAfter · XRequestID · AIWriterOptimizationCost · AIWriterOptimizationRequest · AIWriterOptimizationStart · ErrorResponse
पैरामीटर
Idempotency-Key (header)
उसी पूर्ण अनुरोध की प्रतिक्रिया 24 घंटे तक दोहराने के लिए वैकल्पिक कुंजी।
{
"schema": {
"type": "string",
"minLength": 1,
"maxLength": 128,
"pattern": "^[A-Za-z0-9._:-]+$"
}
}
अनुरोध
JSON अनुरोध बॉडी 3 MiB (3145728 बाइट) से अधिक नहीं होनी चाहिए।
{
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AIWriterOptimizationRequest"
}
}
}
}
प्रतिक्रियाएँ
202
ऑप्टिमाइज़ेशन स्वीकार किया गया।
{
"headers": {
"X-Request-ID": {
"$ref": "#/components/headers/XRequestID"
},
"X-RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"X-RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"X-RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitResetAt"
},
"Cache-Control": {
"$ref": "#/components/headers/CacheControl"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AIWriterOptimizationStart"
}
}
}
}
422
अपर्याप्त AI Writer क्रेडिट।
{
"headers": {
"X-Request-ID": {
"$ref": "#/components/headers/XRequestID"
},
"X-RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"X-RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"X-RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitResetAt"
},
"Cache-Control": {
"$ref": "#/components/headers/CacheControl"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AIWriterOptimizationCost"
}
}
}
}
413
{
"headers": {
"X-Request-ID": {
"$ref": "#/components/headers/XRequestID"
},
"X-RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"X-RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"X-RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitResetAt"
},
"Cache-Control": {
"$ref": "#/components/headers/CacheControl"
},
"Retry-After": {
"$ref": "#/components/headers/RetryAfter"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
409
{
"headers": {
"X-Request-ID": {
"$ref": "#/components/headers/XRequestID"
},
"X-RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"X-RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"X-RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitResetAt"
},
"Cache-Control": {
"$ref": "#/components/headers/CacheControl"
},
"Retry-After": {
"$ref": "#/components/headers/RetryAfter"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
default
{
"headers": {
"X-Request-ID": {
"$ref": "#/components/headers/XRequestID"
},
"X-RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"X-RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"X-RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitResetAt"
},
"Cache-Control": {
"$ref": "#/components/headers/CacheControl"
},
"Retry-After": {
"$ref": "#/components/headers/RetryAfter"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
GET /public-api/v1/ai-writer/optimization/documents/{document_id}
`ai-optimization:read` स्कोप आवश्यक है।
संबंधित डेटा मॉडल: CacheControl · RateLimitLimit · RateLimitRemaining · RateLimitResetAt · RetryAfter · XRequestID · AIWriterOptimizationDocument · ErrorResponse
पैरामीटर
document_id (path)
{
"required": true,
"schema": {
"type": "string",
"pattern": "^[0-9a-v]{20}$"
}
}
content_view (query)
{
"schema": {
"type": "string",
"enum": [
"both",
"plain",
"annotated"
],
"default": "both"
}
}
प्रतिक्रियाएँ
200
ऑप्टिमाइज़ेशन की वर्तमान स्थिति या परिणाम।
{
"headers": {
"X-Request-ID": {
"$ref": "#/components/headers/XRequestID"
},
"X-RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"X-RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"X-RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitResetAt"
},
"Cache-Control": {
"$ref": "#/components/headers/CacheControl"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AIWriterOptimizationDocument"
}
}
}
}
400
{
"headers": {
"X-Request-ID": {
"$ref": "#/components/headers/XRequestID"
},
"X-RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"X-RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"X-RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitResetAt"
},
"Cache-Control": {
"$ref": "#/components/headers/CacheControl"
},
"Retry-After": {
"$ref": "#/components/headers/RetryAfter"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
404
{
"headers": {
"X-Request-ID": {
"$ref": "#/components/headers/XRequestID"
},
"X-RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"X-RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"X-RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitResetAt"
},
"Cache-Control": {
"$ref": "#/components/headers/CacheControl"
},
"Retry-After": {
"$ref": "#/components/headers/RetryAfter"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
default
{
"headers": {
"X-Request-ID": {
"$ref": "#/components/headers/XRequestID"
},
"X-RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"X-RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"X-RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitResetAt"
},
"Cache-Control": {
"$ref": "#/components/headers/CacheControl"
},
"Retry-After": {
"$ref": "#/components/headers/RetryAfter"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
POST /public-api/v1/ai-writer/expert-articles/cost
विशेषज्ञ लेख के लिए अधिकतम AI क्रेडिट का अनुमान लगाएँ। अनुमान 10 मिनट तक मान्य है।
संबंधित डेटा मॉडल: CacheControl · RateLimitLimit · RateLimitRemaining · RateLimitResetAt · RetryAfter · XRequestID · ErrorResponse · ExpertArticleEstimate · ExpertArticleInput
अनुमतियाँ: ai-expert-articles:read
अनुरोध
{
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ExpertArticleInput"
}
}
}
}
प्रतिक्रियाएँ
200
विशेषज्ञ लेख के लिए अधिकतम AI क्रेडिट का अनुमान लगाएँ। अनुमान 10 मिनट तक मान्य है।
{
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"data"
],
"properties": {
"data": {
"$ref": "#/components/schemas/ExpertArticleEstimate"
}
}
}
}
}
}
default
{
"headers": {
"X-Request-ID": {
"$ref": "#/components/headers/XRequestID"
},
"X-RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"X-RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"X-RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitResetAt"
},
"Cache-Control": {
"$ref": "#/components/headers/CacheControl"
},
"Retry-After": {
"$ref": "#/components/headers/RetryAfter"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
POST /public-api/v1/ai-writer/expert-articles/documents
अनुमान और उसके Idempotency-Key का उपयोग करके विशेषज्ञ लेख लिखना शुरू करें। मूल लॉन्च परिणाम पाने के लिए वही अनुरोध दोहराएँ।
संबंधित डेटा मॉडल: CacheControl · RateLimitLimit · RateLimitRemaining · RateLimitResetAt · RetryAfter · XRequestID · ErrorResponse · ExpertArticleStart · ExpertArticleStartInput
अनुमतियाँ: ai-expert-articles:write
पैरामीटर
Idempotency-Key (header)
{
"required": true,
"schema": {
"type": "string",
"minLength": 1,
"maxLength": 128,
"pattern": "^[A-Za-z0-9._:-]+$"
}
}
अनुरोध
{
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ExpertArticleStartInput"
}
}
}
}
प्रतिक्रियाएँ
202
अनुमान और उसके Idempotency-Key का उपयोग करके विशेषज्ञ लेख लिखना शुरू करें। मूल लॉन्च परिणाम पाने के लिए वही अनुरोध दोहराएँ।
{
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"data"
],
"properties": {
"data": {
"$ref": "#/components/schemas/ExpertArticleStart"
}
}
}
}
}
}
409
{
"headers": {
"X-Request-ID": {
"$ref": "#/components/headers/XRequestID"
},
"X-RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"X-RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"X-RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitResetAt"
},
"Cache-Control": {
"$ref": "#/components/headers/CacheControl"
},
"Retry-After": {
"$ref": "#/components/headers/RetryAfter"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
422
{
"headers": {
"X-Request-ID": {
"$ref": "#/components/headers/XRequestID"
},
"X-RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"X-RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"X-RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitResetAt"
},
"Cache-Control": {
"$ref": "#/components/headers/CacheControl"
},
"Retry-After": {
"$ref": "#/components/headers/RetryAfter"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
default
{
"headers": {
"X-Request-ID": {
"$ref": "#/components/headers/XRequestID"
},
"X-RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"X-RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"X-RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitResetAt"
},
"Cache-Control": {
"$ref": "#/components/headers/CacheControl"
},
"Retry-After": {
"$ref": "#/components/headers/RetryAfter"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
GET /public-api/v1/ai-writer/expert-articles/documents/{document_id}
विशेषज्ञ लेख की प्रगति देखें और पूरा होने पर जनरेट किया गया HTML प्राप्त करें।
संबंधित डेटा मॉडल: CacheControl · RateLimitLimit · RateLimitRemaining · RateLimitResetAt · RetryAfter · XRequestID · ErrorResponse · ExpertArticleResult
अनुमतियाँ: ai-expert-articles:read
पैरामीटर
document_id (path)
{
"required": true,
"schema": {
"type": "string",
"pattern": "^[0-9a-v]{20}$"
}
}
प्रतिक्रियाएँ
200
विशेषज्ञ लेख की प्रगति देखें और पूरा होने पर जनरेट किया गया HTML प्राप्त करें।
{
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"data"
],
"properties": {
"data": {
"$ref": "#/components/schemas/ExpertArticleResult"
}
}
}
}
}
}
404
{
"headers": {
"X-Request-ID": {
"$ref": "#/components/headers/XRequestID"
},
"X-RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"X-RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"X-RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitResetAt"
},
"Cache-Control": {
"$ref": "#/components/headers/CacheControl"
},
"Retry-After": {
"$ref": "#/components/headers/RetryAfter"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
default
{
"headers": {
"X-Request-ID": {
"$ref": "#/components/headers/XRequestID"
},
"X-RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"X-RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"X-RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitResetAt"
},
"Cache-Control": {
"$ref": "#/components/headers/CacheControl"
},
"Retry-After": {
"$ref": "#/components/headers/RetryAfter"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
AI परिणाम इस्तेमाल करने से पहले तथ्य, कंपनी या उत्पाद का नाम, भाषा और इनपुट से मेल जाँचें। उत्पन्न HTML प्रकाशन से पहले पढ़ें। तकनीकी सफलता सामग्री की समीक्षा का विकल्प नहीं है।
उत्पाद विवरण
उत्पाद के नाम और विशेषताओं से कैटलॉग विवरण बनाएँ। API HTML सामग्री, पेज शीर्षक, मेटा विवरण और H1 लौटाता है। निर्माण पृष्ठभूमि में होता है: लागत का अनुमान लें, दस्तावेज़ बनाएँ और उसके पहचानकर्ता से परिणाम प्राप्त करें।
दोनों POST अनुरोधों के JSON बॉडी में तीनों फ़ील्ड आवश्यक हैं। Content-Type: application/json भेजें। सीमा 16 KiB है। निर्माण के लिए ai-product-descriptions:write तथा अनुमान और परिणाम पढ़ने के लिए ai-product-descriptions:read आवश्यक है।
| पैरामीटर | विवरण |
|---|---|
title · string | उत्पाद का नाम और मुख्य विशेषताएँ: 1–256 अक्षर। पहचान के लिए मॉडल, सामग्री, आकार या उपयोग बताएँ। |
language · string | नीचे दी गई तालिका का भाषा कोड। यह फ़ील्ड परिणाम की भाषा तय करता है। |
word_count · integer |
पैरामीटर मान और लक्षित लंबाई: 400 → 400–600 शब्द; 600 → 600–800 शब्द; 800 → 800–1200 शब्द। वास्तविक शब्द संख्या actual_words में मिलती है।
|
समर्थित भाषाएँ
हिंदी में विवरण बनाने के लिए hi दें। स्वीकार्य भाषा कोड ProductDescriptionRequest में दिए गए हैं।
/public-api/v1/ai-writer/product-descriptions/cost
निर्माण शुरू किए या क्रेडिट खर्च किए बिना लागत का अनुमान देता है। cost, total_credits, remaining_credits और has_enough_credits लौटाता है। बनाने से पहले has_enough_credits जाँचें; अनुमान बैलेंस आरक्षित नहीं करता।
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());
}
/public-api/v1/ai-writer/product-descriptions/documents
निर्माण शुरू करता है। हर नए दस्तावेज़ के लिए अद्वितीय Idempotency-Key भेजें। HTTP 202 में document_id, status, cost और has_enough_credits मिलते हैं। परिणाम लेने के लिए document_id सहेजें।
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());
}
/public-api/v1/ai-writer/product-descriptions/documents/{document_id}
pending होने पर retry_after_seconds के बाद GET दोहराएँ (आमतौर पर 10 सेकंड)। success में content (HTML), title, description, h1, actual_words और credits_spent मिलते हैं। error में error_code पढ़ें; credits_spent 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());
}
Idempotency-Key और बॉडी के साथ दोहराएँ। सहेजा उत्तर 24 घंटे तक लौटता है। अलग बॉडी या अधूरा अनुरोध HTTP 409 देता है। अपर्याप्त क्रेडिट होने पर बैलेंस बढ़ाएँ और नई कुंजी उपयोग करें।
product_not_recognized: नाम और विशेषताएँ स्पष्ट करें। product_description_failed: निर्माण विफल रहा। ज्ञात पहचान विफलता तुरंत HTTP 422 दे सकती है और उसी उत्पाद के लिए 7 दिन कैश में रहती है। नई कुंजी इस कैश को नहीं टालती।
credits_spent वास्तविक खपत बताता है और बचा आरक्षण वापस मिलता है। निर्माण विफल होने पर क्रेडिट खर्च नहीं होते।
AI परिणाम इस्तेमाल करने से पहले तथ्य, कंपनी या उत्पाद का नाम, भाषा और इनपुट से मेल जाँचें। उत्पन्न HTML प्रकाशन से पहले पढ़ें। तकनीकी सफलता सामग्री की समीक्षा का विकल्प नहीं है।
API सैंडबॉक्स: इंटीग्रेशन का परीक्षण — उत्पाद विवरण
यह निर्देश टेस्ट वातावरण के लिए है। सभी चरणों में TEST कुंजी और /public-api-test/v1 का उपयोग करें। उदाहरण परिणामों का अनुकरण करते हैं; वास्तविक जनरेशन या प्रोडक्शन खाते में शुल्क नहीं होता।
उत्पाद के नाम और विशेषताओं से कैटलॉग विवरण बनाएँ। API HTML सामग्री, पेज शीर्षक, मेटा विवरण और H1 लौटाता है। निर्माण पृष्ठभूमि में होता है: लागत का अनुमान लें, दस्तावेज़ बनाएँ और उसके पहचानकर्ता से परिणाम प्राप्त करें।
दोनों POST अनुरोधों के JSON बॉडी में तीनों फ़ील्ड आवश्यक हैं। Content-Type: application/json भेजें। सीमा 16 KiB है। निर्माण के लिए ai-product-descriptions:write तथा अनुमान और परिणाम पढ़ने के लिए ai-product-descriptions:read आवश्यक है।
| पैरामीटर | विवरण |
|---|---|
title · string | उत्पाद का नाम और मुख्य विशेषताएँ: 1–256 अक्षर। पहचान के लिए मॉडल, सामग्री, आकार या उपयोग बताएँ। |
language · string | नीचे दी गई तालिका का भाषा कोड। यह फ़ील्ड परिणाम की भाषा तय करता है। |
word_count · integer |
पैरामीटर मान और लक्षित लंबाई: 400 → 400–600 शब्द; 600 → 600–800 शब्द; 800 → 800–1200 शब्द। वास्तविक शब्द संख्या actual_words में मिलती है।
|
समर्थित भाषाएँ
हिंदी में विवरण बनाने के लिए hi दें। स्वीकार्य भाषा कोड ProductDescriptionRequest में दिए गए हैं।
/public-api-test/v1/ai-writer/product-descriptions/cost
निर्माण शुरू किए या क्रेडिट खर्च किए बिना लागत का अनुमान देता है। cost, total_credits, remaining_credits और has_enough_credits लौटाता है। बनाने से पहले has_enough_credits जाँचें; अनुमान बैलेंस आरक्षित नहीं करता।
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());
}
/public-api-test/v1/ai-writer/product-descriptions/documents
निर्माण शुरू करता है। हर नए दस्तावेज़ के लिए अद्वितीय Idempotency-Key भेजें। HTTP 202 में document_id, status, cost और has_enough_credits मिलते हैं। परिणाम लेने के लिए document_id सहेजें।
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());
}
/public-api-test/v1/ai-writer/product-descriptions/documents/{document_id}
pending होने पर retry_after_seconds के बाद GET दोहराएँ (आमतौर पर 10 सेकंड)। success में content (HTML), title, description, h1, actual_words और credits_spent मिलते हैं। error में error_code पढ़ें; credits_spent 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());
}
Idempotency-Key और बॉडी के साथ दोहराएँ। सहेजा उत्तर 24 घंटे तक लौटता है। अलग बॉडी या अधूरा अनुरोध HTTP 409 देता है। अपर्याप्त क्रेडिट होने पर बैलेंस बढ़ाएँ और नई कुंजी उपयोग करें।
product_not_recognized: नाम और विशेषताएँ स्पष्ट करें। product_description_failed: निर्माण विफल रहा। ज्ञात पहचान विफलता तुरंत HTTP 422 दे सकती है और उसी उत्पाद के लिए 7 दिन कैश में रहती है। नई कुंजी इस कैश को नहीं टालती।
credits_spent वास्तविक खपत बताता है और बचा आरक्षण वापस मिलता है। निर्माण विफल होने पर क्रेडिट खर्च नहीं होते।
परीक्षण मोड में त्रुटियाँ दोहराने के लिए ये title मान उपयोग करें। प्रत्येक परिदृश्य के लिए नया Idempotency-Key रखें।
title | परिणाम |
|---|---|
sandbox:product_not_recognized | तुरंत HTTP 422 |
sandbox:async_product_not_recognized |
pending, फिर error product_not_recognized
|
sandbox:product_description_failed |
pending, फिर 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());
}AI परिणाम इस्तेमाल करने से पहले तथ्य, कंपनी या उत्पाद का नाम, भाषा और इनपुट से मेल जाँचें। उत्पन्न HTML प्रकाशन से पहले पढ़ें। तकनीकी सफलता सामग्री की समीक्षा का विकल्प नहीं है।
API विधि संदर्भ — ProductDescriptions
विषय-सूची से विधि चुनें। HTTP विधि, पथ, अनुमतियाँ, अनिवार्य पैरामीटर और अनुरोध बॉडी जाँचें। schema, properties और $ref वाले JSON ब्लॉक अनुबंध बताते हैं; उन्हें तैयार अनुरोध बॉडी की तरह न भेजें। अनुरोध उदाहरण और उत्तर स्कीमा अलग चिन्हित हैं।
इस अनुभाग की विधियाँ
POST /public-api/v1/ai-writer/product-descriptions/cost
कुंजी का ai-product-descriptions:read स्कोप और खाते की public-api-product-descriptions.show अनुमति आवश्यक है। परीक्षण संस्करण test कुंजी के साथ /public-api-test/v1 पर समान पथ प्रत्यय के साथ उपलब्ध है। sandbox में परीक्षण डेटा का उपयोग होता है, AI या वास्तविक शुल्क का नहीं। सामान्य उत्पाद नाम सफल परिणाम देता है; sandbox:product_not_recognized 422 लौटाता है; sandbox:async_product_not_recognized और sandbox:product_description_failed, pending के बाद संबंधित त्रुटि लौटाते हैं। परीक्षण दस्तावेज़ 7 दिनों तक या sandbox रीसेट होने तक उपलब्ध रहते हैं, जो भी पहले हो।
संबंधित डेटा मॉडल: CacheControl · RateLimitLimit · RateLimitRemaining · RateLimitResetAt · RetryAfter · XRequestID · ErrorResponse · ProductDescriptionCost · ProductDescriptionRequest
अनुरोध
अधिकतम 16384 बाइट का JSON बॉडी।
{
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProductDescriptionRequest"
}
}
}
}
प्रतिक्रियाएँ
200
वर्तमान परिणाम; लागत अनुमान क्रेडिट आरक्षित या खर्च नहीं करता।
{
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProductDescriptionCost"
}
}
}
}
default
कुंजी अनुपस्थित या अमान्य होने पर सीमा हेडर प्रति IP विफल प्रयासों को दर्शाते हैं। प्रमाणीकरण के बाद वे कुंजी या खाते की सीमा दर्शाते हैं। पहले से रोक या काउंटर अनुपलब्ध होने पर हेडर अनुपस्थित हो सकते हैं। X-RateLimit-Reset सेकंड में Unix समय है; 429 पर Retry-After सेकंड में प्रतीक्षा है।
{
"headers": {
"X-Request-ID": {
"$ref": "#/components/headers/XRequestID"
},
"X-RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"X-RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"X-RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitResetAt"
},
"Cache-Control": {
"$ref": "#/components/headers/CacheControl"
},
"Retry-After": {
"$ref": "#/components/headers/RetryAfter"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
POST /public-api/v1/ai-writer/product-descriptions/documents
कुंजी का ai-product-descriptions:write स्कोप और खाते की public-api-product-descriptions.show अनुमति आवश्यक है। परीक्षण संस्करण test कुंजी के साथ /public-api-test/v1 पर समान पथ प्रत्यय के साथ उपलब्ध है। sandbox में परीक्षण डेटा का उपयोग होता है, AI या वास्तविक शुल्क का नहीं। सामान्य उत्पाद नाम सफल परिणाम देता है; sandbox:product_not_recognized 422 लौटाता है; sandbox:async_product_not_recognized और sandbox:product_description_failed, pending के बाद संबंधित त्रुटि लौटाते हैं। परीक्षण दस्तावेज़ 7 दिनों तक या sandbox रीसेट होने तक उपलब्ध रहते हैं, जो भी पहले हो।
संबंधित डेटा मॉडल: CacheControl · RateLimitLimit · RateLimitRemaining · RateLimitResetAt · RetryAfter · XRequestID · ErrorResponse · ProductDescriptionCost · ProductDescriptionRejected · ProductDescriptionRequest · ProductDescriptionStart
पैरामीटर
Idempotency-Key (header)
सशुल्क जनरेशन के लिए आवश्यक। समान कुंजी, रूट और बिल्कुल समान अनुरोध बॉडी के लिए 24 घंटे तक वही प्रतिक्रिया लौटाता है। अलग बॉडी पर 409 लौटता है। समवर्ती अनुरोध और अनिश्चित परिणाम वाले प्रारंभ 409 के साथ अवरुद्ध रहते हैं; नई कुंजी से दोबारा प्रयास न करें।
{
"required": true,
"schema": {
"type": "string",
"minLength": 1,
"maxLength": 128,
"pattern": "^[A-Za-z0-9._:-]+$"
}
}
अनुरोध
अधिकतम 16384 बाइट का JSON बॉडी।
{
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProductDescriptionRequest"
}
}
}
}
प्रतिक्रियाएँ
202
जनरेशन स्वीकार किया गया; लागत आरक्षित ऊपरी सीमा है।
{
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProductDescriptionStart"
}
}
}
}
422
अपर्याप्त क्रेडिट या पिछले 7 दिनों में कैश की गई उत्पाद पहचान विफलता (error.code=product_not_recognized, credits_spent=0)। जनरेशन शुरू नहीं होता। पैरामीटर बदलने या बैलेंस बढ़ाने के बाद नया Idempotency-Key उपयोग करें।
{
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/ProductDescriptionCost"
},
{
"$ref": "#/components/schemas/ProductDescriptionRejected"
}
]
}
}
}
}
409
{
"headers": {
"X-Request-ID": {
"$ref": "#/components/headers/XRequestID"
},
"X-RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"X-RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"X-RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitResetAt"
},
"Cache-Control": {
"$ref": "#/components/headers/CacheControl"
},
"Retry-After": {
"$ref": "#/components/headers/RetryAfter"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
default
{
"headers": {
"X-Request-ID": {
"$ref": "#/components/headers/XRequestID"
},
"X-RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"X-RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"X-RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitResetAt"
},
"Cache-Control": {
"$ref": "#/components/headers/CacheControl"
},
"Retry-After": {
"$ref": "#/components/headers/RetryAfter"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
GET /public-api/v1/ai-writer/product-descriptions/documents/{document_id}
कुंजी का ai-product-descriptions:read स्कोप और खाते की public-api-product-descriptions.show अनुमति आवश्यक है। परीक्षण संस्करण test कुंजी के साथ /public-api-test/v1 पर समान पथ प्रत्यय के साथ उपलब्ध है। sandbox में परीक्षण डेटा का उपयोग होता है, AI या वास्तविक शुल्क का नहीं। सामान्य उत्पाद नाम सफल परिणाम देता है; sandbox:product_not_recognized 422 लौटाता है; sandbox:async_product_not_recognized और sandbox:product_description_failed, pending के बाद संबंधित त्रुटि लौटाते हैं। परीक्षण दस्तावेज़ 7 दिनों तक या sandbox रीसेट होने तक उपलब्ध रहते हैं, जो भी पहले हो।
संबंधित डेटा मॉडल: CacheControl · RateLimitLimit · RateLimitRemaining · RateLimitResetAt · RetryAfter · XRequestID · ErrorResponse · ProductDescriptionDocument
पैरामीटर
document_id (path)
{
"required": true,
"schema": {
"type": "string"
}
}
प्रतिक्रियाएँ
200
मालिक के उत्पाद विवरण की स्थिति। pending परिणामों की जाँच 10 सेकंड बाद दोबारा करें।
{
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProductDescriptionDocument"
}
}
}
}
default
{
"headers": {
"X-Request-ID": {
"$ref": "#/components/headers/XRequestID"
},
"X-RateLimit-Limit": {
"$ref": "#/components/headers/RateLimitLimit"
},
"X-RateLimit-Remaining": {
"$ref": "#/components/headers/RateLimitRemaining"
},
"X-RateLimit-Reset": {
"$ref": "#/components/headers/RateLimitResetAt"
},
"Cache-Control": {
"$ref": "#/components/headers/CacheControl"
},
"Retry-After": {
"$ref": "#/components/headers/RetryAfter"
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
AI परिणाम इस्तेमाल करने से पहले तथ्य, कंपनी या उत्पाद का नाम, भाषा और इनपुट से मेल जाँचें। उत्पन्न HTML प्रकाशन से पहले पढ़ें। तकनीकी सफलता सामग्री की समीक्षा का विकल्प नहीं है।
इस अनुभाग के अन्य लेख
- Labrika API: त्वरित शुरुआत, प्रमाणीकरण और त्रुटियाँ
- Labrika API: डेटा मॉडल और मेटाडेटा
- API से SEO ऑडिट, रिपोर्ट और निर्यात
- API से कीवर्ड और रैंकिंग
- API से AI में दृश्यता और प्रॉम्प्ट सुझाव
- API से Diff बदलावों की निगरानी
- API अलर्ट, वेबहुक और शेड्यूल
- API कार्य योजनाएँ, कार्य और प्रोजेक्ट समूह
- API से SERM, विशेषज्ञ और कार्यप्रवाह
