GraphQL reference: Knowledge Base, Product Tours, NPS, feature requests and API tokens

The query and mutation references cover posts, widgets, feedback, the roadmap and your workspace. This page covers the newer parts of the API: the Knowledge Base, Product Tours, NPS surveys, managing feature requests, the roadmap item search and API tokens.

In the API, a workspace is called a project. You can run everything on this page in the GraphQL IDE with your login session. For the endpoint and for API tokens, see Get started with the GraphQL API and API tokens. How to read a mutation's arguments and fields is explained in GraphQL mutations: workspace, members and account.

An API token can run every query on this page except accessTokens. Which mutations it can run depends on its scope, and each section below says so.

Knowledge Base

The Knowledge Base queries and mutations work only when your workspace has the Knowledge Base. Otherwise they answer "Knowledge Base is not included in your plan."

knowledgeBaseFolders

Query. Lists the folders of your Knowledge Base.

  • project_id (required): ID of the project.

Each KnowledgeBaseFolder has id, icon, parent_folder_id (empty for a top-level folder), sort_index, contents (the folder's name and description per locale_id), articles_count (published and draft articles, not archived), created_at and updated_at.

knowledgeBaseArticles

Query. Lists articles, 20 per page.

  • project_id (required): ID of the project.
  • folder_id: only the articles of this folder. Use "none" for articles that are in no folder.
  • label_id: only the articles with this label.
  • query: a search text.
  • page: the page to return.
  • status: draft, published, archived or scheduled. Archived articles appear only with archived.
  • updated_from, updated_to: only the articles last updated in this window (ISO date and time).

It returns list (the articles), count, page and pages.

knowledgeBaseArticle

Query. Returns one article.

  • project_id (required): ID of the project.
  • article_id (required): ID of the article.

A KnowledgeBaseArticle has, among others, id, folder_id, is_draft, is_archived, publish_at, published_at, slug, custom_slug, seo_title, seo_description, contents (locale_id, title, body, summary), labels, related_articles, views_total, helpful_yes_total and helpful_no_total.

{
  knowledgeBaseArticles(project_id: "12345", status: "published", page: 0) {
    count
    pages
    list {
      id
      slug
      contents {
        locale_id
        title
      }
    }
  }
}

saveKnowledgeBaseFolder

Mutation. Creates a folder (leave out folder_id) or updates one.

  • project_id (required): ID of the project.
  • folder_id: ID of the folder to update.
  • icon: the folder's icon.
  • parent_folder_id: the folder this one sits in. Leave it out for a top-level folder. Only a top-level folder can hold other folders, so folders go two levels deep at most.
  • sort_index: the folder's position.
  • contents (required): a list of { locale_id, name, description }.

saveKnowledgeBaseArticle

Mutation. Creates an article (leave out article_id) or updates one. An argument you leave out stays as it is.

  • project_id (required): ID of the project.
  • article_id: ID of the article to update.
  • contents (required): a list of { locale_id, title, body, summary }. It must hold your workspace's default language.
  • folder_id: the article's folder.
  • is_draft: true keeps the article as a draft, false publishes it.
  • is_archived: hides the article from every public page.
  • publish_at: a time to publish a draft.
  • slug: a custom address (lowercase letters, numbers and dashes). An empty value goes back to the generated one.
  • seo_title, seo_description: the SEO title and description.
  • owner_id: the team member who owns the article.
  • label_ids, related_article_ids, related_issue_ids, related_feature_request_ids: labels, related articles, related roadmap items and related feature requests. An empty list removes them all.
mutation {
  saveKnowledgeBaseArticle(
    project_id: "12345"
    is_draft: true
    contents: [{ locale_id: "en", title: "How to export your data", body: "<p>Open Settings...</p>" }]
  ) {
    id
    is_draft
  }
}

deleteKnowledgeBaseFolder, deleteKnowledgeBaseArticle and bulkUpdateKnowledgeBaseArticles

Mutations. deleteKnowledgeBaseFolder(project_id, folder_id) and deleteKnowledgeBaseArticle(project_id, article_id) delete one folder or article. bulkUpdateKnowledgeBaseArticles(project_id, article_ids, action, folder_id) acts on up to 100 articles at once; action is move (with folder_id), publish, unpublish, archive, unarchive or delete.

API tokens: a Read & write (no deletes) token can run saveKnowledgeBaseFolder, reorderKnowledgeBaseFolders, saveKnowledgeBaseArticle and reorderKnowledgeBaseArticles. A Full access token can also run deleteKnowledgeBaseFolder, deleteKnowledgeBaseArticle and bulkUpdateKnowledgeBaseArticles.

Product Tours

tours and tour

Queries. tours(project_id, status) lists your tours, newest first. tour(project_id, tour_id) returns one. status is draft, live, paused or archived; leave it out for all of them.

A Tour has id, title (the internal name, never shown to visitors), status, version, segment_filters, url_rules, trigger, frequency, priority, start_at, end_at, goal, published_at, created_at and updated_at. tourSteps(project_id, tour_id) returns its steps.

tourChecklists and tourChecklist

Queries. tourChecklists(project_id, status) lists your checklists, newest first, and tourChecklist(project_id, checklist_id) returns one. tourChecklistItems(project_id, checklist_id) returns its items.

saveTour

Mutation. Creates a tour (leave out tour_id) or updates one. An argument you leave out stays as it is.

  • project_id (required): ID of the project.
  • tour_id: ID of the tour to update.
  • title: the internal name. Required to create a tour.
  • segment_filters: who sees the tour. Empty shows it to everyone.
  • url_rules: the pages the tour may run on, each { op, value, on, negate }. op is any, exact, startsWith, endsWith, contains or regex; on is path (the default) or url. A tour with no rule runs on every page.
  • trigger: { type: auto } starts the tour by itself, { type: manual } waits for your code to start it.
  • frequency: once (the default), until_completed or always.
  • priority: the higher number wins when several tours could show. The default is 0.
  • start_at, end_at: when the tour may run.
  • goal: what the tour tries to make happen.

Steps are added and changed with saveTourStep, saveTourStepContent, reorderTourSteps and deleteTourStep.

publishTour, pauseTour, unpublishTour, archiveTour, restoreTour, duplicateTour and deleteTour

Mutations. Each takes project_id and tour_id.

  • publishTour: takes the tour live. A tour without steps cannot be published. Publishing again raises the version.
  • pauseTour: stops showing the tour to new visitors. Publish it again to resume.
  • unpublishTour: takes a live or paused tour back to draft.
  • archiveTour: retires the tour. An archived tour cannot be published again.
  • restoreTour: brings an archived tour back as a draft.
  • duplicateTour: copies the tour as a new draft (with an optional title).
  • deleteTour: deletes the tour and its analytics for good. The dashboard offers this only for an archived tour, so archive it first.

bulkUpdateTours(project_id, tour_ids, action) does one of these for up to 100 tours: action is publish, pause, unpublish, archive, restore, delete or duplicate. Checklists have the same set: saveTourChecklist, publishTourChecklist, pauseTourChecklist, unpublishTourChecklist, archiveTourChecklist, restoreTourChecklist, duplicateTourChecklist, deleteTourChecklist and bulkUpdateTourChecklists.

API tokens: tokens can read tours and checklists, but no token can run the Product Tours mutations. Run them in the IDE with your login session.

NPS

An NPS survey is a post. Its survey settings are stored with the post's ID.

getNps

Query. Returns the settings of one NPS survey.

  • project_id (required): ID of the project.
  • post_id (required): ID of the survey's post.

An Nps has id, post_id, interaction, follow_up_question, skip_reason and options (the survey's look as a JSON object).

saveNps

Mutation. Creates or updates the settings of an NPS survey. It works only when your workspace has NPS.

  • project_id (required): ID of the project.
  • post_id (required): ID of the survey's post.
  • interaction (required): when the survey stops showing: submit_response, until_close or only_once.
  • follow_up_question: the question asked after the score.
  • skip_reason: whether the follow-up question can be skipped.
  • options: the survey's look as a JSON object.

API tokens: a Read & write (no deletes) or Full access token can run saveNps.

Managing feature requests

These mutations are the dashboard's side of feature requests. The public ones (voting, commenting and proposing from the Portal or the widget) are in GraphQL mutations: posts, widgets, feedback, roadmap and more.

saveFeatureRequest

Mutation. Creates a feature request (leave out feature_request_id) or updates one. With your login session, you can create one only while Feature Requests is turned on in your workspace.

  • project_id (required): ID of the project.
  • feature_request_id: ID of the request to update.
  • title (required): the title.
  • contents (required): a list of { locale_id, title, summary }. It must hold your workspace's default language.
  • summary: the description.
  • user_id: a team member to record as its creator.
  • issue_id: the roadmap item it is linked to.
  • labels: a list of label IDs. Send them every time: a save without labels removes the request's labels.
  • is_archived, is_internal, is_approved: archive it, keep it internal, approve it.
  • segment_filters: who can see it.

replyFeatureRequest

Mutation. Replies to the person who asked for the feature: replyFeatureRequest(project_id, feature_request_id, subject, content). The reply is e-mailed to them when the request has an author in your Audience; otherwise it is only saved. replyFeatureRequestToSubscribers takes the same arguments plus subscribers.

mergeFeatureRequest

Mutation. mergeFeatureRequest(project_id, feature_request_id, merged_feature_request_id) moves the comments and votes of feature_request_id to merged_feature_request_id and deletes feature_request_id. A person who voted for both keeps one vote.

bulkUpdateFeatureRequests

Mutation. Acts on up to 100 requests at once: bulkUpdateFeatureRequests(project_id, feature_request_ids, action, label_ids, segment_filters, target_id). action is approve, archive, unarchive, make_public, make_internal, delete, add_labels (with label_ids), set_segment (with segment_filters) or merge (every other selected request goes into target_id). It returns done and skipped.

API tokens: a Read & write (no deletes) token can run saveFeatureRequest, commentFeatureRequest, replyFeatureRequest and replyFeatureRequestToSubscribers. A Full access token can also run mergeFeatureRequest, bulkUpdateFeatureRequests and deleteFeatureRequest.

roadmapItems

Query. Searches your roadmap items by title, a page at a time. Archived and deleted items are left out.

  • project_id (required): ID of the project.
  • query: a search text.
  • page: the page to return (0 is the first).

It returns list (each item's id, title and status), count, page and pages. For the full roadmap item, use issues and issue.

API tokens

You can also manage API tokens through the API, the same way as in Settings > API. These three operations need your login session and the Owner or Manager role. No token can run them, so a token cannot create or revoke other tokens.

accessTokens

Query. accessTokens(project_id) lists the workspace's tokens. Each AccessToken has id, name, prefix, scope, created_by, created_at, last_used_at and expires_at. The token itself is never returned here.

createAccessToken

Mutation. Creates a token.

  • project_id (required): ID of the project.
  • name (required): the token's name.
  • scope: read (the default), write (no deletes) or full.
  • expires_at: when the token stops working. It must be in the future. Leave it out for a token that does not expire.

It returns token (the token itself, shown only this once) and accessToken (the record above).

mutation {
  createAccessToken(project_id: "12345", name: "CI release notes", scope: "write") {
    token
    accessToken {
      id
      scope
    }
  }
}

revokeAccessToken

Mutation. revokeAccessToken(project_id, id) stops one of the workspace's tokens. It returns true when the token is revoked.

Was this helpful?