Quickstart Guide

Get started with TrendiFi API in minutes. This guide will help you make your first API request and understand the basics of our service.

Authentication

All API requests require an API key for authentication. You can get your API key from the API Access page in your dashboard.

Making Your First Request

The TrendiFi API has two main endpoints:

POST /content

Request a new content on any topic

GET /content/:id

Check status or retrieve results

Request Parameters

All POST requests require the following parameters:

ParameterTypeRequiredDescription
topicstringYesThe topic or question to analyze
data_structureobjectYesStructure definition for how you want the content data to be organized

Custom Data Structure

The data_structure parameter defines how you want the content data to be organized in the response. This allows you to:

  • Specify exactly what data points you need
  • Define the structure that best fits your application
  • Get data in a format that's ready to use without additional parsing
  • Guide the AI on what specific content to generate for each field

Defining Your Custom Data Structure

The TrendiFi API requires a data_structure parameter that defines exactly how you want your content data to be organized. This allows you to get data in a format that perfectly matches your application's needs:

// POST https://trendifi.app/api/v1/content
{
  "topic": "Electric vehicles market trends",
  "data_structure": {
    "summary": "string - concise overview of current EV market trends in 2-3 sentences",
    "key_trends": [{
      "name": "string - short name of a specific market trend",
      "description": "string - detailed explanation with supporting data points",
      "impact_score": "number - rating from 1-10 of market impact"
    }],
    "market_leaders": ["string - names of top companies with brief description of their market position"],
    "regional_insights": {
      "north_america": "string - key developments and adoption rates in North American markets",
      "europe": "string - regulatory environment and market growth in European countries",
      "asia": "string - manufacturing trends and consumer adoption in Asian markets"
    },
    "forecast": {
      "growth_rate": "number - projected annual growth percentage for next 3 years",
      "challenges": ["string - specific obstacles facing the industry with potential solutions"],
      "opportunities": ["string - emerging areas for innovation and investment"] 
    }
  }
}

This tells the AI how to structure the response, allowing you to programmatically render the data in your application without additional parsing.

Best Practice: Include Descriptive Guidance

Notice how each field includes descriptive guidance after the data type (e.g., "string - concise overview of current EV market trends"). These descriptions help the AI understand exactly what content to generate for each field.

Adding specific guidance for each field significantly improves the quality and relevance of the generated content. Be as specific as possible about what you want in each field, including tone, length, focus areas, and any other requirements.

Code Examples

# Request a new content
curl -X POST https://trendifi.app/api/v1/content \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "topic": "Tesla stock performance",
  "data_structure": {
    "market_summary": {
      "price_change": "number - percentage change in stock price over last 30 days",
      "trading_volume": "number - average daily trading volume in millions",
      "key_metrics": ["string - important financial indicators with current values"]
    },
    "analysis": {
      "short_term_outlook": "string - 1-2 paragraph analysis of 3-month prospects",
      "long_term_outlook": "string - 1-2 paragraph analysis of 1-year prospects",
      "risk_factors": ["string - specific risks that could impact stock performance"]
    },
    "recommendations": ["string - actionable investment advice based on the analysis"]
  }
}'

# Response
{"request_id": "ins_8f7d6e5c4b3a2910", "status": "processing", "created_at": "2023-09-15T14:32:10Z"}

# Check status and get results
curl -X GET https://trendifi.app/api/v1/content/ins_8f7d6e5c4b3a2910 \
  -H "Authorization: Bearer YOUR_API_KEY"

Next Steps

Now that you've made your first API request, you can explore more advanced features: