AnalogDB

the collection of film photography

Overview

This document outlines the AnalogDB API. This API provides film photographs and metadata in JSON form as a REST-style service. The API is open-source and available on github. The swagger docs are available here.

The AnalogDB project is currently under development and subject to change. All film pictures are scrapped from reddit. All credit goes to the original photographers.

Use the following URI to access the endpoints: https://api.analogdb.com/v1

Rate Limiting

The Analogdb API currently places a limit of 60 requests/min. Current rate limit status is returned in response headers after each request including remaining requests and reset time in unix epoch seconds.

x-ratelimit-limit: 60
x-ratelimit-remaining: 59
x-ratelimit-reset: 1691712960

Pagination

All collection endpoints are paginated with keyset pagination. By default, 20 records are returned per page. Pagination can be controlled with the following parameters:

paramdescription
page_sizeset the number of records to return on each page (default 20, maximum 200)
page_idrequest a specific page of results. Each request returns a next_page_id that can be used to access the next page of results
curl https://api.analogdb.com/posts?page_size=10&page_id=774

Resources

Image

The image resource contains the image URL as well as resolution and dimensions.

field nametypedescription
urlstringlink to image
resolutionstringlow, medium, high, raw
widthintegerwidth of image in pixels
heightintegerheight of image in pixels

Color

The color resource represents primary colors extracted from images and corresponding percentages.

field nametypedescription
cssstringCSS color name (e.g., dimgray)
hexstringhex color code (e.g., #837d5c)
htmlstringHTML color name (e.g., gray)
percentnumberpercent of image this color represents

Keyword

The keyword resource contains keywords scraped from post along with relevance score.

field nametypedescription
wordstringdetected keyword in image
weightnumberrelevance of keyword (0-1)

Post

The post resource contains a list of image(multiple resolutions) as well as metadata about the post including timestamp, score, camera, film, colors, keywords, etc.

field nametypedescription
idintegerunique identifier
titlestringtitle of post
authorstringauthor of post
permalinkstringurl of post source
scoreintegertotal votes of post
timestampintegertime of post creation (unix time)
descriptionstringpost description
camera_makestringcamera manufacturer (e.g., nikon)
camera_modelstringcamera model (e.g., fm2)
film_makestringfilm manufacturer (e.g., kodak)
film_typestringfilm type (e.g., portra 400)
film_speedintegerfilm ISO speed (e.g., 400)
aperturestringaperture setting (e.g., f/2.0)
focal_lengthintegerfocal length in mm (e.g., 35)
nsfwboolimage is NSFW (not safe for work, 18+)
grayscaleboolimage is grayscale (black & white)
sprocketboolimage is a sprocket shot (exposed film sprockets)
imagesarray[image]list of images at different resolutions
colorsarray[color]dominant colors extracted from image
keywordsarray[keyword]keywords extracted from post

Camera

The camera resource contains film cameras used in posts including manufacturer, model, and description and post count.

field nametypedescription
idintegerunique identifier
makestringcamera manufacturer (e.g., nikon)
modelstringcamera model (e.g., fm2)
descriptionstringdescription of camera
post_countintegernumber of posts using this camera
createdstringtimestamp when camera was added
updatedstringtimestamp when camera was last updated

Film

The film resource contains film stocks used in posts, including manufacturer, type, speed, and post count.

field nametypedescription
idintegerunique identifier
makestringfilm manufacturer (e.g., kodak)
typestringfilm type (e.g., portra 400)
speedintegerfilm ISO speed (e.g., 400)
color_typestringcolor or black & white film
descriptionstringdescription of film
post_countintegernumber of posts using this film
createdstringtimestamp when film was added
updatedstringtimestamp when film was last updated

Meta

The meta resource contains supplementary information for a collection of post resources, including pagination details and total counts.

field nametypedescription
total_postsintegertotal number of posts served by endpoint query
page_sizeintegermaximum number of posts returned per page
next_page_idintegerunique identifier of next page
next_page_urlstringurl path to fetch next page
seedintegerrandom seed used for random sorting

Endpoints

/posts

Returns a collection of post resources with accompanying meta resource. Supports extensive filtering and sorting options.

General Parameters

Posts can be sorted by time, score, or pseudo-randomly. Limits can be placed for maximum number of returned posts. If total number of posts exceeds the limit, results will be paginated.

paramdescriptiondefaultoptions
sorthow to order the poststimetime, score, random
page_sizemaximum number of posts returned201-200
page_idID of page to retrievenull
seedrandom seed for consistent random sortingnullinteger
curl https://api.analogdb.com/posts?sort=score&page_size=50

Filter Parameters

Posts can be filtered by various criteria including camera, film, time, colors, keywords, and image dimensions. For boolean filters (nsfw, grayscale, sprocket) if not provided, all posts are included; if set to true, only that type is returned; if set to false, that type is excluded.

paramdescription
idfilter by post ID
titlefilter by post title
authorfilter by author
time_startfilter by start time (unix timestamp)
time_endfilter by end time (unix timestamp)
camera_makefilter by camera make
camera_modelfilter by camera model
film_makefilter by film make
film_typefilter by film type
film_speedfilter by film speed
focal_lengthfilter by focal length
aperturefilter by aperture
nsfwinclude nsfw (18+) images (true=only, false=exclude)
grayscaleinclude grayscale (black & white) images (true=only, false=exclude)
sprocketinclude sprocket images (true=only, false=exclude)
keywordfilter by keywords (multiple allowed)
colorcolor filter (multiple allowed)
min_colorminimum color percentage (multiple allowed)
width_minminimum picture width
width_maxmaximum picture width
height_minminimum picture height
height_maxmaximum picture height
ratio_minminimum picture aspect ratio
ratio_maxmaximum picture aspect ratio
curl 'https://api.analogdb.com/posts?camera_make=nikon&film_make=kodak&grayscale=false&keyword=portrait'

/post/:id

Returns a single specific post resource as identified by ID.

curl https://api.analogdb.com/post/1924

/post/:id/similar

Returns a collection of post resources that are visually similar to the specified post based on vector similarity of image embeddings.

paramdescriptionoptions
idpost ID to find similar posts for (required)integer
page_sizemaximum number of similar posts to return1-200 (default: 12)
nsfwinclude nsfw posts in resultsboolean
grayscaleinclude grayscale posts in resultsboolean
sprocketinclude sprocket posts in resultsboolean
curl https://api.analogdb.com/post/1924/similar?page_size=20&nsfw=false

/cameras

Returns a collection of camera resources with optional filtering and sorting. Useful for discovering cameras (not extensive) and their post counts.

paramdescriptionoptions
sortsort orderalphabetical, counts
page_sizenumber of results to returninteger
makefilter by camera makestring
modelfilter by camera modelstring
idfilter by specific camera IDinteger
include_countsinclude post countsboolean
exclude_zero_countsexclude cameras with zero post countsboolean
curl https://api.analogdb.com/cameras?sort=counts&make=nikon&include_counts=true

/films

Returns a collection of film resources with optional filtering and sorting. Useful for discovering film stocks (not extensive) and their post counts.

paramdescriptionoptions
sortsort orderalphabetical, counts
page_sizenumber of results to returninteger
makefilter by film makestring
typefilter by film typestring
speedfilter by film speedinteger
colortypefilter by color typestring
idfilter by specific film IDinteger
include_countsinclude post countsboolean
exclude_zero_countsexclude films with zero post countsboolean
curl https://api.analogdb.com/films?sort=counts&make=kodak&speed=400&include_zero_counts=true