Our Lottery Numbers API provides you with the recommended pool of lottery numbers for the next draw based on the same algorithm as our award-winning & proven lottery software.
After retrieving our recommended pool of lottery numbers, you can easily generate your tickets based on this pool of recommended numbers. This allows you to easily develop your own lottery software, lottery app or lottery website where you can offer lottery tickets with a greater chance of winning!
Please note that the API key shown in the examples below is not valid. You must replace the API key value with your API key or please sign up for an API account if you do not have one.
If you do not want to generate your tickets, you can simply use our lottery tickets API to retrieve the lottery tickets.
The base URL for our recommended lottery numbers API is:
https://www.magayo.com/api/numbers.php
Parameter
Description
Valid Values
api_key
Your assigned API key. This parameter is required.
Your assigned API key value.
game
The lottery game for which you would like to retrieve the recommended numbers. This parameter is required.
Please refer to the list of supported games and values to use.
format
The API response format. This parameter is optional and the default format is JSON.
json or xml
Examples:
To retrieve the recommended numbers for USA Powerball game in JSON format:
https://www.magayo.com/api/numbers.php?api_key=hXJDjsp8I6RY&game=us_powerball
To retrieve the recommended numbers for EuroMillions game in XML format:
https://www.magayo.com/api/info.php?api_key=hXJDjsp8I6RY&game=euromillions&format=xml
View sample PHP snippets on how to use our lottery numbers APIs
Element
Description
Value
error
Error code. Value greater than zero indicates an error.
The list of error codes are listed below.
main
The pool of recommended main balls to play separated by commas for Lotto & Powerball type games.
Example: 1,2,3,5,7,8,9,10,12,13,18,23,27,28,29,32,36,39
bonus
The pool of recommended bonus balls to play separated by commas for Lotto & Powerball type games.
Example: 2,3,4,5,6,8
digit1
The pool of recommended digits in the 1st position to play separated by commas for Pick 2/3/4/5/6 type games.
Example: 0,2,3,5,6,8,9
digit2
The pool of recommended digits in the 1st position to play separated by commas for Pick 2/3/4/5/6 type games.
Example: 1,3,4,5,8
digit3
The pool of recommended digits in the 1st position to play separated by commas for Pick 3/4/5/6 type games.
Example: 0,1,2,6,7,9
digit4
The pool of recommended digits in the 1st position to play separated by commas for Pick 4/5/6 type games.
Example: 1,2,3,6,8
digit5
The pool of recommended digits in the 1st position to play separated by commas for Pick 5/6 type games.
Example: 0,1,2,3,5,6,7,8
digit6
The pool of recommended digits in the 1st position to play separated by commas for Pick 6 type games.
Example: 2,3,4,6,7,9
improved
The improved chances of winning in percentage based on the recommended numbers.
Example: 63
For Bosnia and Herzegovina SuperLOTO, bonus ball "01" = "BLACK" and "02" = "RED".
For Jamaica Cash Pot, bonus ball "01" = "GOLD" and "02" = "WHITE".
Example of response in JSON format:
{
"error" : 0,
"main" : "1,2,3,5,7,8,9,10,12,13,18,23,27,28,29,32,36,39",
"bonus" : "2,3,4,5,6,8",
"digit1" : "",
"digit2" : "",
"digit3" : "",
"digit4" : "",
"digit5" : "",
"digit6" : "",
"improved" : 63
}
Error Code
Description
Action or Resolution
0
No error.
Proceed to process the recommended numbers retrieved.
100
API key not provided.
Please add the api_key parameter in your API request.
101
Invalid API key.
Please check & correct the value of the api_key parameter in your API request.
102
API key not found.
Please check & correct the value of the api_key parameter in your API request.
200
Game not provided.
Please add the game parameter in your API request.
201
Invalid game.
Please check & correct the value of the game parameter in your API request.
202
Game not found.
Please check & correct the value of the game parameter in your API request.
300
Account suspended.
You have violated our terms of use.
"I played the recommendation... and I won the first prize!"
See the winning lottery tickets of magayo Lotto users