Developer API

Transform social trends into branded content with our powerful REST API. Integrate TrendScribbr into your workflow and automate content creation.

API Overview

The TrendScribbr API allows you to programmatically generate high-quality articles, social media posts, newsletters, and other content using our AI-powered platform. Our API is RESTful, uses JSON for requests and responses, and supports authentication via API keys.

Key Features

  • AI-Powered Generation: State-of-the-art language models for content creation
  • Brand Consistency: Maintain your brand voice and style across all content
  • Trend Analysis: Generate content based on real-time social media trends
  • Multiple Formats: Support for articles, social posts, newsletters, and more
  • RESTful Design: Clean, intuitive API following REST principles

Quick Start

Get API Key

Sign up for TrendScribbr and generate an API key from your dashboard settings.

Make API Call

Use your API key to authenticate requests to our content generation endpoints.

Generate Content

Receive AI-generated content in seconds, ready for your applications.

Base URL

https://your-domain.com/agents/api/

Rate Limits

API requests are subject to plan-based rate limits. Higher-tier plans offer increased limits and priority processing.

Authentication

All API requests require authentication using an API key. API keys are tied to your TrendScribbr account and can be managed from your dashboard.

Security Best Practices

  • Keep your API keys secure and never expose them in client-side code
  • Rotate your API keys regularly for enhanced security
  • Use different keys for different applications/environments
  • Monitor API key usage through your dashboard

Authentication Methods

You can authenticate requests using any of these methods:

X-API-Key Header (Recommended)

curl -X POST "https://your-domain.com/agents/api/articles/generate/" \ -H "X-API-Key: your-api-key-here" \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "content_type=article"

Authorization Header

curl -X POST "https://your-domain.com/agents/api/articles/generate/" \ -H "Authorization: Bearer your-api-key-here" \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "content_type=article"

Query Parameter

curl -X POST "https://your-domain.com/agents/api/articles/generate/?api_key=your-api-key-here" \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "content_type=article"

API Endpoints

POST /articles/generate/

Generate new content including articles, social media posts, newsletters, and blog posts.

Parameters

Parameter Type Required Description
content_type string Yes Content type: "article", "social", "newsletter", "post", "batch"
custom_topic string No Custom topic for content generation
custom_prompt string No Custom instructions for content generation
reddit_post_id integer No ID of specific Reddit post to base content on

Success Response (200)

{ "status": "success", "message": "Article generation started for Brand Name", "job_id": 123, "task_id": "uuid-string", "estimated_time": "3-5 minutes", "brand_context": { "brand_name": "Brand Name", "industry": "Technology", "keywords_count": 25, "has_overview": true } }

Error Response (400)

{ "status": "error", "message": "Your brand needs keywords before generating content", "redirect_url": "/agents/brand/1/keywords/" }
GET /jobs/{job_id}/status/

Check the status and progress of a content generation job.

Success Response (200)

{ "job_id": 123, "status": "completed", "progress_percentage": 100, "started_at": "2024-01-19T10:00:00Z", "completed_at": "2024-01-19T10:03:30Z", "article_id": 456, "error_message": null }

Code Examples

Python

python
import requests API_KEY = "your-api-key-here" BASE_URL = "https://your-domain.com/agents/api" def generate_article(topic): url = f"{BASE_URL}/articles/generate/" headers = { "X-API-Key": API_KEY, "Content-Type": "application/x-www-form-urlencoded" } data = { "content_type": "article", "custom_topic": topic } response = requests.post(url, headers=headers, data=data) return response.json() # Usage result = generate_article("The Future of AI in Healthcare") print(result)

JavaScript/Node.js

javascript
const axios = require('axios'); const API_KEY = 'your-api-key-here'; const BASE_URL = 'https://your-domain.com/agents/api'; async function generateArticle(topic) { try { const response = await axios.post(`${BASE_URL}/articles/generate/`, { content_type: 'article', custom_topic: topic }, { headers: { 'X-API-Key': API_KEY, 'Content-Type': 'application/x-www-form-urlencoded' } }); return response.data; } catch (error) { console.error('Error:', error.response.data); throw error; } } // Usage generateArticle('The Future of AI in Healthcare') .then(result => console.log(result)) .catch(error => console.error(error));

cURL

bash
curl -X POST "https://your-domain.com/agents/api/articles/generate/" \ -H "X-API-Key: your-api-key-here" \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "content_type=article" \ -d "custom_topic=The Future of AI in Healthcare"

PHP

php
'article', 'custom_topic' => $topic ]); $context = stream_context_create([ 'http' => [ 'method' => 'POST', 'header' => [ 'X-API-Key: ' . $apiKey, 'Content-Type: application/x-www-form-urlencoded' ], 'content' => $data ] ]); $result = file_get_contents($url, false, $context); return json_decode($result, true); } // Usage $result = generateArticle('The Future of AI in Healthcare'); print_r($result); ?>