API Reference
Search

Search API Documentation

The Search API allows users to submit search queries and returns ranked results based on relevancy and client-specific content prioritization (when applicable).

API Overview

Endpoint URL

https://api.crediblemind.com/search

Method

GET

Authentication

Requests to the Keyword API require a valid API key provided in the request header:

💡
Ask your client success representative for your API key
GET /search HTTP/1.1
Host: api.crediblemind.com
x-api-key: YOUR_API_KEY

Request Parameters

Required Parameters

  • brand: A unique identifier for each CredibleMind client.
  • q: The user's search query string.

Optional Parameters

  • subbrand: An additional identifier, used when applicable.
  • lang: The language of the search query, used to tailor the search results for specific languages.
  • pgSize: The maximum number of results to return with each request, for pagination.
  • page: The page number for pagination. Starts at 1 for the first page of results.

Example Request

curl -X GET "https://api.crediblemind.com/search?brand=benovo&subbrand=acme&page=1&pgSize=2&q=anxiety&lang=en" \
 -H "x-api-key: YOUR_API_KEY"

Response Format

The response will be in JSON format, structured as follows:

{
  "numResults": 25,
  "pgSize": 2,
  "page": 1,
  "results": [
    {
      "path": "/articles/anxiety-in-older-adults",
      "title": "Anxiety in Older Adults",
      "type": "Articles",
      "description": "These fact sheets are brought to you through a joint partnership with the National Council on Aging. Mental Health America collaborates with the National Council on Aging (NCOA) My Medicare Matters campaign in support of our joint goal of assisting older adults to access mental health resources through Medicare."
    },
    {
      "path": "/articles/anxiety-in-teens-how-you-can-help",
      "title": "Anxiety in Teens: How You Can Help",
      "type": "News",
      "description": "No matter where you look, more and more studies show increasing rates of anxiety in teens and college students. Other mental health issues can go hand-in-hand, including depression and various kinds of addictions. A team of UC Berkeley researchers recently reported that the number of 18-to 26-year-olds suffering from anxiety has doubled since 2008,"
    }
  ]
}

Response Definitions

  • numResults (int): The total number of results available for the query.
  • pgSize (int): The number of results returned with each request, used for pagination.
  • page (int): The page number for pagination. Starts at 1 for the first page of results.
  • results (array): An array of search results, sorted by relevance. Each result includes:
    • title (string): The title or name of the resource.
    • path (string): A URL path to the resource, which can be programmatically appended to a base content source URL.
    • type (string): The type of resource, such as topic, article, or assessment.
    • description (string): A brief description of the resource.

Success Response

  • Code: 200 OK
  • Content:
{
  "numResults": 5,
  "pgSize": 2,
  "page": 1,
  "results": [
    {
        "path": "path1",
        "title": "keyword1"
        "type": "type1",
        "description": "description1"
    },
    {
        "path": "path2",
        "title": "keyword2"
        "type": "type2",
        "description": "description2"
    }
  ]
}

Error Response

  • Code: 401 Unauthorized
  • Content:
{
  "error": "Invalid API Key"
}