Knowledge Management - Polly.help


Answer your customer’s questions with ease

Knowledge management for optimized customer engagement across all channels.

  • Data

API reference on SwaggerHub


The Knowledge Management API allows you to organize your organization's information with knowledge management software and request information on the knowledge base using advanced GraphQL queries.

Conceptual model

Conceptual model



To interact with an entity within the knowledge base, you will require a token to uniquely indentify the entity. This token information consists of: E-mail, Id, IdType, polly.help Token and DocName. The information from the token will be used in the POST /graphql request.

The token service returns a JSON message and looks like this:

        "CustomerEmail": "xx@xx.xx",
        "Id": "xxxx",
        "IdType": "knowledgebase",
        "Token": "xxxx",
        "DocName": "Demo Retail NL"

API workflow

Sequence diagram


To fill and configure the knowledge base, the same e-mail address will be used as the one you registered with on the API Store. There are also some publication types that require a buddy e-mail account setup, which will be a different e-mail address from the one registered with our Store.

Features and constraints


  • Create and query knowledge base collections of articles.
  • Create simple or complex graphQL queries on your categorised knowledge.
  • For external (website) or internal use.


  • Decision trees are not accessible through the API.

Getting started

When you add this Knowledge Management API to your app on the KPN API Store, you will receive an e-mail at the e-mail address that you registered. The e-mail will provide you with your password to log into the management website. Go to the Polly.help login page and log in with your e-mail address and provided password. Once logged in, you can create a knowledge base. Select the appropriate template from the list of templates for the type of knowledge base you would like to create. For example: Demo Retail NL, which provides you with default collections, articles and more, written in Dutch. With collections and articles in place, you can create a publication. Add collections to the publications and publish one or more articles.


To authenticate you'll need to request an access token. Use your API Store app's credentials (Consumer Key and Consumer Secret) to make an authentication request. The authorization service returns a JSON message that contains the access_token field.

Use one of the following 3 options:


Execute below cURL command to receive an access token. Replace APP_CONSUMER_KEY and APP_CONSUMER_SECRET with your app's credentials.

curl -X POST \
 'https://api-prd.kpn.com/oauth/client_credential/accesstoken?grant_type=client_credentials' \
 -H 'content-type: application/x-www-form-urlencoded' \
 -d 'client_id=APP_CONSUMER_KEY&client_secret=APP_CONSUMER_SECRET'

If you are using cURL for Windows, please use the command below instead.

curl -X POST "https://api-prd.kpn.com/oauth/client_credential/accesstoken?grant_type=client_credentials" -H "content-type: application/x-www-form-urlencoded" -d "client_id=APP_CONSUMER_KEY&client_secret=APP_CONSUMER_SECRET"

The authentication service returns a JSON message that contains the access token field.

    "refresh_token_expires_in": "0",
    "api_product_list": "[xxxxxxx]",
    "api_product_list_json": [
        " xxxxxxx"
    "organization_name": "kpn",
    "developer_email": "demo123@kpn.com",
    "token_type": "Bearer",
    "issued_at": "1521039195424",
    "client_id": "APP_CONSUMER_KEY",
    "access_token": "haf2SDl07E9N7RluNQ4kJ1TkGgso",
    "application_name": "6e38edxxxxxxxxxxxxxxxx4065d79c",
    "scope": "",
    "expires_in": "3599",
    "refresh_count": "0",
    "status": "approved"


  1. Click on the Authorize button on the top right.
  2. In the form, fill in client_id and client_secret, using your app's credentials.
  3. Click Authorize.


When using Postman, you will have to import the Swagger file into a Postman collection as follows:

  1. Open the API reference on SwaggerHub.
  2. On the top right, click Export, click Download API and click 'YAML Unresolved'.
  3. In Postman from the menu click File and click Import... Choose the YAML file you downloaded in the previous step. A new collection will be added.
  4. Select Get Access Token from the collection.
  5. Make sure the right environment is selected, corresponding to the API.
  6. Edit the environment variables client_id and client_secret, using your app's credentials.
  7. Check the response code and message.
  8. Press the Send button to get an access token.

Note: Request variables are no longer linked to an environment, but to the collection.

How to...

Get token information

This request returns one or more tokens of your published information. Use token id and polly.help token in the POST /graphql request.


  1. Select GET /token.
  2. Click Try it out.
  3. Check the response code and message.


  1. Select GET (GetToken).
  2. Click Send.
  3. Check the response code and message.

Get query information

This is a powerful request that allows you to fire a graphQL query on the knowledge base. For each request you will need to provide id and token, that were previously retrieved by the GET /token request.


  1. Select POST /graphql.
  2. Supply query, token and publication id in the payload. See below for examples.
  3. Click Try it out.
  4. Check the response code and message.


  1. In the Postman collection, there are different payload based requests available, based on a query using same endpoint POST /graphql. See below for the queries.
  2. Supply query, token, publication id in the payload.
  3. Click Send.
  4. Check the response code and message.

In Postman payloads are available in the collection, whereas this is not available in SwaggerHub. Here is an overview of available GraphQL queries, so you can provide the payload to the SwaggerHub request.

Query name   Postman request   Query content payload  
Get article   POST (get article)   { "query": "{ article(id: \"{{articleId}}\") { id name content } }", "variables": {"publicationId": "{{publicationId}}", "api_token": "{{polly-api-token}}" } }
Search   POST (search)   { "query": "{ search(query: \"article\") { results { id name contentsnippet(length: 100) }} }", "variables": { "publicationId": "{{publicationId}}", "api_token": "{{polly-api-token}}" } }
Publications popular   POST (get publication > most popular)   { "query": "{ publication { mostpopular(first: 5) { id name contentsnippet(length: 100) } } }", "variables": { "publicationId": "{{publicationId}}", "api_token": "{{polly-api-token}}" } }
Publication   Post (get publication)   { "query": "{ publication { mostpopular(first: 5) { name } collections { name, mostpopular(first:3) { name}}} }", "operationName": "", "variables": { "publicationId": "{{publicationId}}", "api_token": "{{polly-api-token}}", "user": "{{emailAddress}}" } }
Analytics   POST (get analytics count article.views)   { "query": "{ search(query: \"article\") { results { id name contentsnippet(length: 100) }} }", "variables": { "publicationId": "{{publicationId}}", "api_token": "{{polly-api-token}}" } }
Suggestion   POST (submitSuggestion)   { "query": "mutation submitSuggestion { submitSuggestion( content:\"I suggest to...\" articleId:\"{{articleID}}" value:0 feedbackReason:1 priority:1 ){ id } }", "variables": { "publicationId": "{{publicationId}}", "api_token": "{{polly-api-token}}", "user" : "{{emailAddress}}" } }

Create GraphQL queries

For creating GraphQL queries, you could use an online editor. In this editor, copy and uncomment the lines below # Use these query variables for access to the demo publication: and copy this to the QUERY VARIABLES section below it. Now create your own GraphQL. If you need a GraphQL reference, check out this cheatsheet.

Return codes

Code   Description
200   Success
201   Created
202   Accepted
302   Found. Link in location header
400   Bad request
401   Unauthorized
403   Forbidden
404   Not found
405   Method not allowed
412   Precondition failed
429   Too many requests
500   Internal server error
502   Bad gateway
503   Service unavailable