API Documentation - LiveBlogStream

API Documentation

Comprehensive guides and examples to help you integrate LiveBlogStream into your applications. Get started quickly with our detailed API reference and SDKs.

Quick Navigation

Getting Started

Quick Setup

Follow these steps to integrate LiveBlogStream into your application:

1. Get Your API Key

First, create an account and generate an API key in your dashboard.

2. Authenticate

Login to get your API credentials:

curl -X POST "https://api.liveblogstream.com/api/login.php" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "your@email.com",
    "password": "your_password",
    "appCode": "sjond9234h0njdfsanjkdoi"
  }'

3. Retrieve Feed Posts

Get posts from a feed:

curl "https://api.liveblogstream.com/api/feeds/123"

4. Create Your First Post

Post content to a feed:

curl -X POST "https://www.liveblogstream.com/api/feeds_injest.php" \
  -H "Content-Type: application/json" \
  -d '{
    "api_key": "YOUR_API_KEY",
    "user_id": 39,
    "feed_id": 7,
    "post_text": "This is a live update...",
    "ingest_type": "post",
    "postType": 1
  }'

API Reference

Base URLs

LiveBlogStream APIs are available at:

  • https://api.liveblogstream.com/api/ - API subdomain
  • https://www.liveblogstream.com/api/ - Main domain

Authentication Methods

Different APIs use different authentication methods:

  • API Key Authentication: Most APIs require an API key passed as a parameter
  • User Credentials: Login API uses email/password or email/concode/user_id
  • Master Code: Some APIs require a master code for additional security

Available Endpoints

POST /api/login.php

Login API - Authenticate users and retrieve session data

Supports two authentication methods:

  • Email + Password + App Code
  • Email + Concode + User ID
curl -X POST "https://api.liveblogstream.com/api/login.php" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@example.com",
    "password": "password123",
    "appCode": "sjond9234h0njdfsanjkdoi"
  }'

See Login API section for details

POST /api/createAPI.php

Create Feed API - Create new feeds programmatically

curl -X POST "https://www.liveblogstream.com/api/createAPI.php" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "create_feed",
    "api_key": "your_api_key",
    "user_id": "123",
    "concode": "your_concode",
    "data": {
      "feed_name": "My Feed",
      "live_blog_type": "sports-rounders"
    }
  }'

See Create Feed API section for details

GET /api/feeds.php

Feeds API - Retrieve feed posts with caching

curl "https://api.liveblogstream.com/api/feeds.php?feed_id=123"

Or use clean URLs:

curl "https://api.liveblogstream.com/api/feeds/123"

See Feed API section for details

POST /api/feeds_injest.php

Feed Ingest API - Post content to feeds and update feed settings

curl -X POST "https://www.liveblogstream.com/api/feeds_injest.php" \
  -H "Content-Type: application/json" \
  -d '{
    "api_key": "your_api_key",
    "user_id": 39,
    "feed_id": 7,
    "post_text": "Post content here",
    "ingest_type": "post"
  }'

See Feed Ingest API section for details

GET/POST /api/read_api.php

Read API - Fast access to feed posts using API keys

curl "https://api.liveblogstream.com/api/read_api.php?api_key=YOUR_KEY&company_id=123&feed_id=456"

See Read API section for details

POST /api/dashboard.php

Dashboard API - Analytics and statistics for feeds and posts

curl -X POST "https://www.liveblogstream.com/api/dashboard.php" \
  -H "Content-Type: application/json" \
  -d '{
    "action": "get_dashboard_stats",
    "api_key": "your_concode",
    "user_id": "39",
    "concode": "your_concode",
    "company_id": "43",
    "make": "sjond9234h0njdfsanjkdoi"
  }'

See Dashboard API section for details

Feed API

High-performance API endpoint for retrieving feed posts with intelligent memcached caching and database fallback. Provides clean, RESTful URLs for accessing feed content.

Overview

Lightning Fast

Sub-5ms response times with memcached caching

Secure

SQL injection prevention with prepared statements

Smart Caching

Automatic cache management with database fallback

Clean URLs

RESTful design with intuitive URL structure

Clean Architecture

Modular design with separated classes using DB_feed

Endpoints

Clean URL Structure

Get Last 20 Posts

GET https://api.liveblogstream.com/api/feeds/[feed_id]

Example:

curl "https://api.liveblogstream.com/api/feeds/123"

Get Posts Since Post ID (Pagination)

GET https://api.liveblogstream.com/api/feeds/[feed_id]/[post_id]

Example:

curl "https://api.liveblogstream.com/api/feeds/123/456"

Direct URL (Backward Compatible)

GET https://api.liveblogstream.com/api/feeds.php?feed_id=123
GET https://api.liveblogstream.com/api/feeds.php?feed_id=123&post_id=456

Parameters

Parameter Type Required Description
feed_id integer Feed identifier
post_id integer Get posts newer than this ID (for pagination)
gamestate integer Include game state and players data (set to 1)

Response Format

Success Response

{
  "status": "success",
  "feed_id": 123,
  "feed_name": "My Feed Name",
  "company_id": 456,
  "posts": [
    {
      "post_id": 789,
      "company_id": 456,
      "feed_id": 123,
      "title": "Post Title",
      "content": "Post content...",
      "excerpt": "Post excerpt...",
      "status": "published",
      "published_at": "2025-09-21T11:00:00+00:00",
      "created_at": "2025-09-21T11:00:00+00:00",
      "updated_at": "2025-09-21T11:00:00+00:00",
      "view_count": 0,
      "like_count": 0,
      "comment_count": 0
    }
  ],
  "total_posts": 1,
  "cached": true,
  "cache_warmed": false,
  "pagination": {
    "from_post_id": null,
    "has_more": false
  },
  "timestamp": "2025-09-21T11:13:08+00:00"
}

Performance

Cache Hit

< 5ms

Response time

Cache Warming

50 posts

Auto-cached on first access

Cache TTL

5 min

Cache expiry

Default Posts

20

Posts per request

JavaScript Integration

async function fetchFeedPosts(feedId, lastPostId = null) {
  let url = `https://api.liveblogstream.com/api/feeds/${feedId}`;
  if (lastPostId) {
    url = `https://api.liveblogstream.com/api/feeds/${feedId}/${lastPostId}`;
  }
  
  const response = await fetch(url);
  const data = await response.json();
  return data.status === 'success' ? data.posts : [];
}

// Usage
fetchFeedPosts(123).then(posts => {
  posts.forEach(post => console.log(post.title));
});
Performance Tip: Use post_id in the URL for incremental updates to minimize data transfer.

Feed Ingest API

Secure, production-ready endpoint for submitting feed posts with comprehensive validation, authentication, and security measures.

Overview

Enterprise Security

API key authentication with SQL injection prevention

Data Validation

Comprehensive input validation and sanitization

Business Logic

Validates relationships between companies, users, and feeds

Clean Architecture

Modular design with separated classes and concerns

Endpoint

URL

POST https://www.liveblogstream.com/api/feeds_injest.php

Note: Only POST requests are accepted. GET requests will return HTTP 405.

Authentication

Authentication is handled via API key validation:

  • API key must exist in the api_keys table
  • Status must be 'active'
  • API key must correspond to a feed the user has permission to post to

Request Types

The API supports multiple request types:

  • Post Creation (default) - Create new posts in feeds
  • Feed Settings Update - Update feed settings (type: "feed_settings")
  • Players Update - Update team players (type: "players_update")
  • Get Blog Types - Retrieve available blog types (type: "get_blog_types")
  • Get User API Keys - Retrieve user's API keys (type: "get_user_api_keys")
  • Create Feed - Create new feed (type: "create_feed")

Post Creation - Required Parameters

Parameter Type Required Description
api_key string Feed-specific API key for authentication
user_id integer User ID making the request
feed_id integer Feed ID to post to
post_text string Post content (max 5000 chars)
ingest_type string Type: post, score_update, comment, announcement, update
postType integer Numeric identifier for post type

Post Creation - Optional Parameters

Parameter Type Description
post_title string Post title (auto-generated from content if not provided)
excerpt string Short excerpt (auto-generated if not provided)
custom_fields object/string Custom fields as JSON object
template_data object/string Template-specific data as JSON
metadata object/string Additional metadata as JSON

Request Examples

Post Creation Request

curl -X POST "https://www.liveblogstream.com/api/feeds_injest.php" \
  -H "Content-Type: application/json" \
  -d '{
    "api_key": "your_api_key_here",
    "user_id": 39,
    "feed_id": 7,
    "post_text": "This is a new post to the feed!",
    "post_title": "New Post Title",
    "excerpt": "Short summary",
    "ingest_type": "post",
    "postType": 1
  }'

Feed Settings Update Request

curl -X POST "https://www.liveblogstream.com/api/feeds_injest.php" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "feed_settings",
    "api_key": "your_api_key_here",
    "user_id": 39,
    "feed_id": 7,
    "data": {
      "feed_name": "Updated Feed Name",
      "description": "Updated description",
      "status": "active"
    }
  }'

Response Examples

Post Creation Success (HTTP 200)

{
  "status": "success",
  "message": "Post created successfully",
  "post_id": "12",
  "feed_id": 7,
  "user_id": 39,
  "ingest_type": "post",
  "timestamp": "2025-09-25T15:09:29+00:00"
}

Feed Settings Update Success (HTTP 200)

{
  "status": "success",
  "message": "Feed settings updated successfully",
  "feed_id": 7,
  "user_id": 39,
  "settings_updated": true,
  "timestamp": "2025-09-25T15:09:29+00:00"
}

Validation Error (HTTP 400)

{
  "status": "error",
  "message": "Missing required field: content"
}

Authentication Error (HTTP 401)

{
  "status": "error",
  "message": "Invalid API key"
}

HTTP Status Codes

200

Success

Post created successfully

400

Bad Request

Validation errors, missing fields

401

Unauthorized

Invalid or inactive API key

405

Method Not Allowed

Only POST requests accepted

500

Internal Server Error

Database or system errors

Security Features

SQL Injection Prevention

All queries use prepared statements with parameter binding

Input Sanitization

Removes control characters and validates data types

API Key Validation

Comprehensive authentication with company matching

XSS Protection

Content sanitization and security headers

JavaScript Integration

async function submitFeedPost(apiKey, userId, feedId, postText) {
  try {
    const response = await fetch('https://www.liveblogstream.com/api/feeds_injest.php', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        api_key: apiKey,
        user_id: userId,
        feed_id: feedId,
        post_text: postText,
        ingest_type: 'post',
        postType: 1
      })
    });
    
    const data = await response.json();
    
    if (data.status === 'success') {
      console.log(`Post created with ID: ${data.post_id}`);
      return data.post_id;
    } else {
      throw new Error(data.message);
    }
  } catch (error) {
    console.error('Error submitting post:', error.message);
    throw error;
  }
}

// Usage example
submitFeedPost('your_api_key', 39, 7, 'Your post content')
  .then(postId => console.log('Success!', postId))
  .catch(error => console.error('Failed:', error.message));

PHP Integration

<?php
function submitFeedPost($apiKey, $userId, $feedId, $postText) {
    $url = 'https://www.liveblogstream.com/api/feeds_injest.php';
    
    $data = [
        'api_key' => $apiKey,
        'user_id' => $userId,
        'feed_id' => $feedId,
        'post_text' => $postText,
        'ingest_type' => 'post',
        'postType' => 1
    ];
    
    $ch = curl_init();
    curl_setopt_array($ch, [
        CURLOPT_URL => $url,
        CURLOPT_POST => true,
        CURLOPT_POSTFIELDS => json_encode($data),
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HTTPHEADER => [
            'Content-Type: application/json',
            'Content-Length: ' . strlen(json_encode($data))
        ]
    ]);
    
    $response = curl_exec($ch);
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);
    
    $result = json_decode($response, true);
    
    if ($httpCode === 200 && $result['status'] === 'success') {
        return $result['post_id'];
    } else {
        throw new Exception($result['message'] ?? 'Unknown error');
    }
}

// Usage example
try {
    $postId = submitFeedPost('your_api_key', 39, 7, 'Your post content');
    echo "Post created with ID: {$postId}";
} catch (Exception $e) {
    echo "Error: " . $e->getMessage();
}
?>
Important: Always validate data on your client side before submitting. The API performs server-side validation but client-side validation improves user experience.
Rate Limiting: Consider implementing rate limiting on your client side to prevent overwhelming the API with requests.

Login API

Authenticate users and retrieve session data for mobile applications and web integrations.

Endpoint

URL

POST https://api.liveblogstream.com/api/login.php

Authentication Methods

Method 1: Email + Password + App Code

curl -X POST "https://api.liveblogstream.com/api/login.php" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@example.com",
    "password": "userpassword123",
    "appCode": "sjond9234h0njdfsanjkdoi"
  }'

Method 2: Email + Concode + User ID

curl -X POST "https://api.liveblogstream.com/api/login.php" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@example.com",
    "concode": "AbCdEfGhIjKlMnOp",
    "user_id": 123
  }'

Success Response

{
  "success": true,
  "timestamp": "2024-01-15 10:30:00",
  "data": {
    "user_id": 123,
    "company_id": 456,
    "first_name": "John",
    "last_name": "Doe",
    "email": "user@example.com",
    "business_name": "Example Company Ltd",
    "concode": "AbCdEfGhIjKlMnOp",
    "settings": {
      "timezone": "Europe/Dublin",
      "language": "en",
      "live_blog_types": [...]
    },
    "feeds": [...]
  }
}

Create Feed API

Create new feeds programmatically with full configuration options, including support for Sports Rounders and other feed types.

Endpoint

URL

POST https://www.liveblogstream.com/api/createAPI.php

Authentication

Requires API key, user ID, and concode (retrieved from login):

  • api_key - User's API key (from localStorage)
  • user_id - User's ID (from localStorage)
  • concode - User's connection code (from localStorage)

Request Example

curl -X POST "https://www.liveblogstream.com/api/createAPI.php" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "create_feed",
    "api_key": "your_api_key",
    "user_id": "123",
    "concode": "your_concode",
    "data": {
      "feed_name": "Dublin vs Cork Rounders Championship",
      "live_blog_type": "sports-rounders",
      "feed_type": "website",
      "home_team_name": "Dublin Rounders",
      "away_team_name": "Cork Rounders",
      "competition_name": "Championship Final",
      "event_date": "2025-10-15",
      "event_time": "15:00",
      "visibility": "public",
      "status": "active"
    }
  }'

Valid Blog Types

Sports: sports-rounders, sports-gaelicfootball, sports-hurling, sports-soccer, sports-rugby, sports-basketball, sports-cricket, sports-general

General: conference, breaking-news, event-coverage, entertainment, other

Success Response

{
  "success": true,
  "message": "Feed created successfully",
  "feed_id": "123",
  "feed_name": "Dublin vs Cork Rounders Championship",
  "created_at": "2025-10-13 12:00:00",
  "timestamp": "2025-10-13T12:00:00+00:00"
}

Read API

Fast access to feed posts using API keys with Memcached caching for optimal performance.

Endpoint

URL

GET/POST https://api.liveblogstream.com/api/read_api.php

Required Parameters

  • api_key - Your API key for authentication
  • company_id - The company ID that owns the feed
  • feed_id - The specific feed ID to read posts from

Optional Parameters

  • last_post_id - Return posts newer than this post ID (for pagination)

Request Examples

Get Last 20 Posts

curl "https://api.liveblogstream.com/api/read_api.php?api_key=YOUR_KEY&company_id=123&feed_id=456"

Get Posts Since Post ID

curl "https://api.liveblogstream.com/api/read_api.php?api_key=YOUR_KEY&company_id=123&feed_id=456&last_post_id=789"

Success Response

{
  "status": "success",
  "api_key": "your_api_key_here",
  "feed_id": 123,
  "company_id": 456,
  "posts": [...],
  "total_posts": 1,
  "cached": true,
  "cache_warmed": false,
  "timestamp": "2025-09-21T10:30:00+00:00"
}

Dashboard API

Analytics and statistics for feeds, posts, and user engagement. Tracks views, sessions, and engagement metrics.

Endpoint

URL

POST https://www.liveblogstream.com/api/dashboard.php

Authentication

All requests require:

  • action - Action type (see available actions below)
  • api_key - User's concode
  • user_id - User ID
  • concode - User's concode
  • company_id - Company ID
  • make - Master code (must be "sjond9234h0njdfsanjkdoi")

Available Actions

  • get_dashboard_stats - Get main dashboard statistics (4 key metrics)
  • get_top_posts - Get top N most viewed posts (default: 5)
  • get_top_feeds - Get top N feeds by unique views (default: 5)
  • get_engagement_metrics - Get feed engagement metrics
  • get_top_posters - Get top N users who post the most (default: 3)

Request Example

curl -X POST "https://www.liveblogstream.com/api/dashboard.php" \
  -H "Content-Type: application/json" \
  -d '{
    "action": "get_dashboard_stats",
    "api_key": "9dIvPhN6cqxIVFHz",
    "user_id": "39",
    "concode": "9dIvPhN6cqxIVFHz",
    "company_id": "43",
    "make": "sjond9234h0njdfsanjkdoi"
  }'

Success Response

{
  "success": true,
  "timestamp": "2025-10-19T13:01:18+00:00",
  "stats": {
    "total_feeds": 15,
    "total_views": 45230,
    "unique_viewers": 3240,
    "total_posts": 1280
  }
}

Players API

Manage home and away team players for feeds, including their names, positions, jersey numbers, and display order.

Retrieve Players

Players are automatically included when calling the Feeds API:

GET https://api.liveblogstream.com/api/feeds/{feed_id}?gamestate=1

Update Players

Update players via the Feed Ingest API with type "players_update":

Endpoint

POST https://www.liveblogstream.com/api/feeds_injest.php

Request Example

curl -X POST "https://www.liveblogstream.com/api/feeds_injest.php" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "players_update",
    "api_key": "your_api_key",
    "user_id": 123,
    "feed_id": 456,
    "data": {
      "home_players": [
        {
          "player_name": "John Doe",
          "position": "Forward",
          "display_order": 1,
          "jersey_number": "10",
          "status": "active"
        }
      ],
      "away_players": [
        {
          "player_name": "Jane Smith",
          "position": "Goalkeeper",
          "display_order": 1,
          "jersey_number": "1",
          "status": "active"
        }
      ]
    }
  }'

Success Response

{
  "success": true,
  "status": "success",
  "message": "Players updated successfully",
  "data": {
    "feed_id": 456,
    "players_updated": true,
    "home_players_count": 1,
    "away_players_count": 1
  }
}

SDKs & Libraries

Use our official SDKs to integrate LiveBlogStream into your applications quickly and easily.

JavaScript

npm install @liveblogstream/js-sdk
import { LiveBlogStream } from '@liveblogstream/js-sdk';

const lbs = new LiveBlogStream('YOUR_API_KEY');
const feeds = await lbs.feeds.list();

Python

pip install liveblogstream
import liveblogstream

lbs = liveblogstream.Client('YOUR_API_KEY')
feeds = lbs.feeds.list()

PHP

composer require liveblogstream/php-sdk
$lbs = new LiveBlogStream\Client('YOUR_API_KEY');
$feeds = $lbs->feeds->list();

Examples

Common integration patterns and use cases for LiveBlogStream.

WordPress Integration

Add this to your WordPress theme to display live updates:

<?php
$api_key = 'YOUR_API_KEY';
$feed_id = 'YOUR_FEED_ID';

$response = wp_remote_get(
  "https://api.liveblogstream.com/api/feeds/{$feed_id}/posts",
  array(
    'headers' => array(
      'Authorization' => "Bearer {$api_key}"
    )
  )
);

$posts = json_decode(wp_remote_retrieve_body($response), true);

foreach ($posts['data'] as $post) {
  echo "<div class='live-post'>";
  echo "<h3>{$post['title']}</h3>";
  echo "<p>{$post['content']}</p>";
  echo "</div>";
}
?>

React Component

Create a React component for live updates:

import React, { useState, useEffect } from 'react';
import { LiveBlogStream } from '@liveblogstream/js-sdk';

function LiveBlog({ feedId, apiKey }) {
  const [posts, setPosts] = useState([]);
  const lbs = new LiveBlogStream(apiKey);

  useEffect(() => {
    const fetchPosts = async () => {
      const response = await lbs.feeds.getPosts(feedId);
      setPosts(response.data);
    };

    fetchPosts();
    const interval = setInterval(fetchPosts, 30000); // Update every 30s
    
    return () => clearInterval(interval);
  }, [feedId, apiKey]);

  return (
    <div className="live-blog">
      {posts.map(post => (
        <div key={post.id} className="post">
          <h3>{post.title}</h3>
          <p>{post.content}</p>
        </div>
      ))}
    </div>
  );
}

Webhooks

Webhooks allow you to receive real-time notifications when events occur in your feeds.

Setting Up Webhooks

Configure your webhook endpoint to receive notifications:

POST https://your-server.com/webhooks/liveblogstream
Content-Type: application/json
X-LBS-Signature: signature

Webhook Events

Available webhook events:

  • post.created - New post created
  • post.updated - Post updated
  • post.deleted - Post deleted
  • feed.created - New feed created
  • feed.updated - Feed updated

Support

Need help with your integration? We're here to help!

Documentation

Comprehensive guides and tutorials for all features.

Community

Join our developer community for discussions and help.

Contact

Get in touch with our support team for assistance.

Ready to Get Started?

Join thousands of developers who are already using LiveBlogStream to power their live content.