API

Using the destinations API

To get startet, you have to grab your API token from the settings page. Please make sure to replace the authorization header in the examples below with your actual API token.

Get an overview of all destinations

Use this endpoint to see all your available destinations. If you're planning to update a certain destionation, you can make use of the returned list to figure out its uuid.

curl -X GET \
  -H "Content-Type: application/json" \
  -H 'authorization: XYZ-XYZ-XYZ-XYZ-XYZ' \
  https://chatterdocs.ai/api/pipeline/destinations

Example to create a new landing page

Landing pages are hosted websites that live under https://chatterdocs.ai/p/<id>. When created via our API, we also send back the URL of the newly created landingpage in the response.

curl -X POST \
  -H "Content-Type: application/json" \
  -H "authorization: XYZ-XYZ-XYZ-XYZ-XYZ" \
  -d '{
    "name": "New landingpage destination - API",
    "embed_type": "landingpage",
    "config": {
      "title": "My new landig page",
      "questions": ["What is your name?"],
      "password": "123",
      "showContext": true
    }
  }' \
  https://chatterdocs.ai/api/pipeline/destinations

Example to create a new embed

Embeds are full chat UIs that can be rendered in between your page's content. you can provide example questions by setting the questions parameter in the config.

curl -X POST \
  -H "Content-Type: application/json" \
  -H "authorization: XYZ-XYZ-XYZ-XYZ-XYZ" \
  -d '{
    "name": "New embed destination — API",    
    "embed_type": "embed",
    "domain": "https://domain.com",
    "config": {
      "title": "My new embed",
      "questions": ["What is your name?"],
      "showContext": true,
      "contextType": "link"
    }
  }' \
  https://chatterdocs.ai/api/pipeline/destinations

Example to create a new widget

Widgets are little chat bubbles that live in the bottom corner of your webseite. You can set them to be on the left side, by providing the position parameter in the config.

curl -X POST \
  -H "Content-Type: application/json" \
  -H "authorization: XYZ-XYZ-XYZ-XYZ-XYZ" \
  -d '{
    "name": "New embed destination — API",    
    "embed_type": "widget",
    "domain": "https://domain.com",
    "position": "right",
    "config": {
      "title": "Our documentation bot",
      "body": "We trained this bot on our full documentation. Ask away!"
    }
  }' \
  https://chatterdocs.ai/api/pipeline/destinations

Example to update a destination

To update a destination you must first retrieve its id (uuid). You can do so by fetchig all destinations as shown above and extract its uuid parameter. Make sure to include all necessary parameters for the new type, if you change the embed type.

curl -X PUT \
  -H "Content-Type: application/json" \
  -H "authorization: XYZ-XYZ-XYZ-XYZ-XYZ" \
  -d '{
    "name": "A changed destination",
    "embed_type": "embed",
    "domain": "https://domain.tld",
    "id": "a0234840-e9da-c18a-9ff3-8b6g9230c3f9",
    "config": {
      "title": "My changed embed",
      "questions": ["What is your name?"],
      "showContext": true
    }
  }' \
  https://chatterdocs.ai/api/pipeline/destinations

Example to delete a destination

To delete a destination you must first retrieve its id (uuid). You can do so by fetchig all destinations as shown above and extract its uuid parameter.

curl -X DELETE \
  -H "Content-Type: application/json" \
  -H "authorization: XYZ-XYZ-XYZ-XYZ-XYZ" \
  -d '{"id": "a0234840-e9da-c18a-9ff3-8b6g9230c3f9"}' \
  http://localhost:3000/api/pipeline/destinations