API Getting Star Information

Hi, :smile:

I am wondering if there is any API documentation - I’d like to export my star details to excel or a database but can’t find any information on how to use the API key, or javascript console to do so… Would rather not manually type them out, :smile:
Specifically I am wanting the natural resources information but just generally hoping to get some direction on where to point API requests and what is available, :smile:
Thanks for any help!

1 Like

I managed to copy the galaxy screen to excel and can reverse engineer the natural resources from the upgrade costs, but would still appreciate any direction on using the API, :smile:


Hi Fleck, sorry to take a while to get back to you and make you work it out yourself.

@Dysp and I are working on an improved method for retrieving a players scanned data at the moment. The API key is a method for a third party app to retrieve a games data without required an auth cookie.

I haven’t documented it at all yet because I’m not entirely sure everything is right yet.


No problem - thanks for the response! :smile:

I’d definitely be interested in seeing some of the functionality offered by an API. Especially seeing how it could play into some applications that could help guide Empire development and all the extras that come with it.

Sorry for the late commenting. The current api seems to work very well. I’ve been able to put up some basic statistic collection, team stats and map replayer for the NP2. It’s pretty basic, but I’m working to add more things and improve the existing.


The current API gives all the player, star, fleet, science etc stats for the current tick in an easy to read json.

There are few things I wan to change to the API stuff before more people have access to it.

I want to make sure each app using the API has a its own key so I can keep track of what app is doing what.

I also want to mail the players when a code is generated for them in their game.

An API is very exciting to me. Any chance it’s OData?
(Neptune’s Pride is awesome, btw. Thank you for building it so I can enjoy.)

What is o data

I would love to hear whenever an official API comes out, and I’d love to help with testing.

I wrote a PHP client based on reverse engineering the game’s interactions with the server and would love to update it to support the official API and usage of keys instead of credentials.

Open Data Protocol or OData is a REST API specification developed by Microsoft. There was also GData that is a now deprecated competitor. There is also JSON API which is work-in-progress driven by the Rails/Ember community. I think they all represent best practices, but none of them are widely accepted standards unless you’re working with specific technologies.

While self describing protocols are cool, good documentation will serve everybody’s needs.

Oh thanks @wrenoud

Right now there is only one request which is for scanning data. There will never been an API for giving orders for ships and fleets because I don’t bots playing in games where other players expect humans they can negotiate with.

I will try and make the fixes I want to make next week then document the request.

Would you ever consider allowing this (and therefore having an API for it) as an option in user created games (and then making it clear before the game starts so there’s no surprises)?

My main motivation for this is that AI in NP was a fact of life when I last played last year (been too busy to play lately unfortunately, but hope to be back soon!) and the built in AI was never particularly good. This is especially painful in the late game for large games, or the poor unfortunate person whose neighbours all quit early. Having an API in games that allow this won’t solve this, of course, but it does mean people could at least try (I’d certainly be interested in it) and maybe someone will come up with something worthwhile.

A secondary motivation is that it could be a great metagame. It certainly would keep me coming back more regularly than I have done. Obviously this isn’t the point of the game, so of course I understand if this isn’t something you’re interested in. More an aside to the previous point.

Now, I haven’t tried out the new AI mentioned here Smarter AI yet, nor have I seen any other changes you may have made since I last played, so maybe all of the above is moot now, in which case maybe ignore me :smile: I’ll hopefully find out soon for myself.

Hey @Fleck, I think I have exactly what you need. A querying API for accessing public game data. You don’t have to deploy/configure/do anything, just look here. It’s harmless as it shows exactly what one would see when watching someone else’s game.

Hey @rubberband I didnt mean to ignore you when you posed a few weeks ago.

Its not completely crazy that we have some kind of “metagame” of building and AI for the game, and it would be fun to perhaps even incorporate it into the main game.

Imagine a small group of programmers all build and AI for the game, and when a player drop Triton chooses an AI to take over. Triton could call a third part service to request and AI “think”. At the end of the game players could vote on if the AI was fun to play against!


No worries!

I’ll look forward to it if you decide to incorporate it in some way. In the meantime, is there any word on the data API? I would love access but can’t find much on the forums (except Qwerty’s API; although I’d like to be able to access my own star information too).

It’s possible to enter username and password, it’s using a dummy account after all, but I didn’t expose this feature publicly so people don’t think I want to steal from them. If you want I will write you in a PM how to do that, but you must sign two copies, one black on white and second inverted, that you understand that you are giving your credentials to a script hosted on my server.

Thinking of that, it would be great if there were two passwords for one account, the other one would be for teammates or friends with limited functionality, so you could only make turns, but not: join/leave games, change user details, buy badges…

PS: using real credentials, it’s, of course, possible to read one’s ships and tech information as well :blush:, heck it’s also possible to read messages and notifications.
It’s read only though.

I see you can now generate API keys - is there documentation for this anywhere? I’d love to play around with this!

Hope a bump is OK on this thread.

I’d also be interested in seeing some API documentation, but couldn’t find a more recent thread with anything in… not even full documentation, maybe just some example endpoints and parameters, am sure I can work out most of the rest for myself…

Also the option to allow orders to be given via the API, and an option to allow “AIs” in user created games would be great. With enough people interested, you may end up with “all AI” games competing to see who has the strongest AI…