Forgot Password     Sign Up NOW! Sign Up Using Facebook
Line.com
Home    Cappers    Sportsbook    Forum    Help    Affiliates


StarterAdvancedElite
Complete Coverage
What's this?
NFL, NCAAF, NBA,
NCAAB, MLB, NHL
NFL, NCAAF, NBA,
NCAAB, MLB, NHL
All Sports
Partial Coverage
What's this?
None All Other Sports None
Annual (Save 30%) $2,100
7-Day Free Trial
$3,360
7-Day Free Trial
$21,000
Contact Us
Monthly $250/mo recurring
7-Day Free Trial
$400/mo recurring
7-Day Free Trial
$2,500/mo recurring
Contact Us
* Please note that your feed may take up to 24 hours to be set up, so your 7-day free trial could be cut as short as a 6-day free trial. You will be emailed when your feed is activated.

Documentation - Input

Variable NameDescription
uid
required
Type: integer
Tells us who you are, so we can give you permission and customize your call to your specific needs.
key
required
Type: string
This string authorizes your usage of the api. DO NOT give this key out to anyone. If you suspect that your key has been compromised, please contact us ASAP.
sports
optional
Type: string
Default: NULL
If specified, your result will be limited to the sport(s) and optionally league(s) specified.

Include multiple string separated by commas. Separate sporttype and sportsubtype by hyphens.

Examples:
sports=basketball - shows all Basketball games.
sports=basketball-nba - shows all NBA Basketball games.
sports=basketball,baseball-mlb,soccer - show all Basketball and Soccer games, and all MLB Baseball games.
graded
optional
Type: integer
Default: 0
Specifies whether to show games that have been graded, games that have yet to be graded, or both.

0 - Ungraded games only.
1 - Graded games only.
2 - All games.
odd_type
optional
Type: char
Default: a
Specify whether you want odds displayed in American or Decimal odds.

a - Default. American.
d - Decimal.
full_call
optional
Type: integer
Default: 0
By default, our feed only pushes the changes that have been made since your last call. If you set this value to "1" then you'll get the entire feed, not just the changes. As this option greatly increases the tax on our server and is usually unnecessary, we ask that you use this option a maximum of once per hour.

Documentation - Output

Output is a standards compliant XML file.
PathDescription
lines->game->id
Type: integer
The unique identifier for each game.
lines->game->header
Type: string
A textual description of the game.
lines->game->sporttype
Type: string
The general description of the sport. Eg 'Baseball'
lines->game->sportsubtype
Type: string
The more specific description of the sport. In many cases, this is also known as the 'league'. Eg 'MLB'
lines->game->gamedate
Type: datetime
The start time for the game - presented as YYYY-MM-DD HH:ii:ss. Eg '2011-04-05 19:05:00'
lines->game->last_update
Type: datetime
The last time this line was updated - presented as YYYY-MM-DD HH:ii:ss. Eg '2011-04-05 19:05:00'
lines->game->team1->rotnum
Type: integer
The rotation number for the first team. Eg '706'
lines->game->team1->name
Type: string
The team name for the first team. Eg 'Atlanta Braves'
lines->game->team1->pitcher
Type: string
The pitcher for the first team, if applicable. Eg 'Derek Lowe'
lines->game->team2->rotnum
Type: integer
The rotation number for the first team. Eg '707'
lines->game->team2->name
Type: string
The team name for the second team. Eg 'Philadelphia Phillies'
lines->game->team2->pitcher
Type: string
The pitcher for the second team, if applicable. Eg 'Roy Oswalt'
lines->game->line->periodnum
Type: integer
The integer representation of perioddesc.
lines->game->line->perioddesc
Type: string
The period for which the lines refer. Eg '1st Half'
lines->game->line->wagercutoff
Type: datetime
The last time that a bet will be accepted - presented as YYYY-MM-DD HH:ii:ss. Eg '2011-04-05 19:05:00'
lines->game->line->money->team1
Type: integer
Team1 moneyline, if applicable. Eg -145
lines->game->line->money->team2
Type: integer
Team2 moneyline, if applicable. Eg 128
lines->game->line->money->drawline
Type: integer
The "draw" payout, if applicable. Eg 128
lines->game->line->spread->points
Type: float
The spread, if applicable, with respect to team 2. Eg '-3.5' means that team 2 is favored by 3.5.
lines->game->line->spread->team1
Type: integer
The team 1 line for the spread, if applicable. Eg '-110'
lines->game->line->spread->team2
Type: integer
The team 2 line for the spread, if applicable. Eg '-110'
lines->game->line->total->points
Type: float
The game's total, if applicable. Eg '9.5'
lines->game->line->total->over
Type: integer
The line for the 'over', if applicable. Eg '-120'
lines->game->line->total->under
Type: integer
The line for the 'under', if applicable. Eg '100'
lines->game->line->teamtotal->team1->points
Type: integer
The line for the 'under', if applicable. Eg '100'
lines->game->line->teamtotal->team1->over
Type: integer
The line for the 'under', if applicable. Eg '100'
lines->game->line->teamtotal->team1->under
Type: integer
The line for the 'under', if applicable. Eg '100'
lines->game->line->teamtotal->team2->points
Type: integer
The line for the 'under', if applicable. Eg '100'
lines->game->line->teamtotal->team2->over
Type: integer
The line for the 'under', if applicable. Eg '100'
lines->game->line->teamtotal->team2->under
Type: integer
The line for the 'under', if applicable. Eg '100'
lines->game->line->score->team1
Type: integer
The final score for team 1, if applicable. Eg '3'
lines->game->line->score->team2
Type: integer
The final score for team 2, if applicable. Eg '4'
lines->game->line->score->winner
Type: string
The name of the winning team, if applicable. Eg. 'Atlanta Braves'


Document structure:
<lines>
    <game>
        <id>VAR</id>
        <header>VAR</header>
        <sporttype>VAR</sporttype>
        <sportsubtype>VAR</sportsubtype>
        <gamedate>VAR</gamedate>
        <last_update>VAR</last_update>
        <team1>
            <rotnum>VAR</rotnum>
            <name>VAR</name>
            <pitcher>VAR</pitcher>
        </team1>
        <team2>
            <rotnum>VAR</rotnum>
            <name>VAR</name>
            <pitcher>VAR</pitcher>
        </team2>
        <line>
            <periodnum>VAR</periodnum>
            <perioddesc>VAR</perioddesc>
            <wagercutoff>VAR</wagercutoff>
            <money>
                <team1>VAR</team1>
                <team2>VAR</team2>
            </money>
            <spread>
                <points>VAR</points>
                <team1>VAR</team1>
                <team2>VAR</team2>
            </spread>
            <total>
                <points>VAR</points>
                <over>VAR</over>
                <under>VAR</under>
            </total>
            <teamtotal>
                <team1>
                    <points>VAR</points>
                    <over>VAR</over>
                    <under>VAR</under>
                </team1>
                <team2>
                    <points>VAR</points>
                    <over>VAR</over>
                    <under>VAR</under>
                </team2>
            </teamtotal>
            <score>
                <team1>VAR</team1>
                <team2>VAR</team2>
                <winner>VAR</winner>
            </score>
        </line>
    </game>
    <game>...</game>
    .
    .
    .
</lines>

Example Calls

http://api.line.com/lines.php?uid=UID&key=KEY
Description: Standard call with no options.
Output: Example 1 - Generated Dec 28th, 2011 at 5:00PM EST
http://api.line.com/lines.php?uid=UID&key=KEY&sports=Basketball-NBA,Basketball-NCAA&graded=1
Description: Get all lines for NBA and NCAA basketball games that have been graded.
Output: Example 2 - Generated Dec 28th, 2011 at 5:09PM EST
http://api.line.com/lines.php?uid=UID&key=KEY&odd_type=d
Description: Have lines output as decimal odds.
Output: Example 3 - Generated Dec 28th, 2011 at 5:11PM EST

Example Code

This example code uses PHP and MySQL, but could be easily adapted to other languages and/or databases.

<?php
/*
Author: Patrick Griffith - Line.com Inc.
License: GPL
Tested with: PHP v5.3.4 - MySQL v5.0.7 - Apache v2.2.17 - Mac OS X v10.6.7

For this example we assume that we are running an online sportsbook.
We need to get and update future lines for our clients to wager on.
We need to get past lines and scores to grade our clients' wagers.
*/

//get your database credentials
require_once('database.php');

//establish your connection
$mysqli = new mysqli($db_host, $db_user, $db_pass, $db_name);

//set the variables which you will send to the api call
$data = array();
$data['uid'] = 'YOUR_UID';
$data[key'] = 'YOUR_KEY';
$data['graded'] = 2; //get both graded and ungraded games
$data['sports'] = 'Baseball-MLB,Basketball-NCAA,Basketball-NBA,Football-NCAA,Football-NFL,Hockey-NHL';

$target_url = 'http://api.line.com/lines.php';
	
$response = http($target = $target_url,'','GET',$data,EXCL_HEAD);
$content = $response['FILE'];
if($content == false)
{
    echo 'An error has occured.';
    exit();
}
else
{
    //use the simplexml library to do wonderous things
    $xml = simplexml_load_string($content);
    $lines = array();
    foreach ($xml->lines->game as $game)
    {
        
        if($game->line->score->winner)
        {
            //the game has been graded, so let's process all of the bets on the game
        }
        else
        {
            //the game hasn't been graded, so let's update the lines
            //you could do various checks like checking to make sure te game hasn't already started, 
                //but as long as you don't pass full_call = 1 then we do those checks for you on our side

            //first let's check to see if the game is already in our datbase.
            $result = $mysqli->query("SELECT id FROM games WHERE id = ".$game->id);
            if($result->num_rows == 0)
            {
                //the game isn't in our databse, so let's insert it
                $mysql->real_query("INSERT INTO lines VALUES(
                    '$game->id',
                    '$game->sporttype',
                    '$game->sportsubtype',
                    '$game->gamedate',
                    '$game->last_update',
                    '$game->team1->rotnum',
                    '$game->team1->name',
                    '$game->team1->pitcher',
                    '$game->team2->rotnum',
                    '$game->team2->name',
                    '$game->team2->pitcher',
                    '".$game->line->periodnum."',
                    '".$game->line->perioddesc."',
                    '".$game->line->wagercutoff."',
                    '".$game->line->money->team1."',
                    '".$game->line->money->team2."',
                    '".$game->line->spread->points."',
                    '".$game->line->spread->team1."',
                    '".$game->line->spread->team2."',
                    '".$game->line->total->points."',
                    '".$game->line->total->team1."',
                    '".$game->line->total->team2."',
                    '".$game->line->score->team1."',
                    '".$game->line->score->team2."',
                    '".$game->line->score->winner."'
                    
                    
                )");
            }
            else
            {
                //we already have the game, so let's just update the lines
                $mysql->real_query("UPDATE lines SET 
                    sporttype = '$game->sporttype',
                    sportsubtype = '$game->sportsubtype',
                    gamedate = '$game->gamedate',
                    last_update = '$game->last_update',
                    team1rotnum = '$game->team1->rotnum',
                    team1name = '$game->team1->name',
                    team1pitcher = '$game->team1->pitcher',
                    team2rotnum = '$game->team2->rotnum',
                    team2'$game->team2->name',
                    '$game->team2->pitcher',
                    '".$game->line->periodnum."',
                    '".$game->line->perioddesc."',
                    '".$game->line->wagercutoff."',
                    '".$game->line->money->team1."',
                    '".$game->line->money->team2."',
                    '".$game->line->spread->points."',
                    '".$game->line->spread->team1."',
                    '".$game->line->spread->team2."',
                    '".$game->line->total->points."',
                    '".$game->line->total->team1."',
                    '".$game->line->total->team2."',
                    '".$game->line->score->team1."',
                    '".$game->line->score->team2."',
                    '".$game->line->score->winner."'

                WHERE id = ".$game->id);
            }

        }

    }
}

/*
Some additional notes:
- You should always secure data before inserting it into your database, even if it's from a trusted source.
    - mysqli::real_escape_string() may be enough or you may wish to further protect yourself.
    - This code does not include such security measures.
- The function 'http' was taken from Webbots, Spiders, and Screen Scrapers: A Guide to Developing
    Internet Agents with PHP/CURL by Michael Schrenk
    - I HIGHLY recommend this book for those just getting started with PHP/cURL.
*/


?>            


What is "Complete" Coverage?

Complete coverage gives you ALL odds plus ALL scores regardless of whether or not a line.com user has selected a particular game.


What is "Partial" Coverage?

Partial coverage gives you ALL odds plus scores of every game which was picked by at least one line.com user, including quarters, halves, etc.


Legal Disclaimers

All data and example code is provided as is, without warranty. While we make every effort to assure that all of our data is 100% accurate, we will not be held liable for damages should any errors occur.

Unless written permission is given to you by Patrick Griffith of line.com, your data feed gives you the right to use this data on no more than one (1) website. Should you choose to redistribute our feed to other websites without our permission this will be considered theft and you will be held liable for the total amount stolen.