Flip a Coin API - API for coin flips

 

Click to flip again.

flipacoinapi.com is a free API for flipping a coin.

API Usage

JSON

Retrieve a random coin flip in JSON format.

GET http://flipacoinapi.com/json

Using curl

$ curl http://flipacoinapi.com/json

Example response:

"Heads"

XML

Retrieve a random coin flip in XML format.

GET http://flipacoinapi.com/xml

Using curl

$ curl http://flipacoinapi.com/xml

Example response:

<coin>Heads</coin>

Plain Text

Retrieve a random coin flip in plain text.

GET http://flipacoinapi.com/txt

Using curl

$ curl http://flipacoinapi.com/txt

Example response:

Heads

Custom Responses

The response can be modified using URL query parameters.

The h query parameter can be used to specify the 'Heads' value while the t parameter can be used to specify the 'Tails' value.

JSON

Example usage:

GET http://flipacoinapi.com/json?h=red&t=blue

Example response:

"red"

XML

Example usage:

GET http://flipacoinapi.com/xml?h=red&t=blue

Example response:

<coin>red</coin>

Plain Text

Example usage:

GET http://flipacoinapi.com/txt?h=red&t=blue

Example response:

red