Last minor revision on (font name became case-insensitive).
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:
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:![]()
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 RESTful 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:
| Name | Description | Possible values / format | Default value |
|---|---|---|---|
| t | Text of the button | a string (UTF-8 encoded) | no text |
| f | Text font | One of:Calibri, Open Sans, Ubuntu, Roboto, Caviar, Zenhei, Noto Sans,Suffix the font name with:
Zenhei and Pacifico are not available in bold and/or italic) | Calibri |
| tc | Color of the text | a Color | #000 |
| ts | Size of the text | a Size | 12 |
| tshs | Space between the text and its shadow. If set to 0, no text shadow is drawn. | a Size | 0 |
| tshc | Color of the text shadow | a Color | #777 |
| c | Radius 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 round | 0 |
| bgt | Type of background fill |
| unicolored |
| bgc | Color 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 |
| ebgc | Color 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 |
| bs | Size of the border. If set to 0, no border is drawn. | a Size | 0 |
| bc | Color of the border | a Color | #888 |
| shs | Size of the button box shadow. If set to 0, no box shadow is drawn. | a Size | 0 |
| shc | Color of the button box shadow | a Color | #666 |
| sho | Orientation of the button box shadow |
| se |
| be | “Bubble Effect”; draw a shiny ellipse on the upper half of the button | 0 (don’t draw) or 1 (draw it) | 0 |
| hp | Space between the text and the button left & right extremities. Does not account for the border and/or shadow size, if any. | a Size | 12 |
| vp | Space between the text and the button top & bottom extremities. Does not account for the border and/or shadow size, if any. | a Size | 10 |
| w | Width of the button. Does not account for the border and/or shadow size, if any. Overwrites hp. | a Size | none |
| h | Height of the button. Does not account for the border and/or shadow size, if any. Overwrites vp. | a Size | none |
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!