The Da Button Factory API

Table of contents

Overview

The Da Button Factory Application Programming Interface lets you dynamically and programatically generate buttons. It returns an image in response to a HTTP GET request. All the button settings, such as the text, size, and colors, are parts of the requested URL.

The URL format is the following:

http://dabuttonfactory.com/button.<image type>?<parameter 1>&<parameter 2>&<parameter n>

The <image type> part indicates the filetype of the generated image. It must be one of: png, gif, jpg, or ico.
The <parameters> indicate everything else (content, font, colors, …). The full list and description of parameters is given in the next section.

For example, the API returns the following button image for the URL given just below:
generated button

http://dabuttonfactory.com/button.png?t=Hello,+API!&ts=24&bgt=gradient&bgc=afa&ebgc=5e5&c=5&bs=1

The online button creator uses the API behind the hood. While using the editor, you can see the current button URL when you click on the “Embed” link.

Parameters specification

The parameters are set in the URL query string (the part after the question mark), separated by ampersands (&). You can define them in any order. They all are optional; a default value is used if a parameter is not explicitely set.
A parameter is composed of a name and a value, which are separated by an equal sign. The parameter value must be percent-encoded.

A Size value is an integer in the range 0↔1000 (inclusive). All sizes are in pixels (even the font size).

A Color is a triplet of RGB values exprimed in hexadecimal, optionally prefixed by a dash. Examples: #ff0000 (red), 00ff00 (green)
The value can also be in the CSS-like short hexadecimal notation, for instance 00f (blue, equivalent to #0000ff).

Here is the full list of parameters:

NameDescriptionPossible values/formatDefault value
tText of the buttona string (UTF-8 encoded)(no text)
fText font
(⚠ the font name is case sensitive)
One of:
Calibri, Open Sans, Ubuntu, Roboto, Caviar, Zenhei, Noto Sans,
Droid Serif, Vollkorn, Pagella, Playfair Display, Arvo,
Komika, Pacifico, Lobster Two, Overlock, Bellota


Suffix the font name with:
  • -Bold to use the bold variant of the font
  • -Italic to use the italic variant
  • -Bold-Italic to use the bold italic variant
Calibri
tcColor of the texta Color#000
tsSize of the texta Size12
tshsSpace between the text and its shadowa Size0(no shadow)
tshcColor of the text shadowa Color#777
cRadius of the button cornersa Size, or the special value round0(rectangular)
bgtType of background fill
  • unicolored
  • two-colors
  • gradient
  • pyramid
unicolored
bgcColor of the whole background if unicolored, or its top color otherwisea Color#00f
ebgcColor of the bottom of the background if its type is two-colors or gradient,
or the central color if the type is pyramid. Ignored if the type is unicolored
a Color#0ff
bsSize of the bordera Size0(no border)
bcColor of the bordera Color#888
shsSize of the button box shadowa Size0(no shadow)
shcColor of the button box shadowa Color#666
shoOrientation of the button box shadow
  • a vertical direction (n for north, or s, south)
  • an horizontal direction (w or e)
  • a combination of both (e.g: nw)
se(south east)
be“Bubble Effect”. Draw a shiny ellipse on top of the button0 (don’t draw) or 1 (draw it)0(no effect)
hpSpace between the text and the button box left/right extremities
(not counting the border and/or shadow size, if any)
a Size12
vpSpace between the text and the button box top/bottom extremities
(not counting the border and/or shadow size, if any)
a Size10
wWidth of the button, excluding the border and shadow size (if any).
Overwrites hp
a Sizenone
hHeight of the button, excluding the border and shadow size (if any).
Overwrites vp
a Sizenone

Response codes

The HTTP response code is:

The response body is the button image (binary) data if the creation was successful, or a text/plain message giving details about the error otherwise.

Limits and usage policy

The maximum number of pixels in a button is 76 800 (that’s equivalent to a 320×240 area, rather big for a button!).
Any Size parameter must be between 0 and 1000 (pixels).
A button URL cannot be longer than 4096 characters.

It is allowed to directly link to a button URL (e.g. in an <img> tag on your website). Frequently accessed buttons are cached by our upstream proxies.
However, if you have hundreds of clients that will query some button(s) URL(s) simultaneously, or if you plan to generate new buttons several times per hour, talk to us beforehand.
We reserve ourselves the right to block any use that we regard as too intensive, without preliminary notice.

The free access to the API is provided without any warranty (regarding availability, among other things).
Our past performance is very good, though: more than 2 years without major service interruption or slowdown.
Be responsible and donate if you want to keep it that way!