These are the docs for the backend service which powers bunnies.io. You're best off looking at the examples and descriptions. Any questions, or feature requests, contact me on Twitter at @CarrotCodes!

Endpoints

Token meanings

{identifier} : A single bunny ID (eg 1, or 50), or "random" for a random bunny. Currently uses positive, consecutive integers, but ultimately are just URL encoding conforming strings.

{media types} : A comma separated list of requested media types. Includes: "gif,webm,mp4,poster". Order not important. "poster" represents the first frame of the loop, in PNG form, and is silently added to all requests (and it is thus unnecessary to specify it when combining with other media types).

{single media type} : The same as {media types}, but only one media type is permitted (eg, "gif"). Response is a temporary redirect directly to the given media, if it exists

{width hint} and {height hint} : Optional filter, but both parameters must be included if requested. These are used to calculate an aspect ratio, and resources that are close to this aspect ratio will be returned.

Endpoints with tokens

/v2/loop/{identifier}/?media={media types}

/v2/loop/{identifier}/redirect/?media={single media type}

/v2/loop/{identifier}/redirect/?media={single media type}&widthHint={width hint}&heightHint={height hint}

Examples

Fetching a random resource's metadata, including its webm and mp4 links

https://api.bunnies.io/v2/loop/random/?media=webm,mp4

{"id":"50","media":{"mp4":"https://media.bunnies.io/mp4/50.mp4","poster":"https://media.bunnies.io/poster/50.png","webm":"https://media.bunnies.io/webm/50.webm"},"thisServed":4,"totalServed":111782}

Fetching resource 57's metadata, including its webm and poster links

https://api.bunnies.io/v2/loop/57/?media=webm,poster

{"id":"57","media":{"poster":"https://media.bunnies.io/poster/57.png","webm":"https://media.bunnies.io/webm/57.webm"},"thisServed":5,"totalServed":111783}

Requesting a temporary redirect to a random resource's webm link

https://api.bunnies.io/v2/loop/random/redirect/?media=webm

HTTP 307 Temporary Redirect

Requesting a temporary redirect to a random resource's webm link, with an approximate aspect ratio of 1.0

https://api.bunnies.io/v2/loop/random/redirect/?media=webm&widthHint=1&heightHint=1

HTTP 307 Temporary Redirect to a resource with an approximate aspect ratio of 1.0

Fetching a resource's metadata, including its webm link, but with a malformed ID

https://api.bunnies.io/v2/loop/10000000000/?media=webm

HTTP 400:
{"code":"400","message":"not a valid bunny ID"}

Fetching a resource's metadata, including its webm link, but with a malformed ID

https://api.bunnies.io/v2/loop/anExtremelyLongIdentifier/?media=webm

HTTP 400:
{"code":"400","message":"not a valid bunny ID"}

Fetching a random resource's metadata, including it's webm and mp4 links, and an additional type that does not exist

https://api.bunnies.io/v2/loop/random/?media=webm,mp4,notAValidType

HTTP 400:
{"code":"400","message":"media parameter is missing or malformed"}

Requesting a temporary redirect to a random resource's webm link, but with a width hint and not a height hint

https://api.bunnies.io/v2/loop/random/redirect/?media=webm&widthHint=1

HTTP 400:
{"code":"400","message":"both widthHint and heightHint must either be present or omitted"}

Fetching resource 9999's metadata, including its webm and mp4 links, but it does not exist

https://api.bunnies.io/v2/loop/9999/?media=webm,mp4

HTTP 404:
{"code":"404","message":"couldn't find that bunny"}