Da Button Factory

Create pretty buttons online, quickly!

The Da Button Factory API

Table of contents

Overview

The Da Button Factory Application Programming Interface lets you dynamically generate buttons. It returns an image in response to a HTTP GET request.
All the information about the button that you want, such as the text, size, and colors, are part of the requested URL. The URL format is the following:

http://dabuttonfactory.com/b.<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, jpeg, 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 in response to the URL just below:
generated button

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

The online button editor uses the API behind the hood. While using the editor, you can see the current button URL in the text field below the button image.

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 name can be in long or short form. The long name is more explicit, but the short one takes less characters. It is recommended to use the later.
The parameter value must be URL-encoded.

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

A Color value is either:

Here is the full list of parameters:

Long nameShort nameDescriptionPossible values/formatDefault value
texttText of the buttona string (UTF-8 encoded)(no text)
fontfText font
(⚠ the font name is case sensitive)
  • sans-serif
  • serif
  • monospace
  • DejaVuCondensed
  • Calibri
  • Caviar
  • Walkway
  • Burlington
  • Candela
  • SF_Arch_Rival
  • Komika
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
sans-serif
text-colortcColor of the texta Colorblack
text-sizetsSize of the texta Size12
text-shadow-spacingtshsSpace between the text and its shadowa Size0 (no shadow)
text-shadow-colortshcColor of the shadowa Color#777
cornerscRadius of the button cornersa Size, or the special value round0 (rectangular)
bg-typebgtType of the background coloration
  • unicolored
  • two-colors
  • gradient
  • pyramid
unicolored
bg-colorbgcColor of the whole background if unicolored, or the color of the topa Color#00f
end-bg-colorebgcColor of the bottom of the background if the background type is two-colors or gradient,
or the central color if the type is pyramid
a Color#0ff
border-sizebsSize of the bordera Size0 (no border)
border-colorbcColor of the bordera Color#888
shadow-sizeshsSize of the button shadowa Size0 (no shadow)
shadow-colorshcColor of the shadowa Color#666
shadow-orientshoOrientation of the 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)
bubble-effectbeDraw a shiny ellipse on top of the button0 or 10 (no effect)
hpaddinghpSpace between the text and the button left/right extremities
(not counting the border and/or shadow size)
a Size12
vpaddingvpSpace between the text and the button top/bottom extremities
(not counting the border and/or shadow size)
a Size10
widthwTotal width of the button. Overwrites hpaddinga Sizenone
heighthTotal height of the button. Overwrites vpaddinga Sizenone
typeitFiletype of the generated image
(⚠ deprecated: specify the filetype as explained in the overview instead)
  • png
  • gif
  • jpeg
  • ico
png

Response codes

The HTTP response code is:

The response body is the image 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 2000 (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 service interruption or major slowdown.
Be responsible and donate if you want to keep it that way!