Documentation
Everything you need to render word clouds over HTTP: authentication, the render endpoint and its parameters, file uploads and errors.
Quick start #
Render a word cloud with a single HTTP request. Three steps from zero to your first image:
- Create an API key on the API Keys page. Copy it right
away: it starts with
wc_and is shown only once. - Top up tokens under Billing. Every successful render costs 1 token.
- Send your words to the render endpoint. The response body is the
image itself: an SVG unless you ask for another
format.
Render a word cloud #
POST https://api.wordclouds.com/api/v1/render
Places the words and returns the cloud as an SVG, PNG, JPEG or PDF file. Each successful render costs 1 token; failed requests are free.
Send the body as JSON with Content-Type: application/json, or as multipart to
upload files (see Fonts and images). Unknown
fields are rejected.
Body parameters
- words object[] 1–1000 items Required
The words to place. Every word overrides
config.wordwith its own style where given. - config object
Layout and style. Every field is optional; omitted fields take their default.
- format string
File format of the response body. Each value is listed with its response
Content-Type. Defaults to"svg". - scale number > 0 and ≤ 2
Multiplies the pixel size of the output (for
pdf, the page too). Only forpng,jpgandpdf. Defaults to1. - quality number 0–1
JPEG quality; a
pdfembeds the cloud as a JPEG. Only forjpgandpdf. Defaults to the encoder default.
Returns
200 OK with the image as the body, in the requested format; its Content-Type is listed under that parameter. The image is config.document in size, multiplied by scale. Responses are never
cached.
Fonts and images #
Three fields take files: config.fonts.userFiles, config.mask.image and config.document.backgroundImage. Send them in
one of two ways:
- In the JSON body, as base64
data:URLs. Simple, but base64 adds a third to the size. - As multipart/form-data: the JSON goes in a
part named
payload, each file in a part of its own. Refer to a part withattach://<name>.
Images must be PNG, JPEG, WebP or GIF, and fonts TTF, OTF or TTC, at most 5 MB each. URLs and paths are never fetched.
Use an uploaded font by its key in config.word.fonts or words[].font. Without uploads, you can use Google Fonts families (e.g. Open Sans) and common system fonts such as Arial, Georgia, Impact, Verdana and
Times New Roman.
Errors #
Errors come back as JSON with a single message field and one of the status codes below.
Only successful renders are charged.
- 400
- The body is not valid JSON or multipart, or fails validation. The message names the failing fields.
- 401
- The
Authorizationheader is missing or malformed, or the key is unknown or revoked. - 402
- Your token balance is too low for the render.
- 413
- The body is larger than the server accepts.
- 422
- Rendering failed or took longer than 30 seconds.
- 500
- Something went wrong on our side.