AstroBin API documentation (beta)

Note: API documentation is only available in English.

Step 1 →

Get your API Key for free!

Step 2 →

Perform queries:

  • Search images
  • Get image data
  • Filter and order

Step 3

Build amazing apps!

  • Websites
  • Desktop applications
  • Mobile apps for any platform

In short.

AstroBin implements a basic set of RESTful APIs. Currently the APIs are read-only, and they allow you to get data about images, and perform some basic searches.

Using AstroBin's APIs you will be able to create your own website, desktop application of mobile app that can use some content from AstroBin.

Some possibilities:

  • A web widget that displays the recent images of a certain user.
  • A web widget that displays the Image of the day.
  • An iPhone/Android/other app for browsing AstroBin effectively.
  • ... and many more!

Availability and limitations.

AstroBin's API currently are limited to retrieving basic information and perform simple search on images.

The supported response types are XML and JSON.

How to get started.

The first thing you will need is an API Key. Please use the API Key request form to get one.

How to display images.

If you get an Image object using the APIs, it will have a filename and original_ext field. To display the image, you must append them to http://cdn.astrobin.com/images/.

This will give you the full size image. If you want a smaller version, you can append _resized to the filename.

For a thumbnail, append _thumb and use the .png extension.

Fair use.

Using the APIs to mercilessly scrape all the available content is not allowed. Failure to respect this requirement will result in the permanent revocation of one's API Key.

Please read the API section in the Terms of Service.

Some examples

All examples omit the base URL /api/v1 and the api_key, api_secret and format URL arguments, for brevity.
You must add them in real usage, e.g.:
http://astrobin.com/api/v1/.../?...&api_key=123456790&api_secret=0987654321&format=json

Remember that you can combine most of these queries, so feel free to experiment!

Get a single image by ID: image/1234/
Search by subject: image/?subject=M31
Search by user: image/?user=siovene
Search by case-insensitive, partial title: image/?title__icontains=andromeda
Search by case-insensitive, partial description: image/?description__icontains=wind
Other useful partial tricks: __startswith= __endswith= __contains= __istartswith= __iendswith=
Search by upload date range: image/?uploaded__gte=2012-04-10%200:00:00&uploaded__lt=2012-04-11%200:00:00
Comparison operators: __lt= __lte= __gt= __gte=
Get today's Image Of The Day: imageoftheday/?limit=1
Get yesterdays's Image Of The Day: imageoftheday/?limit=1&offset=1