The Da Button Factory API

Version 2, available since .
Last minor revision on (font name became case-insensitive).

Table of contents

Overview

The Da Button Factory API 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:

https://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

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

The online button creator uses this REST API behind the hood. While using the editor, you can see the current button URL when you expand the “Embed” section.

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. 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 fontOne 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
(⚠ Zenhei and Pacifico are not available in bold and/or italic)
Calibri
tcColor of the texta Color#000
tsSize of the texta Size12
tshsSpace between the text and its shadow.
If set to 0, no text shadow is drawn.
a Size0
tshcColor of the text shadowa Color#777
cRadius of the button corners.
If set to 0, the button is fully rectangular.
If set to round, the button left & right sides are fully curved.
a Size, or the special value round0
bgtType of background fill
  • unicolored
  • two-colors
  • gradient
  • pyramid
unicolored
bgcColor of the top of the background if its type is two-colors or gradient.
Top and bottom color if the type is pyramid.
Color of the whole background if the type is unicolored.
a Color#00f
ebgcColor of the bottom of the background if its type is two-colors or gradient.
Central color if the type is pyramid.
Ignored if the type is unicolored.
a Color#0ff
bsSize of the border.
If set to 0, no border is drawn.
a Size0
bcColor of the bordera Color#888
shsSize of the button box shadow.
If set to 0, no box shadow is drawn.
a Size0
shcColor of the button box shadowa Color#666
shoOrientation of the button box shadow
  • a vertical direction: n for north, or s for south
  • an horizontal direction: w for west, or e for east
  • a combination of both (e.g: nw for north-west)
se
be“Bubble Effect”; draw a shiny ellipse on the upper half of the button0 (don’t draw) or 1 (draw it)0
hpSpace between the text and the button left & right extremities.
Does not account for the border and/or shadow size, if any.
a Size12
vpSpace between the text and the button top & bottom extremities.
Does not account for the border and/or shadow size, if any.
a Size10
wWidth of the button.
Does not account for the border and/or shadow size, if any.
Overwrites hp.
a Sizenone
hHeight of the button.
Does not account for the border and/or shadow size, if any.
Overwrites vp.
a Sizenone

Response codes

The HTTP response code is:

  • 200 OK if the button was generated successfully.
  • 400 Bad Parameter if one of the parameter value was invalid.
  • 400 Too Big if the image size limit was exceeded. See Limits.
  • 500 Internal Error if there was an error on our side.

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 number of pixels in a button is limited to 250 000 maximum.
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 plan to generate several new buttons per minute, 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 5 years without major service interruption.
Be responsible and make a donation if you want to keep it that way!