FAQ content

API: Overview of the LibAnswers API

In this article

What is an API?

An API (or Application Programming Interface) allows you to interact with an app in your own code. In the case of LibAnswers, this allows you to request data about FAQs, topics, groups, and chat widgets, which you could then display on a webpage using your own scripts. As you can imagine, the API can provide much more flexibility than widgets, but also requires more extensive coding knowledge. So, if you aren't familiar with programming with APIs, you may want to work with a colleague who does.

Please note: API requests (except the Search Query API and LibChat Widget Status) will be cached to conserve processing. The cache is cleared every 3 hours.

To access the API, go to Admin > Widgets & API.

Navigating to the API page


API v1.0 endpoints

The v1.0 endpoints are the older version of the LibAnswers API but are still supported for backward compatibility. If you are currently using the v1.0 endpoints, you do not need to change your existing calls. However, we encourage you to use the v1.1 endpoints.

Available endpoints

Full details (including parameters, example requests, and example responses) for using each endpoint are available under Admin > Widgets & API > API Endpoints v.1.0 tab. Click on the resource link for each endpoint to view the corresponding documentation. 

Endpoint Type Description
faqs GET Returns public FAQs from your groups.
faqs/:id GET Returns a specific public FAQ by its ID number.
topics GET Returns topics from your groups.
topics/:id GET Returns a specific topic by its ID number.
groups GET Returns groups from your system.
groups/:id GET Returns a specific group by its ID number.
search GET Returns search results from your system
search/:query GET Returns relevant public FAQs based upon query terms.
chat/widgets/status/:id GET Returns the online status of a specific chat widget by its ID number.
chat/widgets GET Returns data about chat widgets in your system, including the HTML embed code.

API v1.1 endpoints

The v1.1 endpoints include requests that allow you to get data from your system. In order to request data from the API, you must first set up an application in LibAnswers. This will provide you with a unique Client ID and Client Secret, which you will need in order to obtain an access token. A valid token is required for LibAnswers to return data to your app. If you do not include an access token, or the token is expired, an error message will be returned.

Keeping your client ID & secret, well, a secret

The ideal design would be for your client applications to communicate with your own server, and your server to communicate with the LibAnswers API, keeping your client id/secret pair out of the public domain.

However cross-origin resource sharing (CORS) is allowed from any domain, so if you want to set up a read-only application it is possible to expose the client id/secret pair and have the client directly communicate with the LibCal API.

When setting up an application with write permissions, we strongly advise that you keep the client id/secret private. For increased security and efficiency, the API should be accessed via HTTPS directly.

API Authentication

Your existing applications will be displayed under the API Authentication tab. If you need to create a new one:

  1. Under the API Authentication tab, click on the Create New Application button. 

The Create New Application button

  1. In the Add Application window, set the Application Name. This is only used to help you organize your applications, so you know which ID/Secret pairs you're using with your different apps.
  2. Optionally, you can add an Application Description to provide more info about how you're using this application.
  3. For the Application Scope, select the checkbox for each module you want this application to have access to.
    • View access: this will give the application read/view access to the v1.1 endpoints.
    • Create access: this will give the application the ability to create new resources via the API. 
    • Update access: this will give the application the ability to update existing resources via the API.
  4. Click the Add button to save your changes. Your Client ID and Client Secret will appear in the Applications table.

The Add Application window

  1. To obtain an access token, use the /1.1/oauth/token endpoint for your site's API. You'll find this information in the Authentication via OAuth section of the API Authentication tab.
    • The LibAnswers v1.1 API uses OAuth 2.0 for authentication and supports the Client Credentials grant type.
  2. When submitting your API request, you'll need to provide that token in the Authorization header. You can find an example for your site in the Authorizing your API Requests section of the API Authorization page.

The Obtaining an Access Token and Authorizing your API Requests boxes

Available endpoints

Full details (including parameters, example requests, and example responses) for using each endpoint are available under Admin > Widgets & API > API Endpoints v.1.1 tab. Click on the resource link for each endpoint to view the corresponding documentation. 

Endpoint Type Description Access Level Required
tickets/create POST Creates new tickets in your system Create Asset(s)
queue/:queue_id_/formfields GET Returns details for the form fields for the specified queue. View Asset(s)
faqs GET Returns public FAQs from your groups. View Asset(s)
faqs/:id GET Returns a specific public FAQ by its ID number. View Asset(s)
topics GET Returns topics from your groups. View Asset(s)
topics/:id GET Returns a specific topic by its ID number. View Asset(s)
groups GET Returns groups from your system. View Asset(s)
groups/:id GET Returns a specific group by its ID number. View Asset(s)
search GET Returns search results from your system View Asset(s)
search/:query GET Returns relevant public FAQs based upon query terms. View Asset(s)
chat/widgets/status/:id GET Returns the online status of a specific chat widget by its ID number. View Asset(s)
chat/widgets GET Returns data about chat widgets in your system, including the HTML embed code. View Asset(s)