API documentation

Kundo's API makes it possible to fetch all the data in your forum, and integrate it into your application or website.

Table of contents

Stay up to date!

We regularly add features to the API and sometimes make important changes. Make sure you stay up to date by subscribing to our mailing list. If you are an external contractor, please sign up your client or product owner.


A string that uniquely identifies your forum. It's part of the URL for your forum, so if your forum is located on http://kundo.se/org/your-forum/, then your-forum is your slug. Keep this in mind as it's used in all API calls.
One specific discussion forum. You can create several forums connected to one account, and each forum will behave as a independent entity. Each forum has its own slug.
The posting that started a new thread in the forum. Other users add comments to a dialog, but the dialog object in itself does not include the comments. The API call to fetch the comments is available in the comments_uri property on the dialog. A dialog always has a topic, a category that denotes what kind of dialog they posted. It can be either a question, a problem, a suggestion, or praise.

All examples below are clickable, to make it easier to explore the API. You can also adapt the examples to your own forum by simply inputting your slug (see explanation above) in the below form.

Available return formats

By specifying different file endings in your calls, the API can be made to return either JSON or XML. When using JSON, a callback can be specified, making JSONP possible.

All dialogs, in JSON format. Since this is the recommended format, all other examples use JSON.
All dialogs, in JSONP format. "your_own_method" is the javascript call to wrap around the response.
All dialogs, in XML format.

Response codes

Errors will be reported with the corresponding HTTP status code.

Content-Type: text/plain

Bad Request
JSON data posted was incorrectly formatted.
Content-Type: application/json

    "useremail": [
        "Du m\u00e5ste fylla i din e-postadress."
Required data is missing. The key indicates which field is incorrect, and the error message can be shown to the user to help them correct their error.
Content-Type: text/plain

The specified ip address or user email is blocked by Kundo.
Content-Type: text/plain

The specified email's domain is blocked by Kundo.
Content-Type: text/plain

HTTP response if the exact same dialog (title and text) already exists.
Content-Type: text/plain

The dialog, comment, or vote was created but marked as spam and will not be visible.

If everything went well a 201 CREATED response will be returned:

Content-Type: text/plain

The dialog, comment, or vote was created without problems.

Best practices

Prefer server side over client side

When working with the Kundo API you have the choice of accessing it from your server side code or via Javascript on the client side.

For static or semi static information, such as forum meta data, lists of dialogs, dialog pages and comment listings we strongly recommend using server side code. Client side implementations using Javascript to fetch large amounts of data tend to make the page load slowly or flicker.

Fetching and parsing data on the server side also has the benefits of faster load time through caching, further improving the user experience. With server side parsing your SEO is also improved - Google and other search engines will in most cases not be able to crawl information presented using Javascript.

If you are doing API calls that require an API key these must of course be done from your server side code to avoid publishing your API key.

For very dynamic information however, we do recommend that you use Javascript. Examples of this include autocomplete functionality and regular search results displayed on a separate page.

Use the client IP address

The IP address of the user posting a dialog or comment is used by Kundo in a number of ways, most notably to protect your forum from spam and other abuse. When posting content to Kundo from your server side code the IP address sent by your server is used. We strongly recommend that you post data with the IP address of the user rather than your server. This can be done by setting the X-Forwarded-For header on your request with the IP address of the user.

Fetching data

All dialogs in your forum. Limited to 50 dialogs per request - see pagination.
All dialogs with topic "questions". Available topics: questions, problems, suggestions, and praises, or in their abbreviated forms: Q, P, S, and B (Why B for praise? Because "P" was taken :).
You may also have custom categories set up for your account. Use the category slug as the topic for this call.
It's also possible to select dialogs from multiple topics. Just send in a comma separated lists of the topics you want.

Each element in an API response contains a property called "uri", with an URL that can be used to access details about that object. NOTE: We've tried hard to include as much data as possible in the listing calls, so you might not need to use the details view.

All information we have on the dialog with id=1. Take statistics into concern - see register page views.

Using the "comments_uri" property you can fetch comments for a given dialog.

All comments for the dialog with id=1. Limited to 50 comments per request - see pagination.
Search through all the dialogs that contain "test". Limited to 10 dialogs per query. Make sure you clean your users search input from newlines and other invalid URL formating. Only the first 50 terms and a total query length of 500 will be considered in the search.
If your search is a live or autocomplete-style search while the user is writing a new post you want to add the livesearch=1 parameter to get a more feasible search behavior, such as ignoring “quoted phrases” and returning a shorter text snippet length.
You can controll the length of the text snippet returned from the API. The maximum length is 300.
Search through all the dialogs that contain "test" in the category "questions". Limited to 10 dialogs per query.
Search through all the dialogs that contain "test" in the category "questions". Limited to 10 dialogs per query.
Search through all the dialogs that contain "test" in the categories "questions" or "problems". Limited to 10 dialogs per query.

When building a customized mirror of the forum start page, it can be helpful to be able the fetch the user customizable settings for a forum instead of hardcoding them.

Common user configurable properties of the forum.

Properties returned:

nameThe forum name
formal_nameFormal company name. May be different from the forum name
intro_messageA short description of the forum
status_messageTemporary message displayed above the feedback form
status_urlURL where user can read more about the status message.
popup_headerHeader text for the popup window
default_topicThe topic that should be selected by default
enabled_topicList of all available topics
languageThe language setting of the forum
List of all public editors in the forum with name, title and picture.

Calls that require an API key

It is also possible to fetch data that is normally only available to logged in editors. To fetch this kind of data do you need an API key, available to customers with an Medium, Large or Custom account. Contact us if you need an API key. A bad API key returns error code 401 "Authorization Required".

NOTE: Don't send the API key with Javascript, since that would reveal the key to your users.
When making requests with an API key the result might contain data only visible for authorized users, for example internal tags and dialogs that are archived. So make sure you clean the result on your side before showing it to the end user.

Working with tags

Tags are great for building new views into your forum. You could for instance tag your dialogs with a product specific tag, and use that one to show a list dialogs on your product page. Tags are only settable by editors or when posting dialogs to the API with an API key, and can be made either private (default) or public. If they are private you need a API key to fetch them in the API.

Get dialogs tagged with "example".
Get dialogs tagged with both "tag1" and "tag2".
By specifying an API key to the detail view you get the tags included in the response.
Get all tags in a given forum. Included in the response are the number of dialogs tagged with each tag.
Search for dialogs including the word "test" and are tagged with "tag1". Note! If you provide the API-key the result will contain archived dialogs.
Search for dialogs including the word "test" and are tagged with both "tag1" and "tag2".
All dialogs with topic "questions" and the tag "tag1".


Pagination can be controlled through the start and limit parameters. The start parameter sets the first index to fetch (NOTE: zero indexed, default: 0), the limit parameter sets the number of results to return (default: 50). These parameters works with all kinds of requests, including search.

Fetch the next 50 dialogs. When no more dialogs are available, an empty response is returned.
Fetch a maximum of 10 results.

All queries returning a list of dialogs also has a HTTP header called X-TotalResults that contains the total number of dialogs that are available, no matter what the limit and start parameters are set to. This makes it possible to calculate the number of page links to show after your partial list of results.


By default, dialogs and comments are sorted in reverse chronological order, i.e. the most recent first. By specifying the sort parameter you can select a different sorting order:

All questions, sorted by number of comments. Ascending.

To reverse the sort order, add a minus sign ("-") in front of your sort parameter:

All questions, sorted by number of comments. Descending.

Available sort parameters are:

pub_dateThe date and time when the dialog was posted
popularityThe dialog popularity (based on page views, comments, and time decay)
last_activityThe date and time when the dialog was last commented on. If there are no comments, the date the dialog was published.
num_votesThe number of votes
num_commentsThe number of comments
titleTitle of dialog
textDialog body text
topicThe topic of the dialog
user__first_nameThe name the user specified

Register page views

Fetching data through the API does not count as page views in the forums vistors statistics. So to keep statistics and popularity ranking accurate you must trigger a page view explicitly.

Register a page view on dialog with id=1. Returns no data, just the HTTP status code.

To make it easier to trigger page views this call is also available as a javascript url. With the javascript url you can trigger a page view asynchronously with a script tag on the actual page.

<script type="text/javascript">
    (function() {
        function async_load(){
            var s = document.createElement('script');
            s.type = 'text/javascript';
            s.async = true;
            s.src = ('https:' == document.location.protocol ? 'https://' : 'http://') +
            var x = document.getElementsByTagName('script')[0];
            x.parentNode.insertBefore(s, x);
        if (window.attachEvent)
            window.attachEvent('onload', async_load);
            window.addEventListener('load', async_load, false);
Example of lazy loaded script for triggering a page view on dialog with id=1.

Statistics and popularity

The number of page views is used to calculate the popularity of posts in the forum. But if you register page views when the users click in lists of most popular posts you will just re-enforce their popularity, and the same posts will always be the most popular.
To avoid this scenario, you can trigger a page view that is excluded from popularity calculations and used for statistics only. This is done by adding a parameter to the request:

Register a page view on dialog with id=1, without increasing its popularity rankning. Returns no data, just the HTTP status code.

Furthermore, visits from a particular user will only be added to the popularity count once in a certain time period. The client's IP address is used to roughly distinguish unique users for this purpose. If you have specified an X-Forwarded-For header in your call this value will be used, see the best practices section.

If you want to specify your own unique identifier rather than the user's IP address, you can pass the uid parameter like this:

Register a page view on dialog with id=1, sending in your own unique user identifier.

Post data using the API

To enable advanced customizations, it is also possible to post dialogs, comments and votes using the API. Posts can be done both using JSON and a HTML form, but the URL:s used are the same.

Post new dialogs to your forum. If the dialog was marked as spam this wil be indicated in the response body with the word SPAM. Contact us to learn more about how to unspam content.
Post comments to a given dialog. If the dialog was marked as spam this wil be indicated in the response body with the word SPAM. Contact us to learn more about how to unspam content.
Subscribes the user to a given dialog. The user will be notified by e-mail on new comments.
Deprecated: Post votes to a given dialog. Votes will not be supported by this API in the future. Subscriptions (above) can be used to achive the same result.
Report a dialog as inappropriate
Report a comment as inappropriate

Adding custom fields to a dialog

It can be useful to append other data to a dialog, e.g. customer id or social security number, that is only available to logged in editors. Such data can be added as regular parameters to a dialog post. However, before doing so Kundo must set up the accepted parameters for you.

The following types are avaialable

Type Description Options
Text A text string Optional: max number of characters the string is allowed to be
Integer An integer value Optional: max value for the number
Coordinate A string describing a coordinates for a position None
Choice A string, limited to a list of choices Required: Values allowed in the custom field. The values must be strings.

Custom fields can only be added if you have an Large account at Kundo. To set up custom fields for your account, please contact us.

Once parameters are set up, just add them to your regular dialog post:


    "name": "Name",
    "useremail": "name@example.com",
    "topic": "Q",
    "title": "Post title",
    "text": "Post contents...",
    "customer_id": 1234,
    "customer_level": "Gold"
Post a new dialog using JSON with two custom fields, customer_id and customer_level, added.

The custom fields are then available in the dialog json under the keys extras, custom_fields_data. For example, the dialog above would look like:


    "extras": {
        "archived": false,
        "custom_fields_data": {
            "customer_id": 1234,
            "customer_level": "Gold"
        "metadata": {
            "customer_id": 1234,
            "customer_level": "Gold"
Partial response from fetching a dialog with custom fields

As shown in the above example, the same data is also returned in metadata. This is for historical reasons and is deprecated. New code should use custom_fields_data

Auto archiving a dialog

Kundo support the concept of “archiving” dialogs. This means that the dialog is still available on Kundo for editors and anyone with the URL to the post. However, the dialog will not show up in lists or in search for regular users. This is a good way to keep personal posts away from the public forum.

If you for some reason want to archive a post immediately after it's posted you can add the "archived" parameter to your post. Since archiving is only available to editors the call requires an API key if this parameter is included.


    "name": "Name",
    "useremail": "name@example.com",
    "topic": "Q",
    "title": "Post title",
    "text": "Post contents...",
    "archived": true,
Post a new dialog that will be immediately archived.

Uploading files

To highlight a problem or add more details to a reply, users sometimes want to add images, PDF files and other types of documents to a dialog or comment. Kundo handles such attachments in a loosely coupled way: Each link found in the text of a dialog or comment will be replaced by a corresponding embed code for that particular file type.

Files that are uploaded to Kundo are handled in the same manner: Once the file is uploaded you simply add the link to that file info the text of your dialog or comment before you post it to Kundo.

A successful call returns the URL of the uploaded file. The content type of your post needs to be “multipart/form-data” and the attached file should be added to a POST variable named “file”.

Send data as JSON

All posts require structured data, and JSON works well for that purpose. To specify that you are using JSON you need to set the "Content-Type" header to "application/json".


    "name": "Name",
    "useremail": "name@example.com",
    "topic": "Q",
    "title": "Post title",
    "text": "Post contents..."
    "tags": "tag one, tag two, tag three"
Post a new dialog using JSON. If you add tags to the dialog as in the example above you need to supply an API key in the URL. See working with tags.

    "name": "Name",
    "useremail": "name@example.com",
    "text": "My comment goes here..."
Post a new comment using JSON

    "name": "Name",
    "useremail": "name@example.com",
Post a new vote using JSON

    "name": "Name",
    "useremail": "name@example.com",
    "report_reason": "Report reason goes here..."
Report a dialog or comment using JSON

To use cURL to test the API, use these command flags:

curl -i -H 'Content-Type:application/json' -X POST -d '<Your JSON data here>' http://kundo.se/api/kundo
Post a new dialog using cURL.

Send data using an HTML form

The API also support posting data through a HTML form directly.

<form action="http://kundo.se/api/kundo" method="POST">
        Type of question:
        <select name="topic">
            <option value="Q">Question</option>
            <option value="P">Problem</option>
            <option value="S">Suggestion</option>
            <option value="B">Praise</option>
    <p>Title: <input name="title"></p>
    <p><textarea name="text"></textarea></p>
    <p>Your name: <input name="name"></p>
    <p>Your e-mail: <input name="useremail"></p>
    <p><button type="submit">Send</button></p>
    <input name="error_url" value="<URL to forward errors to>" type="hidden">
    <input name="success_url" value="<URL when successfully posted>" type="hidden">
Post data using an HTML form.

The two last fields, error_url and success_url, are related to error handling:

  • If all fields are correct the request is forwarded to success_url
  • If no success_url was given, the request is forwarded directly to the dialog in the forum.
  • If any field has an error the request is forwarded to error_url and and the error message is added as a GET parameter to that URL. I.e:

    These query parameters can be used to generate a new form on the server side, and display the errors to the user
  • If any of error_url and success_url, are incorrect, an error message will be shown.